Reinstall pacman (that I accidentally deleted...)

I accidentally removed pacman and dependancies. You are allowed to laugh at me. Especially since I got a warning and I just pressed y.

I ran a pacman -Rcns command with the command “pacman” written twice. So yea… pacman, as well as yay, and all their dependencies got removed. I was impressed to see that you can uninstall pacman with pacman xD

My question is… how do I get it back? How will pacman / package managers know pacman is “back” if I just copy the files from a live .iso?
Once I have pacman back, I will be able to reinstall the other removed packages.

Here’s the list of packages that got removed:

[2022-06-22T10:43:41+0600] [PACMAN] Running 'pacman -Rcns pacman *redacted_package1* *redacted_package2* *redacted_package3*'
[2022-06-22T10:43:44+0600] [ALPM] transaction started
[2022-06-22T10:43:45+0600] [ALPM] removed eos-update-notifier (1.17-1)
[2022-06-22T10:43:45+0600] [ALPM] removed yay (11.2.0-1)
[2022-06-22T10:43:45+0600] [ALPM] removed git (2.36.1-1)
[2022-06-22T10:43:45+0600] [ALPM] removed perl-mailtools (2.21-6)
[2022-06-22T10:43:45+0600] [ALPM] removed perl-error (0.17029-4)
[2022-06-22T10:43:45+0600] [ALPM] removed pacman-contrib (1.5.3-1)
[2022-06-22T10:43:45+0600] [ALPM] removed base (2-2)
[2022-06-22T10:43:45+0600] [ALPM] removed systemd-sysvcompat (251.2-1)
[2022-06-22T10:43:45+0600] [ALPM] removed licenses (20220125-1)
[2022-06-22T10:43:45+0600] [ALPM] removed iputils (20211215-1)
[2022-06-22T10:43:45+0600] [ALPM] removed *redacted_package1* (*-*-*)
[2022-06-22T10:43:45+0600] [ALPM] removed *redacted_package2* (*-*-*)
[2022-06-22T10:43:45+0600] [ALPM] removed *redacted_package3* (*-*-*)
[2022-06-22T10:43:45+0600] [ALPM] removed python-pythondialog (3.5.3-1)
[2022-06-22T10:43:45+0600] [ALPM] removed *redacted_package4* (*-*-*)
[2022-06-22T10:43:45+0600] [ALPM] removed python-systemd (234-11)
[2022-06-22T10:43:45+0600] [ALPM] removed *redacted_package5* (*-*-*)
[2022-06-22T10:43:45+0600] [ALPM] removed python-gnupg (0.4.9-1)
[2022-06-22T10:43:45+0600] [ALPM] removed python-dnspython (1:2.2.1-1)
[2022-06-22T10:43:45+0600] [ALPM] removed python-bcrypt (3.2.1-1)
[2022-06-22T10:43:45+0600] [ALPM] removed python-keyring (23.4.0-1)
[2022-06-22T10:43:45+0600] [ALPM] removed python-secretstorage (3.3.1-3)
[2022-06-22T10:43:45+0600] [ALPM] removed python-jeepney (0.7.1-3)
[2022-06-22T10:43:45+0600] [ALPM] removed python-entrypoints (0.4-2)
[2022-06-22T10:43:45+0600] [ALPM] removed python-jinja (1:3.1.2-1)
[2022-06-22T10:43:46+0600] [ALPM] removed pacman (6.0.1-5)
[2022-06-22T10:43:46+0600] [ALPM] removed pacman-mirrorlist (20220605-1)
[2022-06-22T10:43:46+0600] [ALPM] removed archlinux-keyring (20220424-1)
[2022-06-22T10:43:46+0600] [ALPM] transaction completed
[2022-06-22T10:43:46+0600] [ALPM] running '30-systemd-daemon-reload.hook'...
[2022-06-22T10:43:46+0600] [ALPM] running '30-systemd-update.hook'...
[2022-06-22T10:43:46+0600] [ALPM] running 'gtk-update-icon-cache.hook'...
[2022-06-22T10:43:46+0600] [ALPM] running 'update-desktop-database.hook'...

I would boot up the Live USB and try to fix things from there.

Let’s say your system partition is /dev/sdXN, open a terminal and run:

sudo mount /dev/sdXN /mnt

Replace X and N with their actual values.

If your are using BTRFS, you would need to mount the systems subvolumes instead starting from root subvolume.

Next:

sudo pacstrap /mnt base

and then other packages that got removed.

:eye: https://wiki.archlinux.org/title/Installation_guide#Installation

3 Likes

@pebcak You are a hero! That did the trick. I’ve got pacman back and yay is sort-of working again as well.

So I’m almost there!

The remaining issue is that I think the core repository is not yet ‘connected’ to pacman or yay. The command “yay” as well as eos’s own updater both give this error message:

 -> Missing AUR Packages:  endeavouros-keyring  endeavouros-mirrorlist  endeavouros-theming  eos-bash-shared  eos-hooks  eos-log-tool  eos-quickstart  eos-translations  eos-update-notifier  grub-tools  grub2-theme-endeavouros  kalarmcal  keyserver-rank  lib32-acl  lib32-attr  lib32-brotli  lib32-bzip2  lib32-curl  lib32-dbus  lib32-e2fsprogs  lib32-expat  lib32-faudio  lib32-fontconfig  lib32-freetype2  lib32-gettext  lib32-glib2  lib32-glu  lib32-harfbuzz  lib32-icu  lib32-keyutils  lib32-krb5  lib32-lcms2  lib32-libcap  lib32-libdrm  lib32-libelf  lib32-libffi  lib32-libgcrypt  lib32-libglvnd  lib32-libgpg-error  lib32-libice  lib32-libidn2  lib32-libjpeg-turbo  lib32-libldap  lib32-libnl  lib32-libpcap  lib32-libpciaccess  lib32-libpng  lib32-libpsl  lib32-libsm  lib32-libssh2  lib32-libtiff  lib32-libtirpc  lib32-libunistring  lib32-libunwind  lib32-libx11  lib32-libxau  lib32-libxcb  lib32-libxcrypt  lib32-libxcursor  lib32-libxdamage  lib32-libxdmcp  lib32-libxext  lib32-libxfixes  lib32-libxi  lib32-libxml2  lib32-libxrandr  lib32-libxrender  lib32-libxshmfence  lib32-libxxf86vm  lib32-llvm-libs  lib32-lm_sensors  lib32-mesa  lib32-ncurses  lib32-openssl  lib32-pam  lib32-pcre  lib32-readline  lib32-sdl2  lib32-systemd  lib32-util-linux  lib32-vulkan-icd-loader  lib32-wayland  lib32-xz  lib32-zlib  lib32-zstd  libopenaptx  reflector-simple  welcome  yad-eos

Pacman can’t find any of these packages. Yay can but only in the aur repository.

I don’t think yay looks in the core repository anymore. And the colour has gone from yay. I think there’s a last step that I have to take.

image

@pebcak thanks again for your help on getting me back on my feet! Hopefully there’s anyone who knows what final step to take. Any help is much appreciated!

1 Like

Missing AUR Packages is telling you that you’ve got those packages installed in your system but since the source of them is not specified in /etc/pacman.conf the package manager “thinks” they must have been installed from AUR (or could be other “foreign” sources as well) and not finding them in AUR.

This is most probably because your “old” /etc/pacman.conf which also contained reference to EndeavourOS repository is now being replaced by the “vanilla” Arch’s.

And also the multilib repo is not enabled.

Look into /etc/pacman.conf. Here are the lines for EnOS’ repo you need to have in there:

[endeavouros]
SigLevel = PackageRequired
Include = /etc/pacman.d/endeavouros-mirrorlist

Add them below other repositories.

Also un-comment the multilib repo to enable it.

Next run

sudo pacman -Syyu

to check. In case you get any errors or warnings post the whole output here.
I believe you would need to add EnOS PGP key to your pacman keys as well.

Also, please don’t post terminal output as screenshots. That makes it harder to read, impossible to quote, and inaccessible to search engines.

4 Likes

Thanks! I understand a lot better what’s going on now.

Noted regarding screenshot! Sorry.

After turning the repos (but not the testing ones) on I got to about half the amount of “orphanaged” (missing AUR) packages compared to first.

I then turned ALL testing repos on, that got the missing packages down to only two: kalarmcal and libopenaptx.
(They might actually not be supported anymore by a maintainer.)

Last question: which of these testing repos should I leave on, which are best turned off in /etc/pacman.conf in favour of stability?

$ yay
:: Synchronizing package databases...
 testing is up to date
 core is up to date
 extra is up to date
 community-testing is up to date
 community is up to date
 multilib-testing is up to date
 multilib is up to date
 endeavouros is up to date
:: Starting full system upgrade...
 there is nothing to do
:: Searching databases for updates...
:: Searching AUR for updates...
 -> android-completion: local (20211217.fcf3fef-1) is newer than AUR (20200829.f60d4f9-1)
 -> Missing AUR Packages:  kalarmcal  libopenaptx
 -> Missing AUR Debug Packages:  libkipi-debug
 -> Flagged Out Of Date AUR Packages:  libkipi  python-pyparted
 there is nothing to do

Once more, thanks for your help, @pebcak !

Why did you turn testing repos on? If you haven’t modified your repos before uninstalling pacman, there is no need to enable testing.

I actually wouldn’t have done that.
The testing repo, as its name suggests is for testing purposes.
You could have posted the output first so we would have the chance to look through it before switching repos.

Now if you have had some packages in your system for which there have been updated versions in the testing repo, you have updated these packages to the versions in the Testing repo.

If your system is running fine after a reboot, you could leave it at that.

I would also suggest to disable the testing repo. The “stable” repo will eventually catch up with the updated packages.

Regarding those libkipi packages, if I rember correctly, they were installed as dependencies to some package which no longer requires them. You can uninstall them.

A tip: use the command line tool pactree to check the dependencies and reverse dependencies of a package. For example:

pactree -r libkipi

It should output libkipi itself meaning no other packages are dependent on it. Then you can safely remove it.

Do the same for the other packages.

Look into those other packages from AUR:

libopenaptx

looks to be “orpahned” and

kalarmcal

is no longer in AUR but this one is

kalarmcal-git

At the end if/when you consider that your initial issue is resolved, pleas check the “solution” box under the actual post which pointed you to the solution. This will make the forum software to regard the topic as solved and other users with similar issue will find the solution more easily.

Edit: some reformulations

1 Like

Now that @pebcak has so brilliantly solved it, I just want to take a moment to welcome @thatent aboard the :enos: forum. I hope you enjoy your neverending journey.

Now we have a post on disaster recovery :sos: which is always a possibility :grin: I may in need of quite soon.

3 Likes

Yes, welcome @thatent :wave: and thank you for providing a learning point for everyone.

3 Likes

What in the world were you attempting to do and how did you accidentally end up with this?

What is *redacted package1-5? I’m not sure I recall seeing that before.

You wouldn’t by any chance be trying to install Endeavour to remove endeavour to have an “Arch” install were you?

2 Likes

It’s probably something the OP is embarrassed to let us know. No need to bring it up, since it is irrelevant for this issue. :wink:

1 Like

Yet another great reply with so much useful information! Thank you, thank you - you’ve definitely solved this issue for me.

I wanted to select two posts as solution, because they were both needed for me to solve my problem - but your first response is definitely the right way to start so I’ve selected that one as the solution.

I will turn off the testing repos and eventually the stable branches will catch up. At least for now the problem is 100% solved and I did not have to reinstall EnOS! Many thanks @pebcak .

2 Likes

@fbodymechanic

What in the world were you attempting to do and how did you accidentally end up with this?

I was only trying to remove a programme (that came in three parts) using pacman -Rcns. Piece of cake, one would think. It is and I’ve done it many, many times before.

This is what happened: I typed in pacman -Rcns, got distracted by my son who knocked over his drink, solved that and went back and typed pacman again and then the packages that I wanted to get rid of, so the command was
pacman -Rcns pacman *redacted_package1* *redacted_package2* *redacted_package3*

Pacman had ended up in the list with packages to be removed! It gave me a very clear warning though, I remember seeing it but -again distracted by my son- I just pressed Y. DUMB! I know!
(this is by no means my 2-year-old’s fault haha, I should just not have been so distracted! I have installed and removed packages with both pacman and yay for years)

Regarding the redacted packages, I live in a country where using these is not allowed, that’s all I really want to say about it.

@HMS_Endeavour @r0ckhopper
Last thing I wanted to say is THANKS everyone for the warm welcome, the incredibly helpful attitude and super useful responses. I’ve been reading on this forum for a while but never posted until today I think.

1 Like

I would suggest to either use

pacman -Rs
or 
pacman -Rns

Don’t understand why you would use the -Rc option here.

You are welcome!
I am glad that the issue was resolved and you got back your system in a working state.

Also, welcome to the community @thatent!
:enos_flag: :handshake:t5:

1 Like

No, everything after you pressed “Y” was intentional.

Thanks. Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har! Har, har, har! Har, har, har, har, har, har!

Phew!
:wink:

6 Likes

Don’t laugh this much, have some water, take rest, and then again start laughing !

1 Like

I won’t laugh but I just can’t refrain myself from dropping this:

4 Likes

The easiest way to fix “an uninstalled pacman” is probably to just download pacman-static, make it executable and run it, installing pacman again: https://wiki.archlinux.org/title/Pacman#Using_pacman-static

wget https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static
chmod +x pacman-static
sudo ./pacman-static -S pacman

no ISO/USB, chroot needed.

7 Likes

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