Issue with installing the latest linux image in lubuntu 20.04

Cannot boot normally, I need to use the previous linux image to boot via advanced options. the system returns this when I attempt to update it:

Running post-installation trigger dpkg-exec
Preparing installation of memtest86+
Unpacking memtest86+
Installing memtest86+
Configuring linux-image-5.4.0-47-generic
Error Resume:
Eror Code: error-package-manager-failed
Package operation failed
The installation or removal of a software package failed.
Error Detail: installArchives() failed: Preconfiguring packages ...
Preconfiguring packages ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 276712 files and directories currently installed.)
Preparing to unpack .../memtest86+_5.01-3.1ubuntu2.1_amd64.deb ...
Unpacking memtest86+ (5.01-3.1ubuntu2.1) over (5.01-3.1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/memtest86+_5.01-3.1ubuntu2.1_amd64.deb (--unpack):
 unable to make backup link of './boot/memtest86+.bin' before installing new version: Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/memtest86+_5.01-3.1ubuntu2.1_amd64.deb
Setting up linux-image-5.4.0-47-generic (5.4.0-47.51) ...
Failed to create symlink to vmlinuz-5.4.0-42-generic: Operation not permitted at /usr/bin/linux-update-symlinks line 64.
dpkg: error processing package linux-image-5.4.0-47-generic (--configure):
 installed linux-image-5.4.0-47-generic package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-5.4.0-47-generic; however:
  Package linux-image-5.4.0-47-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-modules-extra-5.4.0-47-generic:
 linux-modules-extra-5.4.0-47-generic depends on linux-image-5.4.0-47-generic | linux-image-unsigned-5.4.0-47-generic; however:
  Package linux-image-5.4.0-47-generic is not configured yet.
  Package linux-image-unsigned-5.4.0-47-generic is not installed.

dpkg: error processing package linux-modules-extra-5.4.0-47-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 5.4.0.47.50); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured

Package operation failed
The installation or removal of a software package failed.
Eror Code: error-package-manager-failed
Package operation failed
The installation or removal of a software package failed.
Error Detail: installArchives() failed: Preconfiguring packages ...
Preconfiguring packages ...
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 276712 files and directories currently installed.)
Preparing to unpack .../memtest86+_5.01-3.1ubuntu2.1_amd64.deb ...
Unpacking memtest86+ (5.01-3.1ubuntu2.1) over (5.01-3.1ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/memtest86+_5.01-3.1ubuntu2.1_amd64.deb (--unpack):
 unable to make backup link of './boot/memtest86+.bin' before installing new version: Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/memtest86+_5.01-3.1ubuntu2.1_amd64.deb
Setting up linux-image-5.4.0-47-generic (5.4.0-47.51) ...
Failed to create symlink to vmlinuz-5.4.0-42-generic: Operation not permitted at /usr/bin/linux-update-symlinks line 64.
dpkg: error processing package linux-image-5.4.0-47-generic (--configure):
 installed linux-image-5.4.0-47-generic package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-5.4.0-47-generic; however:
  Package linux-image-5.4.0-47-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-modules-extra-5.4.0-47-generic:
 linux-modules-extra-5.4.0-47-generic depends on linux-image-5.4.0-47-generic | linux-image-unsigned-5.4.0-47-generic; however:
  Package linux-image-5.4.0-47-generic is not configured yet.
  Package linux-image-unsigned-5.4.0-47-generic is not installed.

dpkg: error processing package linux-modules-extra-5.4.0-47-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 5.4.0.47.50); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured

Package operation failed
The installation or removal of a software package failed.

Solution 1:

I believe the key points are:

unable to make backup link of './boot/memtest86+.bin' before installing new version: Operation not permitted

and

Failed to create symlink to vmlinuz-5.4.0-42-generic: Operation not permitted at /usr/bin/linux-update-symlinks line 64

Your are likely effected by the following bug: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1318951

The error message "operation is not permitted" is misleading, if your /boot partition is of type vfat. Better would be "operation is not possible, because the filesystem does not support it" ;-). Run mount to check what your filesystem type your /boot partition is.

As a solution you can disable the use of symlinks. Edit the file /etc/kernel-img.conf (the file might not exist, in this case just create it) and set the following options:

do_symlinks = no
no_symlinks = yes

Solution 2:

For some (including myself), the workaround of editing /etc/kernel-img.conf is no longer working. Surprising enough, simply uninstalling and re-installing memtest worked since it was not trying to backup the existing files. This may need to be done each time it needs to be upgraded until they fix the bug.

# apt-get remove memtest86+
# apt-get install memtest86+