help-grub
[Top][All Lists]
Advanced

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

Re: grub2-mkconfig with root on rootfs


From: Jordan Uggla
Subject: Re: grub2-mkconfig with root on rootfs
Date: Sat, 12 Oct 2013 01:21:33 -0700

On Fri, Oct 11, 2013 at 9:58 PM, Andrey Borzenkov <address@hidden> wrote:
> В Thu, 10 Oct 2013 00:27:45 +0400
> Peter Volkov <address@hidden> пишет:
>
>> > > > OK so do I understand it correctly - you are running purely from
>> > > > initramfs and do not have any additional filesystems?
>> > >
>> > > yup.
>> > >
>> > > > On which device do you install grub? Where is your /boot/grub located?
>> > > >
>> > > > Please show full command line and its output used to install grub.
>> > >
>> > > I have single hard drive /dev/sdc with two partitions. First partition
>> > > is formatted with ext4 (second partition is unformatted yet). To install
>> > > grub I mount it to /mnt/root/ directory
>> >
>> > This was not present in mntinfo output. How should others guess it?
>>
>> Well, I thought that grub2-mkconfig should work even without "/boot"
>> (in my case /mnt/root) mounted. So full output is at the end of this mail.
>>
>>
>> > >                                         and then I run:
>> > >
>> > > grub2-install /dev/sdc --boot-directory=/mnt/root/
>> > >
>> > > Then my "/boot/grub" is located at (hd0, msdos1)/grub.
>> > >
>> >
>> > You did not show any output from this command, so I assume this command
>> > completes without error?
>>
>> Yes, without any errors.
>>
>> # grub2-install /dev/sdc --boot-directory /mnt/root/
>> Installation finished. No error reported.
>>
>> And even more, grub2 works correctly if I put grub.cfg into /mnt/root/grub/ 
>> and reboot.
>> The problem is that grub2-mkconfig fails at grub2-probe:
>>
>> # /usr/sbin/grub2-probe --target=device /
>> /usr/sbin/grub2-probe: error: failed to get canonical path of `rootfs'.
>>
>
> OK, I see. Well, may be grub-mkconfig should support --boot-directory
> option as well. I suggest you post it to grub-devel, where someone may
> pick it up. If you could send patch, this would be even better :)

Adding a --boot-directory option to grub-mkconfig would not help in
this case (or at least wouldn't completely solve the problem) as
grub-mkconfig makes menu entries where the kernel is passed
information on where to find its root fs. grub-mkconfig is rightfully
unable to provide a value for the root= kernel parameter because there
is no device to mount, there is no pivot-root. It wouldn't be
difficult to make grub-mkconfig not pass any root= kernel parameter,
but it also doesn't make much sense to use grub-mkconfig for such a
non-standard configuration.

My strong recommendation is to not use grub-mkconfig at all for such a
configuration.

You (Peter) can just write a grub.cfg manually, and if my guess is
correct that you're installing new kernels manually rather than via a
package manager or other form of automated update then a small extra
step of adding a new entry at the same time shouldn't be too much
trouble.

If you are getting kernel updates automatically, or for some other
reason would like your grub.cfg automatically kept up to date, then
you can either make your own script that generates a grub.cfg, or
(what I would prefer) you can make a grub.cfg that uses grub-script
features to check what kernel images are in /boot/ and generates
entries dynamically for whatever it finds.

-- 
Jordan Uggla (Jordan_U on irc.freenode.net)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]