петък, 7 юни 2024 г.

How to recover system after it crashes during update

Today was a crazy day. I wanted to update the system to see if the new ollama is available and in the middle of the update, I got kernel panic and everything froze. Upon restart, Manjaro 6.89 said kernel doesn't exist and Manjaro 6.77 was starting only in terminal with alt+f2 with no wifi. It was a disaster. 

First, I found that internet from the phone trough usb works, but that didn't help as it would download the packages and then complain about the wrong PGP signature.

Here's a list of the problems I had:

1) my konsole was giving me the errors in Bulgarian, which showed up like white squares making them unreadable. 

I fixed that by changing:

>localectl set-locale LANG=en_US.UTF-8

and then I commented >#bg_BG.UTF-8 UTF-8

in

sudo nano /etc/locale.gen

and now I have a line: LANG=en_US.UTF-8

in sudo nano /etc/locale.conf

2)  I tried installing the kernel without dependencies (as I was convinced that would solve the problem)

>pacman -Sdd linux68 

and that did something random (it installed the files but when I tried to launch it, it couldn't find my hard at all).

3) I did all kinds of attempts to solve the problem with the wrong PGP signature

>bash <(curl -s "https://notabug.org/megavolt/random-scripts/raw/master/fix-gpg-pacman.sh")

the line above was the recommended method, it did something but the problem remained. 

Also this code:

sudo pacman-mirrors -c Global 

sudo cp /etc/pacman.conf /etc/pacman.conf.backup

sudo sed --in-place --regexp-extended 's/^(SigLevel).+$/\1 = Never/g' /etc/pacman.conf

sudo pacman -Syyuu

was supposed to remove the PGP check at all. It might have worked because by then I realised the problem was that pacman was giving an error "package already exist". 

So I made a live usb, backed up the whole home partition (just in case), then I did:

sudo blkid

mount /dev/nvme0n1p6 /mnt

mount -t proc proc /mnt/proc; mount --rbind /sys /mnt/sys; mount --rbind /dev /mnt/dev

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu --overwrite "*"

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu --overwrite linux68 #not needed but just in case

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu  #also just in case

That surprisingly solved all the drama. And my whole day is gone. 

Finally when I restarted into my now working 6.67 linux, I did

>sudo mwid -i linux68

and it found both my Windows and my other kernels and now I had also grub. Yay.

Няма коментари:

Публикуване на коментар