0

My laptop goes directly into kernel panic at first startup every time I try to start it. Long pressing the power button to shut it down and starting it up again, takes me to the grub menu where I have to select the second latest installed kernel, as the latest one seems broken.

OS Version: Ubuntu 20.04.5 LTS (Focal Fossa)
Kernel Version (Broken): linux-generic 5.15.0-46
Kernel Version (Working): linux-generic 5.15.0-41

I tried following this "tutorial" but with no success. The file "initrd.img-5.15.0-46" didn't exist in my boot directory and the command sudo apt install --reinstall linux-generic failed with the following output and I didn't proceed further:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 0 not to upgrade.
8 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
E: Internal Error, No file name for linux-generic:amd64

When trying to update my system or execute sudo apt install linux-generic the update/command fails as well with this output

I have some Linux knowledge, but I never did anything regarding kernels/boot apart from dual-boot setups, so I'm a complete noob regarding kernel problems and fixing them. Does anyone of you have some tips or a solution for my issue?

Edit: As also written in an answer to this comment, the issue seems to be this line in the output in particular:

installed linux-firmware package post-installation script subprocess returned error exit status 1

Which then causes the following processes to fail as well. How can I fix this?

Fix: I think I found a solution on this page. I removed the files of all packages which post install scripts fail. After executing sudo apt update and sudo apt upgrade a last time, the errors disappeared.

sgart
  • 11

2 Answers2

1

I think I found a solution on this page. I removed the files in /var/lib/dpkg/info of all packages which post install scripts failed. After executing sudo apt update and sudo apt upgrade a last time, the errors disappeared.

sgart
  • 11
0

It seems you're trying to install the latest HWE kernel in a "hacky" way, instead of just installing it with the normal package. It also seems you somehow ended in a situation with partially installed packages.

The normal way of installing the HWE kernel line on Ubuntu 20.04 would be this:

sudo apt install linux-image-generic-hwe-20.04

This should install the kernel 5.15.0-46-generic on your 20.04 without any hassle.

If you have problems, you can try different steps as indicated here.

1. Reconfigure package database:
sudo dpkg --configure -a
2. Reinstall or force install: (in this case linux-image-generic-hwe-20.04)
sudo apt install --reinstall linux-image-generic-hwe-20.04

or

sudo apt install -f linux-image-generic-hwe-20.04
3. Remove troublesome packages: (in this case linux-firmware)
sudo apt remove linux-firmware
4. Remove files of troublesome packages: (in this case linux-firmware)
sudo apt mv /var/lib/dpkg/info/linux-firmware* /tmp 

There are also endless threads here about fixing broken packages - try and take a look at them first.

Artur Meinild
  • 26,018
  • The sudo dpkg --configure -a command fails with this output. As it seems, it fails because of this: installed linux-firmware package post-installation script subprocess returned error exit status 1. How can I fix that? – sgart Sep 02 '22 at 13:08
  • Did you try sudo apt install --reinstall linux-firmware? Be aware that fixing dependency problems can be a bit of trial-and-error.. – Artur Meinild Sep 02 '22 at 13:14
  • The command fails with the following output: i don't know how to format code properly in here. So here's the pastebin: https://pastebin.com/WAZjhn3S – sgart Sep 02 '22 at 13:15
  • I think I fixed it. See the bottom of the original question for more info – sgart Sep 02 '22 at 13:42
  • I've included those solutions to my post. – Artur Meinild Sep 02 '22 at 14:16