You are not logged in.
Pages: 1
Topic closed
So apparently it happend again. The last time it happened I just reinstall Arch Linux completely. But I do not want to do that again.
While trying to install something, in this case 'base-devel', it tried to reinstall pacman too. But it failed to find the pacman file somewhere in /var/cache/pacman/... and it stopped. Now the pacman command is gone and I have no idea how to get it back.
I tried to download pacman tar file and build it. But I am getting errors when I try to run 'make'. So I just give up and hope someone here can help me. Is there no easy way to restore pacman?
Offline
https://wiki.archlinux.org/index.php/Pa … ing_pacman
or
https://aur.archlinux.org/packages/pacman-static/
https://wiki.archlinux.org/index.php/Un … #eschwartz
or boot a live iso, mount your relevant partitions, then use pacman from the iso (with the -r flag) to install pacman to your system: there is no need to reinstall the whole system if just pacman is missing.
Last edited by Trilby (2018-10-14 15:28:49)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Did you happen to symlink the pacman cache dir? That's a bad idea and will lead to... well... your current situation.
Instead configure a different cache dir or use a bind mount.
Offline
I'm guessing that your /var/cache/pacman/pkg directory is a symlink to something else. This is wrong and should not be done, ever. The directory is owned by pacman packages, and you don't have permission to modify it and turn it into a file.
As a result, one pacman package uninstalled the old /var/cache symlink itself, and installed the directory entry from the package as a replacement -- thus causing the succeeding packages to disappear from pacman mid-transaction. Having pacman itself disappear in the resulting error is simply the worst-case scenario. This is a pacman bug tracked as https://bugs.archlinux.org/task/58804 since pacman should fatally abort with a "conflicting file" error rather than attempt to do anything at all
There's two solutions to moving your cachedir properly:
Use a bind mount to mount some other directory on top of /var/cache/ or /var/cache/pacman/pkg/ instead of using a symlink.
Leave /var/cache/pacman/pkg/ alone and use pacman.conf's CacheDir setting to use a different location for pacman specifically. (Does not apply to moving all general system caches.)
And as Trilby said, you can manually acquire the necessary pacman binary and use that -- or boot to the installation media, but rather than reinstalling, simply use pacman's --root option to reinstall pacman into /mnt/my_archlinux_install.
Last edited by eschwartz (2018-10-14 15:41:22)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Thanks for all the help. I just installed pacman via the installation media and I am not going to symlink the folder again. I will now just clear the cache now and then.
Offline
By clearing the cache I hope you are referring to proper use of `paccache`. If not, you should learn to use it.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Install pacman-contrib, put the stuff below into /etc/pacman.d/hooks/paccache.hook and forget the cache altogether.
[Trigger]
Operation = Remove
Operation = Install
Operation = Upgrade
Type = Package
Target = *
[Action]
Description = Keep the last two cached and the currently installed.
When = PostTransaction
Exec = /usr/bin/paccache -r
Last edited by -MacNuke- (2018-10-15 08:32:51)
Offline
The pacman-contrib package also provides a systemd-timer that runs paccache -r weekly if enabled.
systemctl enable paccache.timer
Offline
I managed to do the same to my system. Thanks for everyone’s help here!
(Side note: Symlinking directories that can grow to considerable size (I always remove all but the last three versions for each package, but the package cache directory still has almost 5 GB) seems to me to be a very common pattern, so if it really is so incredibly dangerous in this specific case, I really feel like there should be some kind of warning or detection, instead of just telling people it was a terrible idea afterwards. But thanks, everyone, for sharing the proper way to do this! I will probably stick to that in the future for other software, too, where possible – just in case.)
However, I unfortunately ran into further problems after following Pacman » Manually reinstalling pacman. While just downloading and unpacking the pacman package worked perfectly fine to give me back all the binaries, Pacman still isn’t able to properly re-install the package afterwards to get the package DB in sync. I get the following:
# pacman -U pacman-5.1.2-2-x86_64.pkg.tar.xz
loading packages...
warning: pacman-5.1.2-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/pacman-5.1.2-2/desc: No such file or directory
warning: could not fully load metadata for package pacman-5.1.2-2
error: failed to prepare transaction (invalid or corrupted package)
The “/var/lib/pacman/local/pacman-5.1.2-2/” directory exists, but is empty, on my system. Is there any way to reconstruct it? Pacman/Restore local database sounded promising, but ultimately just consists of adding more flags to the above call (as far as I can see), none of which really changed the output (except “--needed”, which prevented it from doing anything).
Should/can I just delete the “/var/lib/pacman/local/pacman-5.1.2-2/” directory to fool Pacman into completely reinstalling itself? Or is there some way to get the “desc” file back (and, apparently, also “files” and “mtree”, except if they’re not needed when re-installing)?
Booting from a live ISO and re-installing that way might of course also work, but since I have it basically working now, it seems riskier to do that than to try to just fix the remaining small problem (if that’s easily possible).
Thanks in advance!
Offline
Delete the '/var/lib/pacman/local/pacman-5.1.2-2/' directory and then add `--dbonly` to the reinstall command, e.g. `pacman -U --dbonly pacman-5.1.2-2-x86_64.pkg.tar.xz`. (Note: it is important to reinstall the database entry for the exact same version pacman previously thought it had). This will re-create db entry. `pacman -Qkk pacman` will then tell you whether there are any potentially damaged files.
If you need any further assistance with this problem, please open a new topic, and link back to this one if it is still relevant.
https://wiki.archlinux.org/index.php/Co … bumping%22
Closing.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1
Topic closed