You are not logged in.

#1 2024-04-29 19:54:32

LinearView88
Member
Registered: 2021-03-28
Posts: 46

[SOLVED] Kernel panic during boot after crash during upgrade.

Hi,

I recently upgraded my packages with pacman -Syu. After the packages had been downloaded and while they was upgrading, the system crashed hard, to the point of audio stuttering and keyboard lights blinking. Attempting to reboot into my Linux kernel resulted in a kernel panic, and linux-lts got stuck and refused to load at all.

I was able to mount the system and my home partition from a live USB and arch-chroot into them, but I'm not really sure where to go from here. My best guess is that I should downgrade my system to where it was before I ran the last pacman -Syu, but I'm not quite sure how to do that. This is the first time I've dealt with a kernel panic like this. Would anyone be able to advise me as to what I can do to try to fix my system?

I read about an issue with Nvidia recently that could cause a panic like this, but that's just a shot in the dark. At this point I'm more interested in the proper steps to get my system up and running again.

Last edited by LinearView88 (2024-05-01 01:03:56)

Offline

#2 2024-04-29 21:44:31

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Boot the install iso, mount the root filesystem of the installed system into /mnt, if you have one, the boot partition into /mnt/boot
Do NOT chroot and run

LC_ALL=C pacman -Qkk --root /mnt | grep -v ', 0 altered files'

to gage how bad the situation is.

Every missing or broken "mtree" package will have to be re-installed w/

pacman -Sy --dbonly --root /mnt --cachedir /mnt/var/cache/pacman/pkg <list of broken packages>

first
Then again along all packages w/ suspicious file deviations (everything in /usr/lib and /usr/bin is bad, some deviations in esp. /etc are perfectly normal - your kernel *is* broken one way or another and needs to be re-installed)

pacman -Sy --root /mnt --cachedir /mnt/var/cache/pacman/pkg <list of broken packages> # this time w/o --dbonly

If the list of broken packages is *really* long, it's probably easier to just re-install all packages - nb. the "--root /mnt --cachedir /mnt/var/cache/pacman/pkg" and you'll still have to do this twice if (first with "--dbonly", second without) if you didn't selectively sanitize the database before.

Last edited by seth (2024-04-29 21:45:18)

Offline

#3 2024-04-29 23:54:35

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Thanks for the response.

seth wrote:

Boot the install iso, mount the root filesystem of the installed system into /mnt, if you have one, the boot partition into /mnt/boot
Do NOT chroot and run

LC_ALL=C pacman -Qkk --root /mnt | grep -v ', 0 altered files'

to gage how bad the situation is.

I tried this. I have such an enormous list of files with md5 hash mismatches that I think its probably going to be faster (and less fraught with errors) to reinstall all packages.

Seth wrote:

If the list of broken packages is *really* long, it's probably easier to just re-install all packages - nb. the "--root /mnt --cachedir /mnt/var/cache/pacman/pkg" and you'll still have to do this twice if (first with "--dbonly", second without) if you didn't selectively sanitize the database before.

I'm a bit confused by what you mean, especially by "-nb." Are you saying that I should run the command detailed in the arch wiki page? Where do I need to add what arguments? I tried looking at the pacman manual page and I'm still not sure exactly where to go.

Offline

#4 2024-04-30 07:17:47

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

https://en.wikipedia.org/wiki/Nota_bene
DON'T FORGET TO MOUNT THE BOOT PARTITION into /mnt/boot - provided you have one.

pacman --root /mnt -Sy # sync the database, just in case
pacman --root /mnt -Qnq | pacman --root /mnt --cachedir /mnt/var/cache/pacman/pkg -S --dbonly - # sanitize the metadata of all packages
pacman --root /mnt -Qnq | pacman --root /mnt --cachedir /mnt/var/cache/pacman/pkg -S  - # re-install all packages

Instead of --root and --cachedir you could also just use --sysroot or chroot into the installed system and use its pacman, but depending on how fucked up the installed system is, that may not be possible (eg. if pacman, glibc, libcurl or probbly libcurses are affected)

Offline

#5 2024-04-30 21:03:04

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

seth wrote:

https://en.wikipedia.org/wiki/Nota_bene
DON'T FORGET TO MOUNT THE BOOT PARTITION into /mnt/boot - provided you have one.

pacman --root /mnt -Sy # sync the database, just in case
pacman --root /mnt -Qnq | pacman --root /mnt --cachedir /mnt/var/cache/pacman/pkg -S --dbonly - # sanitize the metadata of all packages
pacman --root /mnt -Qnq | pacman --root /mnt --cachedir /mnt/var/cache/pacman/pkg -S  - # re-install all packages

Instead of --root and --cachedir you could also just use --sysroot or chroot into the installed system and use its pacman, but depending on how fucked up the installed system is, that may not be possible (eg. if pacman, glibc, libcurl or probbly libcurses are affected)

Gotcha. Unfortunately, attempting to sync the database results in an error: failed to synchronize all databases (unable to lock database)

Is it safe to remove this lock and continue, and if so should I?

Offline

#6 2024-04-30 21:10:48

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

stat /mnt/var/lib/pacman/db.lck

If there's no running pacman process and the timestamps are dated (from when the update crashed) it's ok to remove the file - you can't make things worse here wink

Offline

#7 2024-04-30 21:43:24

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

seth wrote:
stat /mnt/var/lib/pacman/db.lck

If there's no running pacman process and the timestamps are dated (from when the update crashed) it's ok to remove the file - you can't make things worse here wink

Nice! Genuinely comforting to know that I can't make things worse smile

Confirmed that there was no pacman process and the lock timestamps were dated to the original crash, then went ahead and deleted the lock and synced successfully. No problems there.

The second command yielded a no targets specified error. Confirmed that the command was typed correctly and that the cachedir was not empty.

Offline

#8 2024-04-30 21:45:08

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Does this output anything?

pacman --root /mnt -Qnq

Edit: If not, see https://wiki.archlinux.org/title/Pacman … l_database

Last edited by seth (2024-04-30 21:46:14)

Offline

#9 2024-04-30 21:50:22

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

seth wrote:

Does this output anything?

pacman --root /mnt -Qnq

Edit: If not, see https://wiki.archlinux.org/title/Pacman … l_database

Yep! Outputs native packages just like it should.

Offline

#10 2024-04-30 21:55:01

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Try to reverse this

… -S --dbonly -
… --dbonly -S  -

or use process substitution

pacman --root /mnt --cachedir /mnt/var/cache/pacman/pkg -S --dbonly $(pacman --root /mnt -Qnq)

Offline

#11 2024-04-30 22:10:15

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Making progress! The process substitution did the trick.

A number of the packages have signatures of unknown trust, leading pacman to indicate they are invalid or corrupted. If deleted, errors are said to have occurred and the upgrade does not proceed.

Offline

#12 2024-04-30 22:34:05

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Aare you operating from a rather dated install iso?

pacman-key --refresh-keys # no --root here

Then try to explcitly install archlinux-keyring first though you should™ live off the iso's pacman keyring… you're not chrooting into the system, are you?

Offline

#13 2024-04-30 22:38:46

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

seth wrote:

Aare you operating from a rather dated install iso?

pacman-key --refresh-keys # no --root here

Then try to explcitly install archlinux-keyring first though you should™ live off the iso's pacman keyring… you're not chrooting into the system, are you?

I am operating from a very dated install iso. No worries, not chrooting in.

Rather than doing it the way I shouldn't, I'll take the opportunity to install a newer iso, then report back.

Offline

#14 2024-05-01 01:03:04

LinearView88
Member
Registered: 2021-03-28
Posts: 46

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

That did the trick! Many, many thanks.

I'll be marking this topic as solved. Still have no idea what caused the initial crash, sadly, but I'm just happy to have a useable system again.

Offline

#15 2024-05-01 06:27:08

seth
Member
Registered: 2012-09-03
Posts: 52,238

Re: [SOLVED] Kernel panic during boot after crash during upgrade.

Offline

Board footer

Powered by FluxBB