[arch-general] oops, 'sudo: pacman: command not found'
hi. a month ago i ran out of room on my root file system, so relocated /var/cache/pacman to /home, and left behind a symlink. today, after a while, i did a 'pacman -Syu', which downloaded lots, and ran through a lot new keys, upgrading, etc., then failed (see below), and (the symbolic link at) /var/cache/pacman seems to have disappeared. any suggestions on how i might recover? (and, should i, possibly, rather than using a symlink, have modified, e.g., /etc/pacman.conf?) i have all the files still in /home/pacman/pkg, etc. (and have put back the symlink). cheers, and thanks in advance, Greg ---- (210/487) upgrading pacman-mirrorlist [#########... truncated ... #################] 100% warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew error: could not open file /var/cache/pacman/pkg/pacman-5.2.1-6-x86_64.pkg.tar.zst: No such file or directory error: could not commit transaction error: failed to commit transaction (transaction aborted) Errors occurred, no packages were upgraded. bash apollo2 (master): {1185} sudo pacman -Syu [sudo] password for minshall: sudo: pacman: command not found bash apollo2 (master): {1186} ls /var/cache/ atop.d/ fontconfig/ ldconfig/ lightdm/ man/ pkgfile/ private/
i should mention that i seem to have the correct pacman "distribution" file: ---- bash apollo2 (master): {1198} ls -l /var/cache/pacman/pkg/pacman-5.2.1-* -rw-r--r-- 1 root root 856820 Apr 30 03:23 /var/cache/pacman/pkg/pacman-5.2.1-5-x86_64.pkg.tar.zst -rw-r--r-- 1 root root 857872 May 23 03:04 /var/cache/pacman/pkg/pacman-5.2.1-6-x86_64.pkg.tar.zst ---- (going through my symlink). if that helps me patch back up my system? cheers, Greg
On Sun, 7 Jun 2020, 21:13 Greg Minshall, <minshall@acm.org> wrote:
i should mention that i seem to have the correct pacman "distribution" file: ---- bash apollo2 (master): {1198} ls -l /var/cache/pacman/pkg/pacman-5.2.1-* -rw-r--r-- 1 root root 856820 Apr 30 03:23 /var/cache/pacman/pkg/pacman-5.2.1-5-x86_64.pkg.tar.zst -rw-r--r-- 1 root root 857872 May 23 03:04 /var/cache/pacman/pkg/pacman-5.2.1-6-x86_64.pkg.tar.zst ---- (going through my symlink). if that helps me patch back up my system?
cheers, Greg
In terms of getting pacman, you might want to grab a precompiled pacman-static from Eli Schwartz: https://aur.archlinux.org/packages/pacman-static/#pinned-666894 -Chris
On Sun, 07 Jun 2020 18:09:12 -0700 Greg Minshall <minshall@acm.org> wrote:
hi. a month ago i ran out of room on my root file system, so relocated /var/cache/pacman to /home, and left behind a symlink.
today, after a while, i did a 'pacman -Syu', which downloaded lots, and ran through a lot new keys, upgrading, etc., then failed (see below), and (the symbolic link at) /var/cache/pacman seems to have disappeared.
any suggestions on how i might recover? (and, should i, possibly, rather than using a symlink, have modified, e.g., /etc/pacman.conf?)
i have all the files still in /home/pacman/pkg, etc. (and have put back the symlink).
cheers, and thanks in advance, Greg ---- (210/487) upgrading pacman-mirrorlist [#########... truncated ... #################] 100% warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew error: could not open file /var/cache/pacman/pkg/pacman-5.2.1-6-x86_64.pkg.tar.zst: No such file or directory error: could not commit transaction error: failed to commit transaction (transaction aborted) Errors occurred, no packages were upgraded. bash apollo2 (master): {1185} sudo pacman -Syu [sudo] password for minshall: sudo: pacman: command not found bash apollo2 (master): {1186} ls /var/cache/ atop.d/ fontconfig/ ldconfig/ lightdm/ man/ pkgfile/ private/
Use pacman-static or an install disk (pacman --root) to finish the update and reinstall pacman. In the future, bind mounts.
On 6/7/20 9:09 PM, Greg Minshall wrote:
hi. a month ago i ran out of room on my root file system, so relocated /var/cache/pacman to /home, and left behind a symlink.
today, after a while, i did a 'pacman -Syu', which downloaded lots, and ran through a lot new keys, upgrading, etc., then failed (see below), and (the symbolic link at) /var/cache/pacman seems to have disappeared.
any suggestions on how i might recover? (and, should i, possibly, rather than using a symlink, have modified, e.g., /etc/pacman.conf?)
Your post-disaster analysis is correct. You should have modified pacman.conf. You're the most recent person to discover https://bugs.archlinux.org/task/50298 https://bugs.archlinux.org/task/58804 (To be clear, pacman "should" learn to fatally abort with "error: you're not allowed to replace a packaged directory with a symlink", and refuse to let you pacman -Syu until you put things back where they belong. Instead, it gets mid transaction, then as part of uninstalling the old version of pacman it tries to delete /var/cache/pacman/pkg and *doesn't* skip it since it is not a directory. Boom. Your symlink is uninstalled, along with the old version of /usr/bin/pacman and everything else, and then it cannot find the new package anymore to get the replacements.)
i have all the files still in /home/pacman/pkg, etc. (and have put back the symlink).
In that case, reinstalling pacman is an adequate recovery method, though as the disaster manifested by wiping pacman from your system, you'll need to extract the *.pkg.tar.zst using bsdtar, or use the static recovery binaries listed here: https://www.archlinux.org/news/now-using-zstandard-instead-of-xz-for-package... (Or use the installation media.) -- Eli Schwartz Bug Wrangler and Trusted User
hi. a month ago i ran out of room on my root file system, so relocated /var/cache/pacman to /home, and left behind a symlink. (…) “/var/cache/pacman” is owned by pacman and is supposed to be a directory. If you have removed the directory and create a symlink instead, the next update has simply overwritten it with proper contents. Since it has been overwritten, it’s now an empty directory that contains nothing and pacman can’t find “pacman-5.2.1.6-x86_64.pkg.tar.zst” there. It seems that in the process you have deleted “/usr/bin/pacman” and, because pacman can’t install things from non-existend archive, you are also missing pacman now. Reinstall pacman using Arch ISO.
As for moving the cache, it should be done using `CacheDir` in the config, not through symlink. However, moving it to “/home” seems fishy. Where exactly is it in “/home”? If your private home directory, you are opening yourself to attacks. The cache should be in a location accessible only to the root (or another user has sufficient privileges to run `pacman` without further authentication).
thanks, all! i believe i'll now be able to recover. now i've set up to use CacheDir. (/home is a separate partition on my hard drive; /home/minshall is where i live, but, having initially configured with a too-small root, and being nervous/lazy to "resize in place", /home now also is "home" to first docker, now pacman; not ideal.)
participants (5)
-
Chris Billington
-
Doug Newgard
-
Eli Schwartz
-
Greg Minshall
-
mpan