Mistakenly removed many/all packages

I wanted to remove orphans but instead of pacman I mistakenly typed yay

yay -Qdtq | yay -Rns -

Now most of the packages got removed.
Is it possible to get them back? If not I’m willing to reinstall few of them like filemanager, browser for now. But it says

config file /etc/pacman.d/endeavouros-mirrorlist could not be read: No such file or directory

It’s all my fault. Is it possible to fix this issue?

Edit: After the reboot it stuck on tty screen

If it were me, at this stage I would boot to the Live ISO, use that to access my data and back that up. Then, proceed with a re-install.

For future reference, to simply remove orphans, you can run:

yay -Yc

Command breakdown:

yay {-Y --yay} [options] [package(s)]
-c --clean Remove unneeded dependencies

3 Likes

You can’t do nothing about this now but for FUTURE reference yay -Qdtq | yay -Rns - is too extreme.
A wise man here at the Forum taught me this:
yay -Qdtq (let the list populate).
then yay -R packagename1 packagename2 or yay -RN package1 package2 it does not matter. manually remove them.

DO NOT go full -Rns.

The shi**y thing is when you remove the Qtdq package list more will show up after you delete the first 10 or more… It’s probably deps and indirects and debris.

Anyways it may take 10-15 minutes, the Endeavour swami taught me, but it’s gentle and nothing gets borked.

in my usage case Swami has not steered me wrong I don’t break stuff while housekeeping.

2 cents edit–spelling

3 Likes

Uncle Ben giving Peter Parker some sage advice about Linux root level access :sweat_smile:

spiderman-uncle-ben

Don’t feel bad @shuvashish76, even Peter Parker got it wrong a few times.

I once accidentally did something similar, trashing my /usr/bin folder, with a mis-typed command. Without making a move, I quickly grabbed a copy of the same folder off another EndeavourOS system and jammed it in there. It was messy… it produced some conflicts and stray file errors for a bit, but was a successful fix for the most part.

4 Likes

Can’t I fix that endeavouros mirroslist error then install KDE plasma desktop environment from Live ISO?
Backup-files and re-install is the only option?

I think it’s a matter of understanding what was done.

From the live environment, you might access the log files for pacman. I don’t believe there is one for yay, but hopefully the actions are recorded in the pacman log.

It’ll be under (adjust this with respect to where you mount your normal Endeavour partition):

somemountpoint/var/log/pacman.log

If you can figure out precisely what was removed… well maybe via arch-chroot you could reinstall those?

Sometimes* I feel like I should move back to linux-mint though I understand it can happen to any distro. It’s purely my fault though.
Maybe NixOS or Btrfs has better safty for such situations‽

Whether you think Mint is a better fit for you is your call. But I would offer that everyone makes mistakes from time to time, and this is one you’re unlikely to make again :wink:

1 Like

Yes I can see the log, too many packages were removed :frowning:

Still shows that endeavouros-mirrorlist error. How to fix that 1st?

How do I move/copy files from my original system to Live ISO desktop so that I can move them to my phone or USB device?

Save this file into that location:
https://raw.githubusercontent.com/endeavouros-team/PKGBUILDS/master/endeavouros-mirrorlist/endeavouros-mirrorlist

Or, in konsole, navigate to that location and run this to pull it in (sudo if necesarry):

wget https://raw.githubusercontent.com/endeavouros-team/PKGBUILDS/master/endeavouros-mirrorlist/endeavouros-mirrorlist

You can mount your original system, from within the Live ISO. It’s hopefully listed there in Dolphin (file manager) and you can click on it and explore.

Then it’s a matter of copying and pasting your /home/someusername folder to your backup.

1 Like

For paru, do you happen to know what the command is?

According to the man page, it looks like it’s simply:

paru -c

…dare I say, give it a go? :sweat_smile:

It works. Thanks.

1 Like

Thanks that solved my issue :slight_smile:
Back to system and installed few of the applications that I remember/use daily. From the log, I can see the which packages were removed previously but it’s too long.

the logs shown are like this

[2024-10-31T10:22:17+0530] [ALPM] transaction started
[2024-10-31T10:22:17+0530] [ALPM] removed xsane (0.999-7)
[2024-10-31T10:22:17+0530] [ALPM] removed sane (1.3.1-1)
[2024-10-31T10:22:17+0530] [ALPM] removed libieee1284 (0.2.11-16)
[2024-10-31T10:22:18+0530] [ALPM] removed libgphoto2 (2.5.31-3)
[2024-10-31T10:22:18+0530] [ALPM] removed xorg-xkill (1.0.6-2)
[2024-10-31T10:22:18+0530] [ALPM] removed xorg-xinput (1.6.4-2)
[2024-10-31T10:22:18+0530] [ALPM] removed xorg-xrandr (1.5.2-2)
[2024-10-31T10:22:18+0530] [ALPM] removed xorg-xinit (1.4.2-2)
[2024-10-31T10:22:18+0530] [ALPM] removed xorg-xmodmap (1.0.11-2)

Is it possible to search “removed” keyword from the lines and add only package names in paragraph with space between the words something like this :point_down: I think it’s possible with grep command, never tried it myself.

xsane sane libieee1284 libgphoto2 xorg-xkill xorg-xinput xorg-xrandr xorg-xinit xorg-xmodmap

So that I can install all those pacman packages. AUR packages are also in the list but not a problem I can install them manually from my memory.

I’m not sure you’re quite out of the woods yet. I want to note that what’s not necessarily clear from this list, is which packages are, and aren’t dependencies.

For example, if you look at libreoffice-fresh’s list of dependencies, it’s exhaustive. If installing libreoffice, you don’t need to explicitly install those, it will automatically install those as dependencies. If you uninstall libreoffice and those dependencies aren’t used by anything else, they can be cleanly removed quite easily (yay -Yc), because they are registered as dependencies.

Manually installing packages that are dependencies, but not specifying them as such (yay -S somepackage --asdeps) will lead to a lot of junk hanging around later on, and likely package conflicts.

1 Like

Thanks I’ll install few more daily used packages then.
And later-on backup files then re-install EOS.

5 Likes

Next time install OS with LUKS encrypted BTRFS, GRUB, Timeshift and grub-btrfs. Enable them.

This allow to open snapshot of previous hours and can delete the last changes; to do a rollback of a system.

1 Like

Any recommended guide for this from EOS side?

When installing EndeavourOS you can choose to use GRUB instead of sytemd-boot. When selecting partitions, you can choose whole disk and select BTRFS and there are checkbox for encrypting the drive.

After booting into new system update packages and install Timeshift and grub-btrfs. Open Timeshift and go to settings and enable automatic snapshots on when you want it. Also enable grub-btrfs. Also it’s possible to add hook so Timeshift snapshots are made automatically before updating packages and after that.

Configure GRUB to not show up, unless you hold SHIFT while booting. Then you will be able to boot into specific snapshot.

I’m currently on the phone. You will have to duckduckgo further on that.

1 Like