grub2 cannot currently generate configuration without initrd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grub2 (Ubuntu) |
Fix Released
|
High
|
Chris Glass | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
grub2-signed (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
As it currently stands grub2 cannot create grub.cfg menu entries that do not use an initrd image if one is present but the user does not desire to use it.
Furthermore, root= entries only support UUID and LABEL, but neither is an option if booting the kernel without an initrd.
Suggestion:
Allow grub2 to create configuration files without an "initrd" line and passing PARTUUID as root= entry by adding configuration knobs.
[SRU Justification]
A lot of time is wasted across the many, many instances of Ubuntu loading initramfs when booting. It's a measurable savings of CPU time and electricity to skip loading an initramfs at boot if it's not required.
[Test case]
1. cp /boot/grub/grub.cfg /tmp/grub.cfg
2. install the grub packages from -proposed.
3. cmp /boot/grub/grub.cfg /tmp/grub.cfg || echo 'fail'
4. as root, configure /etc/default/grub to mount the root disk directly and bypass the initramfs:
echo GRUB_DISABLE_
root=$(awk </etc/fstab '$2 == "/" { print $1 }')
case $root in
LABEL=
dev="-l -t $root"
;;
*)
dev=$root
;;
esac
partuuid=$(blkid -s PARTUUID -o value $dev)
if [ -z "$partuuid" ]; then
echo "Error: cannot get partuuid for $root."
else
echo GRUB_FORCE_
fi
5. If a partuuid has been found, run update-grub. Note that this will only work if your root device is a partition on a GPT-formatted disk.
6. Check that /boot/grub/grub.cfg now contains entries that don't specify an initramfs, and do include root=PARTUUID=* on the kernel commandline.
[Regression potential]
This upload introduces no behavior changes unless the user updates /etc/default/grub to configure the use of the new feature, so there should be no regressions here. The SRU test case verifies that /boot/grub/grub.cfg remains unchanged with the new version.
Changed in grub2 (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Chris Glass (tribaal) |
description: | updated |
description: | updated |
cyphermox uploaded patched packages to ppa:cyphermox/grub .
Steps to assert this works are as follows:
- Boot a Yakkety EC2 image (https:/ /console. aws.amazon. com/ec2/ home?region= eu-central- 1#launchAmi= ami-b87881d7) by-partuuid/ (should be 6983c98a-01 on this particular image) PARTUUID= 6983c98a- 01" to /etc/default/grub INITD=true" to /etc/default/grub.
- Login
- sudo apt-add-repository ppa:cyphermox/grub; sudo apt update; sudo apt-upgrade
- reboot
(assert the system comes back online with no modifications to the grub config)
- login again
- Get the PARTUUID for the image's disk: ls /dev/disk/
- Add "GRUB_FORCE_
- sudo update-grub
- reboot
(assert the system comes back online with a root=PARTUUID config)
- login again
- Add "GRUB_DISABLE_
- sudo update-grub
- reboot
(assert the system comes back online with root=PARTUUID and no initrd)
Currently the Xenial images we build don't expose partuuids (it's an artifact of CPC transitionning to a new build system, AFAIU).