So I wanted to use makeboot.sh to my trusty USB stick, whcih has "been around" so to say.
In particular, the MBR of that stick contained grub bootloader code.
This mightily confuses parted, and then makeboot.sh says it cannot install onto that stick because the stars aren't right.
The following code is responsible for this, lines 249 ff:
#IfthedestinationdiskisnotMBRpartitiontable(e.g.it's GPT), exit. This program only works for MBR disk.if [-z"$(LC_ALL=C parted -s $target_disk print | grep -iE "^PartitionTable:" | grep -iE "msdos")"]; then["$BOOTUP"="color"] && $SETCOLOR_FAILURE echo "The partition table of $target_disk is not for MBR (Master Boot Record). Its layout is:" LC_ALL=C parted -s $target_disk print["$BOOTUP"="color"] && $SETCOLOR_NORMAL echo "This program is for making a bootable disk with MBR partition table." echo "For GPT disk, there is no need to run this program. Just make sure the partition is FAT32 with ID=ef00 and all the files are copied on that. That'sall." echo "Programterminated!"exit1fi
I am not sure why parted has problems. I tried from the command line using fdisk, which works perfectly well:
THEREFORE, should the makeboot.sh script be changed to offer the user the possibility to zero out bootloader code before parted gets to complain? The user should at least be told to zero the MBR out himself .... I was rather stumped for some time as to what the hell wasn't working.
Regards,
-- David
Last edit: David Tonhofer 2016-08-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wanted to use "makeboot.sh" to [configure a] USB stick, [and] the MBR of that stick contained grub bootloader code. This mightily confused parted.
Consider pinging bug-parted[2] about this. They might not know about it, or it might be version-specific. Note that bug-parted, despite its name, is the project's "main discussion list[,] used to discuss most aspects of Parted, including development and enhancement requests, as well as bug reports"[3].
So I wanted to use
makeboot.shto my trusty USB stick, whcih has "been around" so to say.In particular, the MBR of that stick contained grub bootloader code.
This mightily confuses
parted, and thenmakeboot.shsays it cannot install onto that stick because the stars aren't right.The following code is responsible for this, lines 249 ff:
I am not sure why
partedhas problems. I tried from the command line usingfdisk, which works perfectly well:But
partedbecomes a bit unhinged and tries to guess (i.e. uses the "loop" partition table):The solution is to remove bootloader code (446 byte) from the MBR:
dd if=/dev/zero of=/dev/sdb bs=446 count=1And for good measure remove anything past the MBR and before the start of the first partition:
dd if=/dev/zero of=/dev/sdb bs=512 seek=1 count=2047But I don't think that is necessary.
After that,
partedbehaves correctly:THEREFORE, should the
makeboot.shscript be changed to offer the user the possibility to zero out bootloader code beforepartedgets to complain? The user should at least be told to zero the MBR out himself .... I was rather stumped for some time as to what the hell wasn't working.Regards,
-- David
Last edit: David Tonhofer 2016-08-13
David Tonhofer[1]
Consider pinging bug-parted[2] about this. They might not know about it, or it might be version-specific. Note that bug-parted, despite its name, is the project's "main discussion list[,] used to discuss most aspects of Parted, including development and enhancement requests, as well as bug reports"[3].
FWIW, Tom Roche Tom_Roche@pobox.com