[Bug 1870189] Re: initramfs does not get loaded
Dexuan Cui
decui at microsoft.com
Mon May 4 22:37:51 UTC 2020
Today I just repeated the test "Create a Gen-1 Ubuntu 19.10 VM on Azure,
and upgrade it to Ubuntu 20.04 by “do-release-upgrade –d" and I
reproduced this bug again, and the grub version is also 2.04-1ubuntu26!
So I suspect grub itself should be good, but some grub config file (i.e. /etc/grub.d/10_linux?) causes the bug?
I checked my /etc/grub.d/10_linux: after I added line 263, "grub-mkconfig" can generate the needed initrd line correctly:
257 fi
258
259 sed "s/^/$submenu_indentation/" << EOF
260 initrd ${rel_dirname}/${initrd}
261 else
262 linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} panic=-1
263 initrd ${rel_dirname}/${initrd}
264 fi
265 initrdfail
266 EOF
My /etc/grub.d/10_linux is from the grub2-common package
(2.04-1ubuntu26). It looks this file in my VM that's upgraded from 19.10
to 20.04 is different from the version of the file in a VM that's
created from https://releases.ubuntu.com/20.04/ubuntu-20.04-live-
server-amd64.iso
That's why I suspected it is specific to the cloud-image version of
Ubuntu 20.04. I don't know how exactly “do-release-upgrade -d" works and
where the upgrade procedure pulls the grub2 that lacks the initrd line
in the /etc/grub.d/10_linux.
In summary,
1. https://cloud-images.ubuntu.com/focal/20200430.1/focal-server-cloudimg-amd64.img and https://cloud-images.ubuntu.com/focal/20200430.1/focal-server-cloudimg-amd64-azure.vhd.zip have the bug.
2. https://releases.ubuntu.com/20.04/ubuntu-20.04-live-server-amd64.iso does not have the bug.
3. A quick fix is add the needed line 263 (see above), but I think we need to understand how the bug is introduced.
--
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/1870189
Title:
initramfs does not get loaded
Status in grub2 package in Ubuntu:
Confirmed
Status in linux-azure package in Ubuntu:
Confirmed
Bug description:
A Gen-1 Ubuntu 19.10 VM on Azure was created and upgraded to Ubuntu
20.04 by “do-release-upgrade –d”.
Then the latest Ubuntu v5.6 kernel was installed from
https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.6/. As soon as a
reboot was performed, a panic with the v5.6 kernel occured because the
rootfs can not be found.
It turns out by default, initramfs does not get loaded:
/boot/grub/grub.cfg:
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3d2737e8-
b95a-42bf-bac1-bb6fb4cda87f' {
…
if [ "${initrdfail}" = 1 ]; then
linux /boot/vmlinuz-5.6.0-050600-generic root=PARTUUID=bc3d472f-401e-4774-affa-df1acba65a73 ro console=tty1 console=ttyS0 earlyprintk=ttyS0 ignore_loglevel sysrq_always_enabled unknown_nmi_panic
initrd /boot/initrd.img-5.6.0-050600-generic
else
linux /boot/vmlinuz-5.6.0-050600-generic root=PARTUUID=bc3d472f-401e-4774-affa-df1acba65a73 ro console=tty1 console=ttyS0 earlyprintk=ttyS0 ignore_loglevel sysrq_always_enabled unknown_nmi_panic panic=-1
#Dexuan: here the initrd line is missing!
fi
initrdfail
}
As we can see, Ubuntu only uses the initrd.img if initrdfail=1. Normally, initrdfail = 0, so when we boot the v5.6 kernel for the first time, we must hit the “fail to mount rootfs” panic and the kernel will automatically reboot….
Also, the “initrdfail” here marks initrdfail=1, so when the kernel
boots for the 2nd time, the kernel should successfully boot up. Next,
when the kernel boots for the 3rd time, it panics again since the
userspace program resets initrdfail to 0, and next time when the
kernel boots, it can boot up successfully -- this
“panic/success/panic/success” pattern repeats forever…
The linux-azure kernels are not affected since they have the vmbus driver and storage drivers built-in (i.e. “=y”):
/boot/config-5.3.0-1013-azure:CONFIG_HYPERV_STORAGE=y
/boot/config-5.3.0-1013-azure:CONFIG_HYPERV=y
/boot/config-5.4.0-1006-azure:CONFIG_HYPERV_STORAGE=y
/boot/config-5.4.0-1006-azure:CONFIG_HYPERV=y
/boot/config-5.6.0-050600-generic:CONFIG_HYPERV_STORAGE=m
/boot/config-5.6.0-050600-generic:CONFIG_HYPERV=m
The v5.6 kernel uses =m rather than =y, so is affected here.
It looks the setting may be intentional, but we should not assume a customer kernel must have the necessary vmbus/storage drivers built-in.
This issue only happens to the Ubuntu Marketplace image (19.10 and maybe 19.04 as well?) on Azure.
We installed a Ubuntu 20.04 VM from the .iso file from http://cdimage.ubuntu.com/daily-live/pending/ and don’t see the strange grub issue.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1870189/+subscriptions
More information about the foundations-bugs
mailing list