1

I ran the following commands in the order 2 days ago:

  1. sudo apt update && sudo apt upgrade -y
  2. sudo apt autoremove
  3. sudo apt update && sudo apt upgrade -y

now apt package manager is not letting me install any package. I am unable to update the grub either. The computer is able to restart itself as usual.

sudo apt --fix-broken install returns the same errors attaching output anyway:

unmesh@unmeshpc:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-5.4.0-91-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 11.8 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 582323 files and directories currently installed.)
Removing linux-image-5.4.0-91-generic (5.4.0-91.102) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-91-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 14: /etc/default/grub: GRUB_CMDLINE_LIN: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.4.0-91-generic (--remove):
 installed linux-image-5.4.0-91-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.4.0-91-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

unmesh@unmeshpc:~$ sudo apt update [sudo] password for unmesh: Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://ppa.launchpad.net/gezakovacs/ppa/ubuntu focal InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu focal InRelease
Hit:7 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:8 http://ppa.launchpad.net/tsbarnes/indicator-keylock/ubuntu focal InRelease
Get:9 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:10 http://packages.ros.org/ros/ubuntu focal InRelease
Hit:4 https://packagecloud.io/ookla/speedtest-cli/ubuntu focal InRelease
Fetched 114 kB in 8s (14.8 kB/s)
Reading package lists... Done Building dependency tree
Reading state information... Done All packages are up to date.

I am attaching the bash output after running the upgrade command for easier debugging:

unmesh@unmeshpc:~$ sudo apt upgrade -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/8,992 kB of archives.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-5.11.0-38-generic (5.11.0-38.42~20.04.1) ...
depmod: WARNING: could not open modules.order at /lib/modules/5.11.0-38-generic:
 No such file or directory
depmod: WARNING: could not open modules.builtin at /lib/modules/5.11.0-38-generi
c: No such file or directory
Setting up linux-image-5.11.0-41-generic (5.11.0-41.45~20.04.1) ...
Processing triggers for linux-image-5.11.0-38-generic (5.11.0-38.42~20.04.1) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.11.0-38-generic
Error! Your kernel headers for kernel 5.11.0-38-generic cannot be found.
Please install the linux-headers-5.11.0-38-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
Error! Your kernel headers for kernel 5.11.0-38-generic cannot be found.
Please install the linux-headers-5.11.0-38-generic package,
or use the --kernelsourcedir option to tell DKMS where it's located
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.11.0-38-generic
cat: /var/tmp/mkinitramfs_f3YBdS/lib/modules/5.11.0-38-generic/modules.builtin: 
No such file or directory
depmod: WARNING: could not open modules.order at /var/tmp/mkinitramfs_f3YBdS/lib
/modules/5.11.0-38-generic: No such file or directory
depmod: WARNING: could not open modules.builtin at /var/tmp/mkinitramfs_f3YBdS/l
ib/modules/5.11.0-38-generic: No such file or directory
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 14: /etc/default/grub: GRUB_CMDLINE_LIN: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.11.0-38-generic (--configure):
 installed linux-image-5.11.0-38-generic package post-installation script subpro
cess returned error exit status 1
Processing triggers for linux-image-5.11.0-41-generic (5.11.0-41.45~20.04.1) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.11.0-41-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.11.0-41-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 14: /etc/default/grub: GRUB_CMDLINE_LIN: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.11.0-41-generic (--configure):
 installed linux-image-5.11.0-41-generic package post-installation script subpro
cess returned error exit status 1
Errors were encountered while processing:
 linux-image-5.11.0-38-generic
 linux-image-5.11.0-41-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

The update-grub output gives the following output:

unmesh@unmeshpc:~$ sudo update-grub
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 14: /etc/default/grub: GRUB_CMDLINE_LIN: not found

Neofetch output as follows:

$ neofetch
            .-/+oossssoo+/-.               unmesh@unmeshpc 
        `:+ssssssssssssssssss+:`           --------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.3 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: HP Pavilion Gaming Laptop 15-ec1xxx 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.11.0-41-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 day, 10 hours, 58 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3763 (dpkg), 22 (snap) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1920x1080 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: GNOME 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Yaru-dark 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: adwaita-dark-amoled-master [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Yaru [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: tilix 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: AMD Ryzen 5 4600H with Radeon Graphics (12) @ 3.000GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: NVIDIA 01:00.0 NVIDIA Corporation Device 1f99 
      -+sssssssssssssssssyyyssss+-         GPU: AMD ATI 05:00.0 Renoir 
        `:+ssssssssssssssssss+:`           Memory: 2625MiB / 7309MiB 
            .-/+oossssoo+/-.

I am running the following kernel:

uname -r
5.11.0-41-generic

What can I do to fix these issues?

Thank You

Regards, Unmesh

0 Answers0