You are not logged in.

#1 2020-11-01 12:13:33

babaliaris
Member
Registered: 2017-09-29
Posts: 33

(SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

I was reading the Pacman/Tips_and_tricks wiki.

When it comes to backup pacman, I read two options:

1) Tips_and_tricks#List_of_installed_packages
2) Tips_and_tricks#Back_up_the_pacman_database

but I can't understand the difference between them.

The first one is probably just a txt file which contains a List of all the installed packages. So in a new system I can feed this list to pacman so it can download all these packages, including their dependencies, correct?

The second option (backing app the pacman database) why should I use it? I read that it contains specific stuff like versions, mirrors but I can't quite understand it.

In general, when I want to backup pacman which option should I use in case I want to restore a newly installed system?

Last edited by babaliaris (2020-11-01 16:27:33)

Offline

#2 2020-11-01 13:07:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,638
Website

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

babaliaris wrote:

So in a new system I can feed this list to pacman so it can download all these packages, including their dependencies, correct?

Correct.

babaliaris wrote:

The second option (backing app the pacman database) why should I use it?

It sounds like you shouldn't - or at least not to acheive your current goals.  It's a backup.  Just like anything else can get backed up to be replaced if damaged / corrupted / deleted.  This is just the local database with metadata about packages that are installed - it would not be useful (at least not convenient) for moving to a new system.

babaliaris wrote:

In general, when I want to backup pacman which option should I use in case I want to restore a newly installed system?

For this purpose, use the first option: the list of explicitly installed packages.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-11-01 13:34:31

babaliaris
Member
Registered: 2017-09-29
Posts: 33

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

Thank you so much for your answer!!!

I'm an Arch Linux user for more than 3 years and every time I was running into a problem where re-installing the system was inevitable (at least to my recovery knowledge),
I was literally installing everything manually from scratch, no backups no nothing (except files like images and videos)! Well, this was actually a good practice to learn a lot
about Arch Linux and Linux in general because each time I was doing it in a little different way, having in mind all the mistakes I did before.

But this soon enough became "hell". Currently my system is quite big, and having to re-install everything manually is probably impossible. It's the first time that I kept
a system without breaking it for more than 1 and a half years!

My current plan is this (and because I'm doing this for the first time) I would love some advices:

1) Take a list of explicitly installed packages (pacman).
2) Get a copy of the /etc directory.
3) Get a copy of the home directory.

I thing this is enough to restore my system. Programs that are manually installed (including their dependencies), live in my home directory. The same goes with AUR repositories.

Now I'm not sure if I need to copy (backup) more directories. For example, do I need to copy something from /usr as long as I did not installed something manually in there?

By the way, in Tips_and_tricks#List_of_installed_packages it says that With option -n, foreign packages (e.g. from AUR) would be omitted from the list..
Does this mean that by default using pacman -Qqe > pkglist.txt will also include AUR packages? But how will pacman know how to install them? And if this is true, it means I dont have to go manually in each AUR repository and run
makepkg -si?

Offline

#4 2020-11-01 14:23:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,638
Website

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

There is never a reason to reinstall arch linux on the same machine.  Just fix the underlying problem instead.  Reinstalling just robs you of the opportunity to figure out what's actually going on.

babaliaris wrote:

I thing this is enough to restore my system.

Pretty much, yes.  Possible exceptions should be pretty trivial: for example, some wireless networking tools store remembered networks and credentials elsewhere.

babaliaris wrote:

Does this mean that by default using pacman -Qqe > pkglist.txt will also include AUR packages? But how will pacman know how to install them? And if this is true, it means I dont have to go manually in each AUR repository and run
makepkg -si?

Yes, aur packages will be included in that list unless you add the 'n' flag.  Pacman will not be able to install these, of course, and it will error out and not do anything (which, again, is why the 'n' flag is recommended there). If you have the cloned aur repos backed up in your home directory, then yes, running makepkg -si in each would do - but those directories would also still contain the previously built package, so you could just install it with `pacman -U`.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2020-11-01 14:32:57

babaliaris
Member
Registered: 2017-09-29
Posts: 33

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

Thanks again! Everything is clear now!

Well it's OK if I have to re-install AUR packages manually (I can easily create a simple script to run git pull -> makepkg -si for every AUR repository in my home directory).
About the networking tools, I use network manager  and it actually stores the connections somewhere in /etc. I will be fine smile

Last edited by babaliaris (2020-11-01 14:33:32)

Offline

#6 2020-11-01 14:36:10

babaliaris
Member
Registered: 2017-09-29
Posts: 33

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

Trilby wrote:

There is never a reason to reinstall arch linux on the same machine.  Just fix the underlying problem instead.  Reinstalling just robs you of the opportunity to figure out what's actually going on.

Sometimes, if I mess up something very basic (like the display manager or systemd) I can't fix it... So I re-install the whole system instead. Well, now I've become quite experienced to not break things up but you never now tongue

Last edited by babaliaris (2020-11-01 14:36:50)

Offline

#7 2020-11-01 15:45:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 24,638
Website

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

There is absolutely no reason to reinstall to fix a display manager (and those are not basic, you do not need them at all).

Ask here when you run into those problem and we can help.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2020-11-01 16:24:44

babaliaris
Member
Registered: 2017-09-29
Posts: 33

Re: (SOLVED) pacman -Qqe > pkglist.txt VS pacman database backup

Trilby wrote:

Ask here when you run into those problems and we can help.

I will, thank you!

Offline

Board footer

Powered by FluxBB