FS#25701 - [grub2-common] grub-mkconfig doesn't work without using an initrd

Attached to Project: Arch Linux
Opened by Paride Legovini (torn) - Sunday, 21 August 2011, 18:03 GMT
Last edited by Ronald van Haren (pressh) - Sunday, 15 January 2012, 10:51 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Ronald van Haren (pressh)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

When no initrd is used the root partition is mounted from the fictitious device /dev/root:

% mount
/dev/root on / type ext4 (rw,relatime,commit=0)

but this breaks grub-mkconfig (grub-probe in particular, and maybe other things):

# grub-mkconfig
/sbin/grub-probe: error: cannot stat `/dev/root'.

See also https://bugs.archlinux.org/task/25659 for a discussion about the issue I had with the udev maintainers.
This task depends upon

Closed by  Ronald van Haren (pressh)
Sunday, 15 January 2012, 10:51 GMT
Reason for closing:  Implemented
Additional comments about closing:  added a comment in the install file that it may fail on systems running a custom kernel
Comment by Peter Weber (hoschi) - Monday, 12 September 2011, 07:43 GMT
We should really write a notice to all affected pages in the wiki, because this causes a bunch of different problems.
Maybe the tip from 25659 could be added

/*
Comment by Gerardo Exequiel Pozzi (djgera) - Tuesday, 23 August 2011, 20:07 GMT-4
Or trivially but not dynamic: "ln -s /dev/your-partition /lib/udev/devices/root". Just keep in mind this if you change your root-partition on migration ;)
*/

https://wiki.archlinux.org/index.php/Kernel_Compilation_without_ABS
https://wiki.archlinux.org/index.php/Kernel_Compilation_without_ABS_for_New_Users#16.29_Configure_Bootloader
https://wiki.archlinux.org/index.php/GRUB2

Loading a the initrd is unwanted by many custom-kernel users, it is unnecessary. So including the initrd is a ugly workaround. Also it should (?) be necessary to remove one or more hooks from the mkinitcpip.conf (filesystem, sata or pata). With the initrd (and the regular hooks) it get always a message that the "modprobe.dep" couldn't be loaded, it think this is caused by one of this hooks. But editing the mkinitcpio.conf will, of course, break the kernels offered by Archlinux itself!

Comment by Anish Bhatt (anish) - Sunday, 16 October 2011, 00:06 GMT
Have you tried configuring your kernel with CONFIG_DEVTMPFS_MOUNT=y ? Fixed it for me
Comment by Keshav Amburay (the.ridikulus.rat) - Thursday, 05 January 2012, 09:25 GMT Comment by Nick Spassoff (codingrobot) - Saturday, 07 January 2012, 15:08 GMT
I run a custom 3.2 kernel compiled with CONFIG_DEVTMPFS_MOUNT=y w/o initrd and I still experience the described problem.

Here are the current mount points:
% mount
/dev/root on / type ext4 (rw,noatime,user_xattr,barrier=1,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=1024896k,nr_inodes=256224,mode=755)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
/sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
/run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600,ptmxmode=000)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime,size=262144k)
%

Also /dev/root actually does not exist:
% file /dev/root
/dev/root: ERROR: cannot open `/dev/root' (No such file or directory)
%
Comment by Ronald van Haren (pressh) - Monday, 09 January 2012, 08:30 GMT
How about I modify the install message to say something similar to
'Trying to automatically create a config. This may fail on some systems running a custom kernel. Please refer to the wiki on how to create a config manually'

Or do we know what exactly makes it fail so we can condition on that?
Comment by Keshav Amburay (the.ridikulus.rat) - Monday, 09 January 2012, 09:20 GMT
@pressh: Why are you trying to run grub-mkconfig in post_install when you don't (similarly) run grub-install? If the users want, they can run it manually. There is no need to generate a grub.cfg when the package is installed. I, for one, don't use grub-mkconfig at all. I maintain my grub.cfg manually. Running mkconfig becomes a stumbling block for remaining/other package upgrades. Just install the package, don't run anything.
Comment by Ronald van Haren (pressh) - Monday, 09 January 2012, 09:49 GMT
@Keshav: There is a difference here. We only run grub-mkconfig once, on first install. It doesn't create the grub.cfg config file but an example config file which you still need to check and copy yourself. So all it does is create a reasonable example config file for your system (if it works that is). You still can and need to manage it yourself. IMO it is still better to provide a reasonable config 80% of the time than providing a random config all the time.

So no, it is not the same as running grub-install, which actually has effect on your systems behavior. IMO that should not be done (I'm not sure what would happen if you would run this in a chroot or something....)

Either way, we can set a conditional on when to or not to run grub-mkconfig (if we know that is), or simply try to run it and have a message stating that is may fail on some custom kernels. We could even copy a generic example file and try to overwrite it with grub-mkconfig so if it fails there is still something there that the user can build upon. Though I don't think I prefer this last one.

Btw this is the grub2 bug I'd like to close before pushing the updated packages, the rest is already in trunk (mostly).

Loading...