apt – Failure in installing linux-headers-6.5.0-9-generic while installing Virtualbox on Ubuntu 23.10

While installing the package virtualbox on Ubuntu 23.10 I encountered an error that bricked my apt.

My machine is a dell XPS 13 9370 with a fresh install of Ubuntu 23.10 using the ubuntu-desktop-installer. There is no third party data activated, I am using the experimental TPM-Backed FDE.

While installing Virtualbox I got:

Selecting previously unselected package linux-headers-6.5.0-9-generic.
Preparing to unpack .../32-linux-headers-6.5.0-9-generic_6.5.0-9.9_amd64.deb ...
Unpacking linux-headers-6.5.0-9-generic (6.5.0-9.9) ...
dpkg: error processing archive /tmp/apt-dpkg-install-vaZ1A6/32-linux-headers-6.5.0-9-generic_6.5.0-9.9_amd64.deb (--unpack):
error creating symbolic link './lib/modules/6.5.0-9-generic/build': Read-only file system
dpkg: error while cleaning up:
unable to remove newly-extracted version of '/lib/modules/6.5.0-9-generic/build': Read-only file system

The /lib/modules directory is in /dev/loop1 which is mounted on a pc-kernel snap:

$ df -h /lib/modules
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop1      274M  274M     0 100% /snap/pc-kernel/1459

So it seems the package upgrade is trying to edit this read-only snap filesystem and failing with it, leaving everything in an inconsistent state, and now no more upgrades/reinstall/removal of packages is possible.

This thing is systematic and reproducible with the current packages version, I have already experienced it twice!

Read more here: Source link