grub-setup fails with "error message = file not found"
I initially reported this as Debian bug #494589 [0]
Felix Zielcke asked me to forward this report to this mailing list.
Reproduced with latest upstream SVN (rebuilt r1802 today).
Failing command:
grub-setup -vv --directory=/boot/grub --device-map=/boot/grub/device.map '(hd0)' >grub-setup.log 2>&1
grub-setup.log is available at [1]
/boot/grub/core.img exists and was created normally by grub-install. I looked at the parameters passed to grub-mkimage and it was using the correct modules (ext2 gpt biosdisk). I've run sync and unmounted/remounted /boot but that doesn't help.
grub-fstest seems to have no problem with reading from the filesystem:
# grub-fstest /dev/sda1 ls /grub/core.img core.img # grub-fstest /dev/sda1 blocklist /grub/core.img 655432+55,655487[0-414] # grub-fstest /dev/sda1 cmp /grub/core.img /boot/grub/core.img; echo $? 0
/dev/sda is partitioned using GPT. /boot is a normal ext3 filesystem on /dev/sda1.
I've made the MBR [2] and sda1 (about 38MB) [3] available.
Final note: this exact setup worked just fine when I installed this system in mid-June. I can probably figure out the version of grub2 on the install CD if that would help.
[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494589
[1] http://dev.teamgleim.com/~emallcut/grub2/grub-setup.log
[2] http://dev.teamgleim.com/~emallcut/grub2/sda.mbr.gz
[3] http://dev.teamgleim.com/~emallcut/grub2/sda1.gz
Signature · 1 line
Edward Allcutt
Quoted 3 lines · Edward Allcutt
[1] http://dev.teamgleim.com/~emallcut/grub2/grub-setup.log
grub-setup: info: will leave the core image on the filesystem
The blocklist approach should still work, but it's not recommended.
I suggest you allow GRUB to embed core.img instead by adding a BIOS boot partitition using Parted. We still need to trace down the problem with blocklists, but this will tell us whether the problem is related to this or something else.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 6 lines · Robert Millan
Quoted 3 lines · Edward Allcutt
[1] http://dev.teamgleim.com/~emallcut/grub2/grub-setup.log
grub-setup: info: will leave the core image on the filesystem
The blocklist approach should still work, but it's not recommended.
I was actually unaware that grub2 was using a blocklist. I thought it always embedded the core image.
Quoted 4 lines
I suggest you allow GRUB to embed core.img instead by adding a BIOS boot partitition using Parted. We still need to trace down the problem with blocklists, but this will tell us whether the problem is related to this or something else.
I set the "boot" flag for /dev/sda1 using parted. I hope this is what you meant. grub-setup still fails with the same error and it still mentions "will leave the core image on the filesystem".
Signature · 1 line
Edward Allcutt
Quoted 2 lines · Edward Allcutt
[2] http://dev.teamgleim.com/~emallcut/grub2/sda.mbr.gz
[3] http://dev.teamgleim.com/~emallcut/grub2/sda1.gz
Those scattered pieces of disk are not very useful. My suspicion is that grub-setup has trashed your GPT metadata. Can you verify that all your partitions are still readable from real GRUB, and that files are accessible as well? (from a rescue disk or so)
grub-fstest / grub-emu checks are not that reliable, since they might still work because of the host OS disk cache.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 9 lines · Edward Allcutt
Quoted 6 lines · Robert Millan
Quoted 3 lines · Edward Allcutt
[1] http://dev.teamgleim.com/~emallcut/grub2/grub-setup.log
grub-setup: info: will leave the core image on the filesystem
The blocklist approach should still work, but it's not recommended.
I was actually unaware that grub2 was using a blocklist. I thought it always embedded the core image.
It embeds core.img whenever possible, which on GPT depends on whether you have a dedicated partition for BIOS boot or not.
Quoted 7 lines
Quoted 4 lines
I suggest you allow GRUB to embed core.img instead by adding a BIOS boot partitition using Parted. We still need to trace down the problem with blocklists, but this will tell us whether the problem is related to this or something else.
I set the "boot" flag for
/dev/sda1using parted. I hope this is what you meant. grub-setup still fails with the same error and it still mentions "will leave the core image on the filesystem".
The "boot" flag on GPT means "EFI system partition" (this is admittedly confusing). There's a flag for bios boot, but only in recent versions of Parted. But of course, I wouldn't do that to your existing sda1 unless you want it to be wiped with GRUB code.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 8 lines · Robert Millan
Quoted 2 lines · Edward Allcutt
[2] http://dev.teamgleim.com/~emallcut/grub2/sda.mbr.gz
[3] http://dev.teamgleim.com/~emallcut/grub2/sda1.gzThose scattered pieces of disk are not very useful. My suspicion is that grub-setup has trashed your GPT metadata. Can you verify that all your partitions are still readable from real GRUB, and that files are accessible as well? (from a rescue disk or so)
Just booted from a floppy image created by latest upstream. It read the GPT data just fine.
I'll see if I can juggle the existing partitions sufficiently to fit a dedicated boot partition.
Signature · 2 lines
Edward Allcutt Network Operations
Quoted 6 lines · Robert Millan
Quoted 5 lines · Edward Allcutt
Quoted 4 lines · Robert Millan
I suggest you allow GRUB to embed core.img instead by adding a BIOS boot partitition using Parted. We still need to trace down the problem with blocklists, but this will tell us whether the problem is related to this or something else.
Quoted 6 lines
Quoted 1 line
I set the "boot" flag for
/dev/sda1using parted. I hope this is what you meant. grub-setup still fails with the same error and it still mentions "will leave the core image on the filesystem".The "boot" flag on GPT means "EFI system partition" (this is admittedly confusing). There's a flag for bios boot, but only in recent versions of Parted. But of course, I wouldn't do that to your existing sda1 unless you want it to be wiped with GRUB code.
I wish there were another tool supporting GPT. parted is a real pain to use. Still I've got a dedicated "BIOS boot" partition now and grub-setup
seems happy to embed core.img on it without any errors.
While my problem is resolved it seems like there's still an annoying bug in either the ext2 driver or whatever else is involved in generating blocklists.
Thanks for the quick responses :)
Signature · 2 lines
Edward Allcutt Network Operations