Errors updating Ubuntu 20.04 to 22.04 – too many levels of symbolic links

I saw a bunch of errors while upgrading, so I just rebooted. Now, if I try to boot the latest kernel, the system just hangs. I booted to an old kernel’s recovery mode and tried to remove all of the nvidia packages, since I remember some of the errors mentioned nvidia, but that didn’t seem to work.

I can now boot 5.4.0-125-generic (most current installed is 5.15.0-46-generic), however it looks like an old package (linux-image-extra-4.4.0-47-generic) is causing errors:

$ apt -f install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  [...lots of packages...]
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-extra-4.4.0-47-generic
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
4 not fully installed or removed.
After this operation, 162 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 718568 files and directories currently installed.)
Removing linux-image-extra-4.4.0-47-generic (4.4.0-47.68) ...
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
 * dkms: running auto installation service for kernel 4.4.0-47-generic                                        
Error! Your kernel headers for kernel 4.4.0-47-generic cannot be found.
Please install the linux-headers-4.4.0-47-generic package or use the --kernelsourcedir option to tell DKMS where it's located.
                                                                                                       [ OK ]
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-47-generic
cp: failed to access '/var/tmp/mkinitramfs_Gr84ph//usr/sbin/reiserfsck': Too many levels of symbolic links
modinfo: ERROR: could not get modinfo from 'crc32': No such file or directory
ln: failed to create symbolic link '/var/tmp/mkinitramfs_Gr84ph/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_Gr84ph//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-47-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-47-generic (--remove):
 installed linux-image-extra-4.4.0-47-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-extra-4.4.0-47-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

When I try to install linux-headers-4.4.0-47-generic using apt, I get:

Package linux-headers-4.4.0-47-generic is not available, but is referred to by another package.

So I downloaded that and linux-headers-4.4.0-47 from Launchpad and installed them, but I am still receiving the Too many levels of symbolic links errors. I also can’t seem to run update-initramfs either.

# update-initramfs -u -k all
update-initramfs: Generating /boot/initrd.img-5.4.0-125-generic
cp: failed to access '/var/tmp/mkinitramfs_6mJRpW//usr/sbin/reiserfsck': Too many levels of symbolic links
ln: failed to create symbolic link '/var/tmp/mkinitramfs_6mJRpW/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_6mJRpW//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.4.0-125-generic with 1.

And here’s the output of dpkg --configure -a

Setting up initramfs-tools (0.140ubuntu13) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-5.15.0-46-generic (5.15.0-46.49) ...
Setting up usrmerge (25ubuntu2) ...
Smartmatch is experimental at /usr/lib/usrmerge/convert-usrmerge line 172.

FATAL ERROR:
Both /lib/libASEP11.so and /usr/lib/libASEP11.so exist.

You can try correcting the errors reported and running again
/usr/lib/usrmerge/convert-usrmerge until it will complete without errors.
Do not install or update other Debian packages until the program
has been run successfully.

dpkg: error processing package usrmerge (--configure):
 installed usrmerge package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-125-generic
cp: failed to access '/var/tmp/mkinitramfs_1kW62F//usr/sbin/reiserfsck': Too many levels of symbolic links
ln: failed to create symbolic link '/var/tmp/mkinitramfs_1kW62F/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_1kW62F//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.4.0-125-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.15.0-46-generic (5.15.0-46.49) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-46-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-46-generic
cp: failed to access '/var/tmp/mkinitramfs_n2elsy//usr/sbin/reiserfsck': Too many levels of symbolic links
ln: failed to create symbolic link '/var/tmp/mkinitramfs_n2elsy/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_n2elsy//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.15.0-46-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.15.0-46-generic (--configure):
 installed linux-image-5.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 usrmerge
 initramfs-tools
 linux-image-5.15.0-46-generic
Asked By: Mike

||

I seemed to have fixed it.

First, I thought of forcing the removal of linux-image-extra-4.4.0-47-generic, which seems to somehow be at the heart of the problem. I found this question and executed the following:

mv /var/lib/dpkg/info/linux-image-extra-4.4.0-47-generic.* /tmp
dpkg --remove --force-remove-reinstreq linux-image-extra-4.4.0-47-generic

I then tried to do an apt -f install, but there were still packages creating errors:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.140ubuntu13) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-5.15.0-46-generic (5.15.0-46.49) ...
Setting up usrmerge (25ubuntu2) ...
Smartmatch is experimental at /usr/lib/usrmerge/convert-usrmerge line 172.

FATAL ERROR:
Both /lib/libASEP11.so and /usr/lib/libASEP11.so exist.

You can try correcting the errors reported and running again
/usr/lib/usrmerge/convert-usrmerge until it will complete without errors.
Do not install or update other Debian packages until the program
has been run successfully.

dpkg: error processing package usrmerge (--configure):
 installed usrmerge package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-125-generic
cp: failed to access '/var/tmp/mkinitramfs_cvAKA2//usr/sbin/reiserfsck': Too many levels of symbolic links
ln: failed to create symbolic link '/var/tmp/mkinitramfs_cvAKA2/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_cvAKA2//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.4.0-125-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Processing triggers for linux-image-5.15.0-46-generic (5.15.0-46.49) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-46-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-46-generic
cp: failed to access '/var/tmp/mkinitramfs_eni8Bm//usr/sbin/reiserfsck': Too many levels of symbolic links
ln: failed to create symbolic link '/var/tmp/mkinitramfs_eni8Bm/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_eni8Bm//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.15.0-46-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.15.0-46-generic (--configure):
 installed linux-image-5.15.0-46-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 usrmerge
 initramfs-tools
 linux-image-5.15.0-46-generic

I then tried to remove those packages and then reinstall initramfs-tools and usrmerge:

apt remove initramfs-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  brltty brltty-x11 cryptsetup-initramfs initramfs-tools linux-image-4.4.0-47-generic
0 upgraded, 0 newly installed, 5 to remove and 10 not upgraded.
3 not fully installed or removed.
After this operation, 64.6 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 745215 files and directories currently installed.)
Removing linux-image-4.4.0-47-generic (4.4.0-47.68) ...
Examining /etc/kernel/prerm.d.
run-parts: executing /etc/kernel/prerm.d/dkms 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
dkms: removing: virtualbox 6.1.34 (4.4.0-47-generic) (x86_64)
Module virtualbox-6.1.34 for kernel 4.4.0-47-generic (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

vboxdrv.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.4.0-47-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

vboxnetadp.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.4.0-47-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.


vboxnetflt.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.4.0-47-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
update-initramfs: Deleting /boot/initrd.img-4.4.0-47-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-46-generic
Found linux image: /boot/vmlinuz-5.4.0-125-generic
Found initrd image: /boot/initrd.img-5.4.0-125-generic
Found linux image: /boot/vmlinuz-5.4.0-121-generic
Found initrd image: /boot/initrd.img-5.4.0-121-generic
Found linux image: /boot/vmlinuz-5.4.0-113-generic
Found initrd image: /boot/initrd.img-5.4.0-113-generic
Found linux image: /boot/vmlinuz-5.4.0-110-generic
Found initrd image: /boot/initrd.img-5.4.0-110-generic
Found linux image: /boot/vmlinuz-5.4.0-105-generic
Found initrd image: /boot/initrd.img-5.4.0-105-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done
The link /vmlinuz is a damaged link
Removing symbolic link vmlinuz 
 you may need to re-run your boot loader[grub]
The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old 
 you may need to re-run your boot loader[grub]
The link /initrd.img is a damaged link
Removing symbolic link initrd.img 
 you may need to re-run your boot loader[grub]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old 
 you may need to re-run your boot loader[grub]
Removing cryptsetup-initramfs (2:2.4.3-1ubuntu1.1) ...
update-initramfs: deferring update (trigger activated)
Removing brltty-x11 (6.4-4ubuntu3) ...
Removing brltty (6.4-4ubuntu3) ...
Removing initramfs-tools (0.140ubuntu13) ...
Setting up linux-image-5.15.0-46-generic (5.15.0-46.49) ...
Setting up usrmerge (25ubuntu2) ...
Smartmatch is experimental at /usr/lib/usrmerge/convert-usrmerge line 172.

FATAL ERROR:
Both /lib/libASEP11.so and /usr/lib/libASEP11.so exist.

You can try correcting the errors reported and running again
/usr/lib/usrmerge/convert-usrmerge until it will complete without errors.
Do not install or update other Debian packages until the program
has been run successfully.

dpkg: error processing package usrmerge (--configure):
 installed usrmerge package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for linux-image-5.15.0-46-generic (5.15.0-46.49) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-46-generic
   ...done.
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-46-generic
Found linux image: /boot/vmlinuz-5.4.0-125-generic
Found initrd image: /boot/initrd.img-5.4.0-125-generic
Found linux image: /boot/vmlinuz-5.4.0-121-generic
Found initrd image: /boot/initrd.img-5.4.0-121-generic
Found linux image: /boot/vmlinuz-5.4.0-113-generic
Found initrd image: /boot/initrd.img-5.4.0-113-generic
Found linux image: /boot/vmlinuz-5.4.0-110-generic
Found initrd image: /boot/initrd.img-5.4.0-110-generic
Found linux image: /boot/vmlinuz-5.4.0-105-generic
Found initrd image: /boot/initrd.img-5.4.0-105-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done
Errors were encountered while processing:
 usrmerge
E: Sub-process /usr/bin/dpkg returned an error code (1)
# apt remove usrmerge
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  usrmerge
0 upgraded, 0 newly installed, 1 to remove and 10 not upgraded.
1 not fully installed or removed.
After this operation, 205 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 743948 files and directories currently installed.)
Removing usrmerge (25ubuntu2) ...

Then finally, apt -f install was not producing any errors:

root@local:~# apt -f install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

So I tried to reinstall usrmerge:

# apt install usrmerge 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  usrmerge
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 54.7 kB of archives.
After this operation, 205 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 usrmerge all 25ubuntu2 [54.7 kB]
Fetched 54.7 kB in 1s (66.4 kB/s) 
Selecting previously unselected package usrmerge.
(Reading database ... 743946 files and directories currently installed.)
Preparing to unpack .../usrmerge_25ubuntu2_all.deb ...
Unpacking usrmerge (25ubuntu2) ...
Setting up usrmerge (25ubuntu2) ...
Smartmatch is experimental at /usr/lib/usrmerge/convert-usrmerge line 172.

FATAL ERROR:
Both /lib/libASEP11.so and /usr/lib/libASEP11.so exist.

You can try correcting the errors reported and running again
/usr/lib/usrmerge/convert-usrmerge until it will complete without errors.
Do not install or update other Debian packages until the program
has been run successfully.

dpkg: error processing package usrmerge (--configure):
 installed usrmerge package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 usrmerge
E: Sub-process /usr/bin/dpkg returned an error code (1)

Executing /usr/lib/usrmerge/convert-usrmerge still kept giving the same error, so I moved the oldest of the two conflicting files to /tmp

root@local:~# ls -l /lib/libASEP11.so 
lrwxrwxrwx 1 root root 32 Apr 30  2021 /lib/libASEP11.so -> /usr/lib/x86-athena/libASEP11.so
root@local:~# ls -l /usr/lib/libASEP11.so
-rw-r--r-- 1 root root 6559107 Jan 28  2020 /usr/lib/libASEP11.so
root@local:~# ls /usr/lib/x86-athena/libASEP11.so -l
-rwxrwxrwx 1 root root 15145705 Sep  8  2019 /usr/lib/x86-athena/libASEP11.so
root@local:~# mv /lib/libASEP11.so /tmp/lib-libASEP11.so~

Then I was able to reinstall both of these packages:

root@local:~# apt install usrmerge 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
usrmerge is already the newest version (25ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up usrmerge (25ubuntu2) ...
root@local:~# apt install initramfs-tools
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  initramfs-tools
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
Need to get 9,036 B of archives.
After this operation, 151 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 initramfs-tools all 0.140ubuntu13 [9,036 B]
Fetched 9,036 B in 0s (25.2 kB/s)          
Selecting previously unselected package initramfs-tools.
(Reading database ... 743972 files and directories currently installed.)
Preparing to unpack .../initramfs-tools_0.140ubuntu13_all.deb ...
Unpacking initramfs-tools (0.140ubuntu13) ...
Setting up initramfs-tools (0.140ubuntu13) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-125-generic

However, when I booted into the 5.15.0-46 kernel, I got the message Kernel Panic - not syncing: VFS: Unable to mount root fs. I therefore booted to an older kernel and reinstalled it:

root@local:~# apt reinstall linux-image-5.15.0-46-generic linux-modules-extra-5.15.0-46-generic linux-headers-5.15.0-46-generic linux-modules-5.15.0-46-generic 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 4 reinstalled, 0 to remove and 6 not upgraded.
Need to get 101 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-headers-5.15.0-46-generic amd64 5.15.0-46.49 [2,836 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-image-5.15.0-46-generic amd64 5.15.0-46.49 [11.4 MB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-modules-5.15.0-46-generic amd64 5.15.0-46.49 [22.7 MB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 linux-modules-extra-5.15.0-46-generic amd64 5.15.0-46.49 [63.9 MB]
Fetched 101 MB in 8s (13.0 MB/s)                                                                                                                                                                                 
(Reading database ... 743984 files and directories currently installed.)
Preparing to unpack .../linux-headers-5.15.0-46-generic_5.15.0-46.49_amd64.deb ...
Unpacking linux-headers-5.15.0-46-generic (5.15.0-46.49) over (5.15.0-46.49) ...
Preparing to unpack .../linux-image-5.15.0-46-generic_5.15.0-46.49_amd64.deb ...
Unpacking linux-image-5.15.0-46-generic (5.15.0-46.49) over (5.15.0-46.49) ...
Preparing to unpack .../linux-modules-5.15.0-46-generic_5.15.0-46.49_amd64.deb ...
Unpacking linux-modules-5.15.0-46-generic (5.15.0-46.49) over (5.15.0-46.49) ...
Preparing to unpack .../linux-modules-extra-5.15.0-46-generic_5.15.0-46.49_amd64.deb ...
Unpacking linux-modules-extra-5.15.0-46-generic (5.15.0-46.49) over (5.15.0-46.49) ...
Setting up linux-headers-5.15.0-46-generic (5.15.0-46.49) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-46-generic
   ...done.
Setting up linux-image-5.15.0-46-generic (5.15.0-46.49) ...
Setting up linux-modules-5.15.0-46-generic (5.15.0-46.49) ...
Setting up linux-modules-extra-5.15.0-46-generic (5.15.0-46.49) ...
Processing triggers for linux-image-5.15.0-46-generic (5.15.0-46.49) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.15.0-46-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-46-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-46-generic
Found initrd image: /boot/initrd.img-5.15.0-46-generic
Found linux image: /boot/vmlinuz-5.4.0-125-generic
Found initrd image: /boot/initrd.img-5.4.0-125-generic
Found linux image: /boot/vmlinuz-5.4.0-121-generic
Found initrd image: /boot/initrd.img-5.4.0-121-generic
Found linux image: /boot/vmlinuz-5.4.0-113-generic
Found initrd image: /boot/initrd.img-5.4.0-113-generic
Found linux image: /boot/vmlinuz-5.4.0-110-generic
Found initrd image: /boot/initrd.img-5.4.0-110-generic
Found linux image: /boot/vmlinuz-5.4.0-105-generic
Found initrd image: /boot/initrd.img-5.4.0-105-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
done

Now everything appears to be working.

Answered By: Mike

Interesting. I noticed errors and the installation process told me that it was done but had encountered errors. So before rebooting, I decided to closely investigate.

I noticed that the new kernel could not be created and was thinking to run:

$ sudo update-initramfs -c -k 5.15.0-72-generic
update-initramfs: Generating /boot/initrd.img-4.15.0-211-generic
cp: failed to access '/var/tmp/mkinitramfs_JmyAEB//usr/sbin/reiserfsck': Too many levels of symbolic links
ln: failed to create symbolic link '/var/tmp/mkinitramfs_JmyAEB/sbin/reiserfsck': File exists
cp: failed to access '/var/tmp/mkinitramfs_JmyAEB//usr/sbin/reiserfsck': Too many levels of symbolic links
E: /usr/share/initramfs-tools/hooks/reiserfsprogs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.15.0-211-generic with 1.

but, as we can see, the same "too many symbolic links" errors happened. This is how I found this page. (You can find the exact version of the kernel, the 5.15.0-72-generic part, by using ls /boot.)

When trying to re-run the configuration, I had a similar error, except that my fatal error was about mtp-probe:

(Note: When the installation process stopped, it had a prompted saying that it was "done" but errors were encountered. I had to hit ENTER once to get out of apt-get so that the lock was released and I could run apt-get in another console).

$ sudo apt-get install -f
[...]
FATAL ERROR:
Both /lib/udev/mtp-probe and /usr/lib/udev/mtp-probe exist.
[...]

So like Mike I moved the oldest file to /tmp before trying again:

$ ls -l /lib/udev/mtp-probe  /usr/lib/udev/mtp-probe
-rwxr-xr-x 1 root root 14488 Mar 24  2022 /lib/udev/mtp-probe
-rwxr-xr-x 1 root root 31272 Feb 28  2020 /usr/lib/udev/mtp-probe
$ sudo mv /usr/lib/udev/mtp-probe /tmp

After removing that first file, another generated an error:

FATAL ERROR:
Both /lib/udev/rules.d/69-libmtp.rules and /usr/lib/udev/rules.d/69-libmtp.rules exist.

This time, the kernel was built after the next apt-get install -f. However, there were still errors in link with MPI.

[...]
Setting up openmpi-bin (4.1.2-2ubuntu1) ...
update-alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link same as main link /usr/bin/mpicc
dpkg: error processing package openmpi-bin (--configure):
[...]

So let’s do that one more time… only this time, looking at the files, they had nearly the same date

$ ls -l /var/lib/dpkg/alternatives/mpi /usr/bin/mpicc
lrwxrwxrwx 1 root root   23 May 18 00:03 /usr/bin/mpicc -> /etc/alternatives/mpicc
rw-r--r-- 1 root root 2041 May 18 00:03 /var/lib/dpkg/alternatives/mpi

$ ls -l /etc/alternatives/mpicc
lrwxrwxrwx 1 root root 22 May 18 00:03 /etc/alternatives/mpicc -> /usr/bin/mpicc.openmpi

$ ls -l /usr/bin/mpicc.openmpi
lrwxrwxrwx 1 root root 12 Mar  4  2022 /usr/bin/mpicc.openmpi -> opal_wrapper

$ ls -l /usr/bin/opal_wrapper
-rwxr-xr-x 1 root root 26944 Mar  4  2022 /usr/bin/opal_wrapper

That did not make much sense. So I looked at the contents of /var/lib/dpkg/alternatives/mpi and recognized a file I have had problems with before. I happened to have this page talking about it. We have to hide that alternative file like so:

$ sudo mv /var/lib/dpkg/alternatives/mpi /var/lib/dpkg/alternatives/mpi.hide

The next apt-get install -f finished without errors and I got a message saying the running kernel is wrong/unexpected (20.04 one…) and then it offered me to restart daemons. The usual. So I feel like that worked in the end.

Just in case, I ran apt-get one more time and a few packages were still not fully installed:

 sudo apt-get dist-upgrade

For now, though, I did not run the autoremove command. That way I can keep an old kernel, just in case, although I certainly hope it won’t be required ever again!

Time to reboot…

It rebooted! 🙂
Now to fixing Gnome as all of my extensions are incompatible…

Answered By: Alexis Wilke
Categories: Answers Tags: , , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.