You are not logged in.

#1 2021-02-20 15:04:37

Pacopag
Member
Registered: 2011-05-29
Posts: 287

[SOLVED] Reinstall all packages forcefully

My system has been freezing randomly lately, unless I boot into the lts kernel (fine).  But I guess my son booted me into the default kernel, and my system froze right in the middle of a full upgrade (pacman -Syu) while installing the linux-headers package.  I had to do a forced poweroff, and my system was unbootable. 

I arch-chrooted using the installation medium, and managed to re-iinstall the kernel, and can now boot.  NetworkManager was buggered, but I got conneccted using wired connection with dhcpcd.

Now to the point.  Trying to reinstall networkmanager (as well as pretty much anything I try with pacman) I get all kinds of pacman errors like

e.g.
networkmanager: /usr/share/locale/sk/LC_MESSAGES/NetworkManager.mo exists in filesystem

So I try
pacman -S --overwrite * -S package_name
(not sure about the glob pattern, but tried a bunch of different ones)

But I get
warning: 'somefileorother' is a file, did you mean -U/--upgrade instead of -S/--sync?
error: target not found: somefileorother

I'm wondering, is there a way to tell pacman to just forcefully reinstall absolutely everything? every installed package?  overwrite whatever is needed? regenerate configs, systemd service files etc.?

Last edited by Pacopag (2021-02-20 16:45:07)

Offline

#2 2021-02-20 15:16:15

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: [SOLVED] Reinstall all packages forcefully

the shell is expanding the *. Put it in single quotes.

You've also got -S twice for some reason?

Offline

#3 2021-02-20 15:25:02

Pacopag
Member
Registered: 2011-05-29
Posts: 287

Re: [SOLVED] Reinstall all packages forcefully

Awesome!  Thanks so much.  That worked for networkmanager (it repopulated the .service file).

But it spewed a bunch of lines like
e.g.
ldconfig: File /usr/lib/libIlmThread.so is empty, not checked.

but otherwise seemed to work.  But empty .so files sounds bad.  Is there a way to re-install all installed packages to regenerate shared libs and all other stuff needed that get's generated during the initial install?

Offline

#4 2021-02-20 15:30:01

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: [SOLVED] Reinstall all packages forcefully

Offline

#5 2021-02-20 15:41:03

Pacopag
Member
Registered: 2011-05-29
Posts: 287

Re: [SOLVED] Reinstall all packages forcefully

Almost.  Tried

pacman -Qqn | pacman -S -

But got
error: could not open file /var/lib/pacman/local/pacman-mirrorlist-20210214-1/desc: No such file or directory
warning: could not fully load metadata for package pacman-mirrorlist-20210214-1
error: failed to prepare transaction (invalid or corrupted package)

Then tried downloading https://archlinux.pkgs.org/rolling/arch … r.zst.html and installing with pacman -U, but I get the same thing.

Offline

#6 2021-02-20 15:43:06

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: [SOLVED] Reinstall all packages forcefully

touch that file

Offline

#7 2021-02-20 16:44:41

Pacopag
Member
Registered: 2011-05-29
Posts: 287

Re: [SOLVED] Reinstall all packages forcefully

You are the best.  It all seemed to work.  Have yet to make sure it survives a reboot, but all the output looks good.
If I can buy you a coffee/beer, please send me a link. 

To recap (note that some steps, e.g. the --overwrite '*' might come with caveats I don't know about):

1. Booted into arch live installation usb
2. Mounted my broken filesystem
    mount /dev/mysystempartition /mnt (and boot partition)
3. arch-chroot /mnt
4. pacman -S linux # (to recreate the vmlinuz and such... now I could actually boot the system)
5. touch var/lib/pacman/local/pacman-mirrorlist-20210214-1/desc
    touch var/lib/pacman/local/pacman-mirrorlist-20210214-1/files
6. pacman -Qqn | pacman --overwrite '*' -S -

Step 4.5, I had to pacman --overwrite '*' -S networkmanager because the /lib/systemd/system/NetworkManager.service file got emptied for some reason during my system crash.

Offline

Board footer

Powered by FluxBB