[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug in7.4.0 flash-knoppix script.



Hello Eric,

On Thu, Sep 11, 2014 at 04:18:17PM -0700, Eric Kudzin wrote:
>    I think I found a bug in the v7.4.0 flash-knoppix script that it doesn't
>    set the "boot" flag in the MBR partition table, so the card never boots.
>    I believe:
>    MAKE_BOOTABLE="true"
>    is not set when you select:
>    n No Overlay (read-only like CD/DVD)
>    so:
>    # Finally mark partition 1 as bootable, if not already done.
>    # this may cause another udev run, which we can ignore here
>    if [ -n "$MAKE_BOOTABLE" ]; then
>     sfdisk -A1 "${FLASH}" 2>"$TMP.err" || { ERROR="$(<$TMP.err)"; bailout 2;
>    }
>     blockdev --flushbufs "${FLASH}"
>    fi
>    is never called
>    Screenshots of steps at:
>    [1]https://www.flickr.com/photos/126934570@N05/sets/72157647506682635/
>    This has happen to me twice on 2 different cards. 
>    Eric

The "MAKE_BOOTABLE" is only used for pre-existing FAT32 partitions when
selecting "No" to the question whether or not to reformat. For all other
options that require repartitioning, parted does this job. Look for the
lines that say:

set 1 boot on

which does the same thing that sfdisk -A1 did in ALL cases in older
Knoppix versions, adding a flag for "bootability". The code you quoted
is just needed in the case that the devices partition wasn't changed.

So, in either case, the first partition should have always been marked
as bootable by the script.

But, looking at the code, there is another bug I missed which explains
your observation: In the case of the "like DVD" selection with no
overlay, the flash disk is not repartitioned and reformatted even if you
selected "n" in the previous dialog, i.e. an existing FAT filesystem is
just reused and not overwritten. In this case, the "don't reformat" does
not apply, and the boot flag is not set because parted was not called.

This is minor problem, since most BIOSes ignore the "boot" flag and
just happily load the MBR. On the other side, I had one old IBM notebook that
required the "boot" flag, though, and ignored disks or flash pens in the
boot menu otherwise.

Regards
-Klaus


Reply to: