You are not logged in.

#1 2012-12-16 20:11:02

gay
Member
Registered: 2012-12-16
Posts: 93

what to do if grub2 won't install

still trying to complete my update

grub has been replaced by grub2; https://wiki.archlinux.org/index.php/Gr … ode_region states to migrate from grub to grub2 as follows

# modprobe dm-mod
# grub-install --target=i386-pc --recheck --debug /dev/sda
# mkdir -p /boot/grub/locale
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

to the second command, my system responds that ...

$ grub-install --target=i386-pc --recheck --debug /dev/sda
(...)
+ /usr/sbin/grub-probe -t fs /boot/grub
+ return 1
+ gettext_printf 'Path `%s'\'' is not readable by GRUB on boot. Installation is impossible. Aborting.\n' /boot/grub
+ gettext_printf_format='Path `%s'\'' is not readable by GRUB on boot. Installation is impossible. Aborting.\n'
+ shift
++ gettext 'Path `%s'\'' is not readable by GRUB on boot. Installation is impossible. Aborting.\n'
+ printf 'Path `%s'\'' is not readable by GRUB on boot. Installation is impossible. Aborting.\n' /boot/grub
Path `/boot/grub' is not readable by GRUB on boot. Installation is impossible. Aborting.
+ exit 1
$

... which is unfortunate. searching (the arch forums and google) for this error reveals several possible causes:
* dm_mod not loaded (but for me lsmod confirms that dm_mod is loaded)
* EFI disk (to my knowledge this does not apply for me)
* recent change in the partition table (the apparent suggestion being to reboot - however, this does of course not help if the bootloader is not working)

The last one (if it is true and this could be the cause) might be very likely. grub-install had first complained that there was not sufficient space for the core.img between the MBR and the first partition (in fact, there was no space, first partition started at sector 1). therefore I repartitioned the disk using fdisk to have the 2048 empty sectors it needs between the MBR and /dev/sda1 (and had to back up everything from /boot and reformat the fs on /boot).

grub-install will also not work if used with the --force switch; same error as above.

So: What do I do to make grub-install believe that I am serious about the installation and that the installation command is not a just suggestion that it simply can dismiss with some speculations about what might or might not be readable on boot?


We are exactly the people our parents always warned us about.

Offline

#2 2012-12-16 21:52:42

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: what to do if grub2 won't install

Doesn't grub-install have to be issued as root?  It appeas you have issued it as a normal user, if your copy/paste abilities are a reliable source.

Offline

#3 2012-12-16 23:05:18

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: what to do if grub2 won't install

First an easy possibility: Did you remember to remount /boot after reformatting and restoring the contents?

Otherwise: You can try to make the kernel reread the partition table immediately with kpartx, blockdev, or hdparm. It might not work if things are still mounted.

If you do need to reboot, I suggest using a current install media and chrooting in to finish the grub-install.

Offline

#4 2012-12-17 03:05:06

gay
Member
Registered: 2012-12-16
Posts: 93

Re: what to do if grub2 won't install

thanks for your answers.

I only saw them now; at the time you posted I had already tried to reboot.
as anticipated, it did not work. however, it provided me with a very interesting evening with a liveCD.

the problem was: the kernel does not like the partition table to change and will ignore any changes until the next reboot ("hdparm -z /dev/sda", i.e. forcing the kernel to see reason and to accept the new partition table did not work) ... which means when I re-mkfs'ed the boot partition it used the old partition table and on reboot partition table and filesystem were inconsistent. jackpot.

so i reformated the partition table another time from a chroot environment. this time grub-install ran cleanly. however it also deleted my kernel. not very nice. i do not really know why or how, the only way i can make sense of it is that it completely deletes the /boot partition. no idea why? it was not really a problem because I still had the backup of the boot partition; but at that point I was convinced that grub2 is a desaster in any possible way.

it took me another 30 minutes to figure out how grub-mkconfig puts the grub2 config together ... and another 30 minutes to figure out that the contents of /etc/grub.d/ are ignored if they are not executable (chmod +x)

finally it appears the device naming convention has changed from (hd0,0) in grub to 'hd0,msdos1' in grub2 for which I also fail to see a good reason.

a couple of hours later my system feels and looks still very messy but I got it up and running again...

thanks, ataraxia & WonderWoofie, for your ideas; good night.


We are exactly the people our parents always warned us about.

Offline

#5 2012-12-17 03:18:40

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: what to do if grub2 won't install

GRUB 2, to me, is a bit like systemd: More complex and opaque than most Archers would like it to be, but not so much that it's bad software, and with some real value in the added features. I particularly like that since GRUB's config file is not something I write by hand any more, I don't have to back up /boot (at least not any more than I'd back up things like /bin or /usr) - I just back up /etc and I have all the content that I wrote by hand.

I never had grub-install delete my kernel, or anything else that doesn't belong to it, so I don't know what happened there.

Offline

#6 2012-12-17 16:14:10

gay
Member
Registered: 2012-12-16
Posts: 93

Re: what to do if grub2 won't install

Perhaps you are right, ataraxia, and there are added features that come with systemd and grub2.

It does, however, make the update process always time consuming and difficult with most likely one or two things breaking. I guess we have to live with it.

I run arch on 2 more computers which I'm also going to have to update with migtation to systemd and grub2 ... I'm not looking forward to it ;-). Though I have to say that systemd did not turn out as bad as I feared and did actually not break my system ^^


We are exactly the people our parents always warned us about.

Offline

#7 2012-12-18 22:21:16

ict
Member
Registered: 2007-05-01
Posts: 44

Re: what to do if grub2 won't install

While you probably will have to switch to systemd for the dependencies when you update in the future, there is absolutely no need to ever upgrade grub to grub2 if everything works for you. I'm still running grub 0.97 because it can chainload Truecrypt for my Windows-partition without any problems.

Offline

#8 2012-12-19 03:35:43

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,148

Re: what to do if grub2 won't install

It definitely should not have deleted anything on /boot. At least, it should make changes to the contents of /boot/grub by updating/installing config files etc. but it should not have deleted your kernel. (Unless your kernel was named something like /boot/grub/grub.cfg but that seems unlikely.) I've never heard of it doing this, either.

I suspect the use of msdosX in specifying partitions may be because the current grub can also deal with GPT partitioned disks - on my machine, it uses (hdX,gptY). I rather like that this makes it obvious what sort of partition map I'm dealing with.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#9 2012-12-19 21:12:44

gay
Member
Registered: 2012-12-16
Posts: 93

Re: what to do if grub2 won't install

thanks ict & cfr for your comments,

regarding not updating to grub2: I suppose it would theoretically be possible using the grub-legacy package from AUR (or just always replacing /boot/vmlinuz-linux and /boot/initramfs-linux.img and never touching grub again) but still: grub1 is not part of the standard package database any more, but I suppose you are right.

regarding grub2 should not have overwritten /boot: Yes, I think so too. ^^ Seriously: It is certainly possible that I made some other mistake or misred some error message or (I don't know, a million possibilities), I'll pay attention to this when I take on updating one of my remaining Archs to grub2

Thanks.


We are exactly the people our parents always warned us about.

Offline

Board footer

Powered by FluxBB