Sed and sudo: command not found after failed pamac update

Hi there,

I recently tried to update my qt5-styleplugins through pamac because some app failed moaning about the mismatching dependency. Usually that works fine but this time pamac somehow got stuck for a long time before I killed it using ctrl+c.

Now my system is in a weird state (it does still boot at least):

sudo pacman -S archlinux-keyring
-bash: sed: command not found
-bash: sudo: Kommando nicht gefunden.

When I use “su” to get a root shell, it does miss pacman too which is not nice for possibly installing stuff back:

pacman -S sed sudo
bash: pacman: Kommando nicht gefunden.

also pamac is not happy anymore:

pamac -S sed sudo
pamac: error while loading shared libraries: libalpm.so.13: cannot open shared object file: No such file or directory

More info:

which sed sudo pacman pamac
which: no sed in (/home/johannes/.local/bin:/home/johannes/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/usr/lib/jvm/default/bin:/home/johannes/dev/flutter/bin:/run/storage/encrypted/data/code/go/bin:/home/johannes/bin:/home/johannes/.local/share/gem/ruby/3.0.0/bin:/home/johannes/.cargo/bin:/var/lib/snapd/snap/bin:/home/johannes/dev/flutter/bin:/run/storage/encrypted/data/code/go/bin:/run/storage/encrypted/data/code/go/bin:/home/johannes/.local/share/gem/ruby/3.0.0/bin:/home/johannes/.cargo/bin:/var/lib/snapd/snap/bin)
which: no sudo in (/home/johannes/.local/bin:/home/johannes/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/usr/lib/jvm/default/bin:/home/johannes/dev/flutter/bin:/run/storage/encrypted/data/code/go/bin:/home/johannes/bin:/home/johannes/.local/share/gem/ruby/3.0.0/bin:/home/johannes/.cargo/bin:/var/lib/snapd/snap/bin:/home/johannes/dev/flutter/bin:/run/storage/encrypted/data/code/go/bin:/run/storage/encrypted/data/code/go/bin:/home/johannes/.local/share/gem/ruby/3.0.0/bin:/home/johannes/.cargo/bin:/var/lib/snapd/snap/bin)
which: no pacman in (/home/johannes/.local/bin:/home/johannes/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/usr/lib/jvm/default/bin:/home/johannes/dev/flutter/bin:/run/storage/encrypted/data/code/go/bin:/home/johannes/bin:/home/johannes/.local/share/gem/ruby/3.0.0/bin:/home/johannes/.cargo/bin:/var/lib/snapd/snap/bin:/home/johannes/dev/flutter/bin:/run/storage/encrypted/data/code/go/bin:/run/storage/encrypted/data/code/go/bin:/home/johannes/.local/share/gem/ruby/3.0.0/bin:/home/johannes/.cargo/bin:/var/lib/snapd/snap/bin)
/usr/bin/pamac

I can boot the system, I can successfully run firefox, watch YouTube and so on. Party broken describes it best I guess.

Any ideas what I can do to fix my issues?

Thanks for your help!
Joh

  1. Boot a live session.
  2. Mount the root device.
  3. use basestrap to install the essential needed packages
  4. chroot into that root device
  5. do a normal upgrade
1 Like

Thank you for the idea, megavolt!

I tried that but failed to mount the btrfs subvolume correctly so that basestrap was not happy with the directory’s state and did refuse to apply anything.

My problem was that pamac renamed a lot of files and binaries like /usr/bin/sed to /usr/bin/sed.old.

My solution was this:

  • boot from a live usb
  • unlock and mount the root partition of the broken system (using gnome-disks)
  • install perl-rename: sudo pacman -S perl-rename
  • open a terminal and execute this command to rename all *.old files back to their original names:
sudo find /run/media/mounted-broken-disk/@ -name '*.old' -exec perl-rename -v 's/\.old$//'  {} \;

Be patient, it took a while for me since there were a lot of files pamac had renamed while updating things.

Then reboot and rejoice hopefully.

The @ is because of btrfs subvolumes, it can be omitted if you use a different filesystem type.

Good luck!
Joh

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.