Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device does not have bootflag set #19

Closed
jkirk opened this issue May 24, 2019 · 9 comments · Fixed by #29
Closed

device does not have bootflag set #19

jkirk opened this issue May 24, 2019 · 9 comments · Fixed by #29
Assignees
Labels

Comments

@jkirk
Copy link
Contributor

jkirk commented May 24, 2019

% sudo parted /dev/sdb p
Model: Innostor Innostor (scsi)
Disk /dev/sdb: 15.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  14.0GB  14.0GB  primary  ntfs
 2      14.0GB  15.7GB  1729MB  primary  fat16        boot

% sudo ./grml2usb --fat16 /srv/data/isos/grml64-full_2018.12.iso /dev/sdb2
Executing grml2usb version ***UNRELEASED***
Are you sure you want to format the specified partition with fat16? y/N y
Note: you can skip this question using the option --force
Formating partition with fat16 filesystem
mkfs.fat 4.1 (2017-01-24)
Using ISO /srv/data/isos/grml64-full_2018.12.iso
Fatal: Device /dev/sdb2 does not have the bootflag set. Please enable it to be able to boot.

Did I miss something?

@jkirk
Copy link
Contributor Author

jkirk commented May 24, 2019

Ah, seems to be related to #12 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757993

@jkirk jkirk added the verify label Oct 23, 2019
@jkirk jkirk self-assigned this Oct 23, 2019
@jkirk
Copy link
Contributor Author

jkirk commented May 26, 2020

One year later, this time running Debian/buster:

% sudo parted /dev/sdb p                                                                      
Model: Sony Storage Media (scsi)
Disk /dev/sdb: 4010MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      31.7kB  4007MB  4007MB  primary  fat16        boot
% sudo ./grml2usb --fat16 /srv/data/isos/grml64-full_testing_build3133.iso /dev/sdb1          
Executing grml2usb version v0.16.5-40-g0de90ba (git)
Are you sure you want to format the specified partition with fat16? y/N y
Note: you can skip this question using the option --force
Formating partition with fat16 filesystem
mkfs.fat 4.1 (2017-01-24)
Using ISO /srv/data/isos/grml64-full_testing_build3133.iso
Fatal: Device /dev/sdb1 does not have the bootflag set. Please enable it to be able to boot.

@jkirk
Copy link
Contributor Author

jkirk commented May 26, 2020

It should be noted, that I pulled the latest version:

% git show --stat 
commit 0de90ba415ca8819f4785e053a3c689b06daedd3 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Prokop <mika@grml.org>
Date:   Tue May 12 17:17:26 2020 +0200

    Release new version 0.18.0

 debian/changelog | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

but git describe (which seems to be used to show the grml2usb version) looks like this:

% git describe
v0.16.5-40-g0de90ba

@jkirk
Copy link
Contributor Author

jkirk commented May 27, 2020

For the sake of debugging:

this are the first 520 Bytes (MBR) of the device, with the boot flag enabled:

% sudo hexdump -n 520 /dev/sdb
0000000 b8fa 1000 d08e 00bc b8b0 0000 d88e c08e
0000010 befb 7c00 00bf b906 0200 a4f3 21ea 0006
0000020 be00 07be 0438 0b75 c683 8110 fefe 7507
0000030 ebf3 b416 b002 bb01 7c00 80b2 748a 8b01
0000040 024c 13cd 00ea 007c eb00 00fe 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
00001b0 0000 0000 0000 0000 fd2d 0005 0000 0180
00001c0 0001 7b06 f9fe 003e 0000 6b92 0077 0000
00001d0 0000 0000 0000 0000 0000 0000 0000 0000
*
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
*
0000208

and here without the boot flag:

% sudo hexdump -n 520 /dev/sdb
0000000 b8fa 1000 d08e 00bc b8b0 0000 d88e c08e
0000010 befb 7c00 00bf b906 0200 a4f3 21ea 0006
0000020 be00 07be 0438 0b75 c683 8110 fefe 7507
0000030 ebf3 b416 b002 bb01 7c00 80b2 748a 8b01
0000040 024c 13cd 00ea 007c eb00 00fe 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
00001b0 0000 0000 0000 0000 fd2d 0005 0000 0100
00001c0 0001 7b06 f9fe 003e 0000 6b92 0077 0000
00001d0 0000 0000 0000 0000 0000 0000 0000 0000
*
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
*
0000208

Note the 0180 vs 0100 in line 00001b0.

I might be wrong, but this 80 is at position 0x01BF (= 447).

The lines in subject are

Maybe changing line 529 would fix that check?:

elif data[447] == b"\x80":

(Yes, I think this only works if we check the bootflag for the first partition.)

@jkirk
Copy link
Contributor Author

jkirk commented May 27, 2020

Oh, and the verbose output looks like this:

% sudo ./grml2usb --fat16 --verbose /srv/data/isos/grml64-full_testing_build3133.iso /dev/sdb1
2020-05-27 02:04:46,206 Executing grml2usb version v0.16.5-40-g0de90ba (git)
Are you sure you want to format the specified partition with fat16? y/N y
2020-05-27 02:04:47,590 Note: you can skip this question using the option --force
2020-05-27 02:04:47,590 Formating partition with fat16 filesystem
2020-05-27 02:04:47,590 mkfs.vfat -F 16 /dev/sdb1
mkfs.fat 4.1 (2017-01-24)
2020-05-27 02:04:48,006 Using ISO /srv/data/isos/grml64-full_testing_build3133.iso
2020-05-27 02:04:48,008 mount ['-o', 'loop,ro', '-t', 'iso9660'] /srv/data/isos/grml64-full_testing_build3133.iso /tmp/grml2usbl1mqeg7r
2020-05-27 02:04:48,050 register_mountpoint(/tmp/grml2usbl1mqeg7r)
2020-05-27 02:04:48,131 could not import parted, falling back to old bootflag detection
2020-05-27 02:04:48,134 bootflag is NOT enabled
2020-05-27 02:04:48,136 umount [] /tmp/grml2usbl1mqeg7r
2020-05-27 02:04:48,172 unregister_mountpoint(/tmp/grml2usbl1mqeg7r)
2020-05-27 02:04:48,172 Fatal: Device /dev/sdb1 does not have the bootflag set. Please enable it to be able to boot.
2020-05-27 02:04:48,172 Exception:
Traceback (most recent call last):
  File "./grml2usb", line 2177, in main
    install(iso, device)
  File "./grml2usb", line 1859, in install
    install_grml(iso_mountpoint, device)
  File "./grml2usb", line 1886, in install_grml
    check_boot_flag(device)
  File "./grml2usb", line 535, in check_boot_flag
    "Please enable it to be able to boot." % device
VerifyException: Device /dev/sdb1 does not have the bootflag set. Please enable it to be able to boot.

Which now explains the problem: python3-parted was missing on my system.

The bootflag detection works with the python3-parted module. If we want to fix the legacy detection we could keep this issue open, else feel free to close this issue.

But three more things we should talk about:

  • the version detection seems wrong
  • please check the bootflag before formatting the device
  • is it bootflag or is it boot flag?

@jkirk
Copy link
Contributor Author

jkirk commented May 27, 2020

Or: we could remove the legacy check and tell the user to install python3-parted.

@mika
Copy link
Member

mika commented May 27, 2020

git show --stat

Could it be that you're missing the tag v0.18.0? What happens if you run "git pull" in your local git repos?
(FTR, I can't reproduce this issue)

mika added a commit that referenced this issue May 27, 2020
While at it rename "bootflag" into "boot flag" in human readable
strings.

Thanks: Darshaka Pathirana for bug report and debugging
Closes: #19
@mika
Copy link
Member

mika commented May 27, 2020

Or: we could remove the legacy check and tell the user to install python3-parted.

That's what I did in #29 - please review, test and let me know whether this works for you.

@jkirk
Copy link
Contributor Author

jkirk commented May 28, 2020

git show --stat

Could it be that you're missing the tag v0.18.0? What happens if you run "git pull" in your local git repos?
(FTR, I can't reproduce this issue)

You were right, I did not pull the tags, just the master branch. (git pull upstream did the trick.)

@mika mika closed this as completed in 705a96b May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants