When booting my Ubuntu 16.04 after a seemingly successful sudo apt upgrade
, I was faced with a black screen and a blinking “Caps Lock” keyboard LED.
Since I didn’t know what was happening, I forced a system shutdown (by maintaining the power button pressed for a few seconds) then booted into recovery mode. This time, while the “Caps Lock” LED was still blinking, the screen displayed some info:
VFS: Cannot open root device "sda5" ... (sda5 is Ubuntu's root partition) ... Kernel panic ... ... Call trace ... ...
Frankly, most of that was just a bunch of nonsense to me… but hopefully not to Google! 😀
After reading a post on AskUbuntu and another on Ubuntu Forums I managed to get my system up and running again.
- Get the ISO image corresponding to the Ubuntu version you’re trying to fix (in my case, it was the latest 16.04 64bit desktop image)
- Create a Live USB (or CD) (from Windows or Ubuntu)
- Boot into the Live USB
- Choose “Try Ubuntu without installing”
- Identify Ubuntu’s root partition. (e.g. using the “Disks” app) In my case, it was the
sda5
partition - Open a terminal [Ctrl + Alt + T]
- Chroot into the Ubuntu partition as explained in LiveCdRecovery/Update_Failure (replace
sda5
by your partition’s name)ubuntu@ubuntu:~$ sudo mount /dev/sda5 /mnt ubuntu@ubuntu:~$ sudo mount --bind /dev /mnt/dev ubuntu@ubuntu:~$ sudo mount --bind /proc /mnt/proc ubuntu@ubuntu:~$ sudo mount --bind /sys /mnt/sys ubuntu@ubuntu:~$ sudo chroot /mnt
- After the last command, you should get a root prompt in the Ubuntu partition:
root@ubuntu:/#
In my case, I tried
apt autoremove
(I thought that I ran out of space… somehow) but I got the following error:root@ubuntu:/# apt autoremove E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
Which, of course, led to another issue:
root@ubuntu:/# dpkg --configure -a Setting up gnome-software-common (3.20.1+git20170208.0.a34b091-0ubuntu1~xenial1) ... ... Setting up desktop-file-utils (0.22-1ubuntu5.1) ... Configuration file '/etc/gnome/defaults.list' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** defaults.list (Y/I/N/O/D/Z) [default=N] ? D
- I forgot to save the diff, but it had something to do with
.desktop
files —
i.e. shortucts. Since I didn’t care much about said shortcuts, I chose to keep the package maintainter’s version:root@ubuntu:/# dpkg --configure -a Configuration file '/etc/gnome/defaults.list' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** defaults.list (Y/I/N/O/D/Z) [default=N] ? Y Installing new version of config file /etc/gnome/defaults.list ... ... Setting up gnome-software (3.20.1+git20170208.0.a34b091-0ubuntu1~xenial1) ... Installing new version of config file /etc/xdg/autostart/gnome-software-service.desktop ... Setting up linux-image-4.4.0-67-generic (4.4.0-67.88) ... Running depmod. update-initramfs: deferring update (hook will be called later) Examining /etc/kernel/postinst.d. run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic update-initramfs: Generating /boot/initrd.img-4.4.0-67-generic run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.4.0-67-generic Found initrd image: /boot/initrd.img-4.4.0-67-generic Found linux image: /boot/vmlinuz-4.4.0-66-generic Found initrd image: /boot/initrd.img-4.4.0-66-generic Found linux image: /boot/vmlinuz-4.4.0-64-generic Found initrd image: /boot/initrd.img-4.4.0-64-generic Found linux image: /boot/vmlinuz-4.4.0-62-generic Found initrd image: /boot/initrd.img-4.4.0-62-generic Found linux image: /boot/vmlinuz-4.4.0-59-generic Found initrd image: /boot/initrd.img-4.4.0-59-generic Found linux image: /boot/vmlinuz-4.4.0-57-generic Found initrd image: /boot/initrd.img-4.4.0-57-generic Found linux image: /boot/vmlinuz-4.4.0-21-generic Found initrd image: /boot/initrd.img-4.4.0-21-generic Adding boot menu entry for EFI firmware configuration done ... Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.4.0-67-generic Found initrd image: /boot/initrd.img-4.4.0-67-generic Found linux image: /boot/vmlinuz-4.4.0-66-generic Found initrd image: /boot/initrd.img-4.4.0-66-generic Found linux image: /boot/vmlinuz-4.4.0-64-generic Found initrd image: /boot/initrd.img-4.4.0-64-generic Found linux image: /boot/vmlinuz-4.4.0-62-generic Found initrd image: /boot/initrd.img-4.4.0-62-generic Found linux image: /boot/vmlinuz-4.4.0-59-generic Found initrd image: /boot/initrd.img-4.4.0-59-generic Found linux image: /boot/vmlinuz-4.4.0-57-generic Found initrd image: /boot/initrd.img-4.4.0-57-generic Found linux image: /boot/vmlinuz-4.4.0-21-generic Found initrd image: /boot/initrd.img-4.4.0-21-generic Adding boot menu entry for EFI firmware configuration done Setting up linux-headers-4.4.0-67-generic (4.4.0-67.88) ... Examining /etc/kernel/header_postinst.d. run-parts: executing /etc/kernel/header_postinst.d/dkms 4.4.0-67-generic /boot/vmlinuz-4.4.0-67-generic Processing triggers for libc-bin (2.23-0ubuntu5) ...
- Then I exited and rebooted
I have a Windows 10 / Ubuntu 16.04 dual boot. However, the first time I booted into grub, the Windows entry was not listed! So I proceeded to booting into my (hopefully) fixed Ubuntu.
The system booted successfully. After logging in, I executed sudo apt autoremove
which got rid of about 1GB worth of linux-image-*
packages… yeah… This was probably the root cause of this whole mess…
In any case, without rebooting, I ran the following:
sudo apt update sudo apt upgrade # found and added the Windows entry to Grub sudo apt dist-upgrade
Then, I rebooted. Now, everything is Ok.