[Bug 1640878] Re: grub2 cannot currently generate configuration without initrd

Steve Langasek steve.langasek at canonical.com
Wed Mar 1 20:16:56 UTC 2017


** Description changed:

  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_INITRD=true >> /etc/default/grub
+   root=$(awk </etc/fstab '$2 == "/" { print $1 }')
+   case $root in
+       LABEL=*|UUID=*)
+           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_PARTUUID=$partuuid >> /etc/default/grub
+   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.

** Description changed:

  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_INITRD=true >> /etc/default/grub
-   root=$(awk </etc/fstab '$2 == "/" { print $1 }')
-   case $root in
-       LABEL=*|UUID=*)
-           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_PARTUUID=$partuuid >> /etc/default/grub
-   fi
+   echo GRUB_DISABLE_INITRD=true >> /etc/default/grub
+   root=$(awk </etc/fstab '$2 == "/" { print $1 }')
+   case $root in
+       LABEL=*|UUID=*)
+           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_PARTUUID=$partuuid >> /etc/default/grub
+   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.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1640878

Title:
  grub2 cannot currently generate configuration without initrd

Status in grub2 package in Ubuntu:
  Fix Released
Status in grub2 source package in Xenial:
  Fix Committed

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_INITRD=true >> /etc/default/grub
    root=$(awk </etc/fstab '$2 == "/" { print $1 }')
    case $root in
        LABEL=*|UUID=*)
            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_PARTUUID=$partuuid >> /etc/default/grub
    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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1640878/+subscriptions



More information about the foundations-bugs mailing list