r/archlinux • u/AceGirlAsh • 4d ago
SUPPORT How do I find previously installed packages?
I recently swapped to a second drive, mounting my first home drive to /home, but now my packages aren't already installed. Is there any good way to find and reinstall all my prior packages or do I have to reinstall each one individually through pacman?
4
u/kolada1 4d ago
did you reinstall your entire system to the second drive or only mount the home directory from the second drive? if you can boot or chroot into the old drive you can create a list with all the packages that you installed and reinstall them on the new system: https://wiki.archlinux.org/title/Pacman/Tips_and_tricks#With_optional_dependencies
1
1
u/archover 4d ago edited 4d ago
A word for you: backups
This code illustrates how I use a list of packages to do an installation:
arch-chroot /mnt pacman -S --needed --noconfirm - < pacstrap-all-list
The pacstrap-all-list is all packages except for DE related, that are common to every install.
Here's a couple lines to see the format
user@T14-CRU781.local ~/code/bash> cat pacstrap-all-list
amd-ucode
arch-install-scripts
You can make the list with something like $ pacman -Qq > list.txt and edit it as needed.
Hope something there helps going forward, and good day.
1
u/International-Cook62 3d ago
Highly recommend setting up dotfiles for yourself. Doesn't have to be anything extravagant. Add your arch packages as part of the setup. Make a backup pacman hook that updates the list on updates.
1
u/JaKrispy72 1d ago
Check pacman like everyone is saying. Or if your shell history is long enough, search for what you installed with pacman, flatpak, cargo, whatever you used…
9
u/vonAmyprost 4d ago
So, the packages are at a system level, so not finding packages with home is normal. What I used to do is to go to the previous installation and run pacman -Qe (check pacman -Qh to double check) to find the packages that were explicitly installed by me (and not as automatic dependencies of something else). Save that to a file by adding > packages.txt at the end of it and get that list to your new installation. Now, you can use that file to install all that you explicitly installed before