You are not logged in.

#1 2010-09-26 17:36:46

magyckleo
Member
Registered: 2010-09-24
Posts: 30

[SOLVED] Copy packages from current Arch install to new Arch install

Hello!

I'm new to Arch, so that's why I'm posting in the newbie corner. I've been looking everywhere for an answer to this: I want to do a fresh install of my system, but my internet connection is sort of messed up right now (unusually slow). I noticed that every package I have installed on my current Arch are saved in /var/cache/pacman/pkg. Could I make a backup of that directory onto another partition on my hard drive, reinstall Arch, and restore the backup to that same directory in the new install? Would pacman "think" it's already downloaded and skip the download step alltogether?

Thanks.

Last edited by magyckleo (2011-01-31 21:28:44)

Offline

#2 2010-09-26 17:40:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Copy packages from current Arch install to new Arch install

Offline

#3 2010-09-26 18:04:07

magyckleo
Member
Registered: 2010-09-24
Posts: 30

Re: [SOLVED] Copy packages from current Arch install to new Arch install

Cool! So can I simply copy the contents of the cache onto a directory I create in the new install (eg. in the new home directory) and then add said directory as a repository in pacman.conf?

Last edited by magyckleo (2010-09-26 18:05:00)

Offline

#4 2010-09-26 18:05:56

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Copy packages from current Arch install to new Arch install

magyckleo wrote:

Cool! So can I simply copy the contents of the cache onto a directory I create in the new install (eg. in the new home directory) and then add said directory as a repository in pacman.conf?

Don't forget the repo-add part (it's in the 'Custom local repository' section of the wiki article, just below 'Installing packages from a CD/DVD/iso').

Last edited by karol (2010-09-26 18:08:10)

Offline

#5 2010-09-26 18:24:30

magyckleo
Member
Registered: 2010-09-24
Posts: 30

Re: [SOLVED] Copy packages from current Arch install to new Arch install

Let me see if I understand the steps I need to take:

1) Backup the /var/cache/pacman/pkg onto another of my partitions or a DVD (It's 1.4 gigs).

2) Reinstall Arch.

3) Copy the backup onto a new directory. eg /home/user-name/packages

This is where I'm confused. Should I...?

repo-add /home/user-name/packages.db.tar.gz /home/user-name/*.pkg.tar.gz

Will this create the tar file or do I have to make it myself? After that what should I do? Will it be automatically considered as a repository by pacman or do I have to add it as a repository by adding in the pacman.conf "[custom] Server = file:///home/user-name/packages"?

Or would it be easier to just save the packages onto a DVD and do the steps from  "Installing packages from a CD/DVD/iso"?

IMHO I think the Archlinux wiki would benefit a whole lot if it included examples of usage.

Last edited by magyckleo (2010-09-26 18:28:07)

Offline

#6 2010-09-26 18:32:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Copy packages from current Arch install to new Arch install

From the repo-add manpage: 'repo-add [-q] <path-to-db> <package1> [<package2>...]'
This should create the dbs you need.
Honestly, *I* think, that the manpage is enough and you don't need the wiki (in this case at least).

You know what, do a test, pick a couple packages, copy them somewhere and create a tiny local repo.

Offline

#7 2010-09-26 18:57:39

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [SOLVED] Copy packages from current Arch install to new Arch install

An alternative approach would be to install them locally from your backed up cache, e.g.

pacman -U /path-to-cache-backup/*

This would reinstall everything and potentially may install out-of-date packages, but could be an easier route if you just want to restore packages to a reinstall. To keep it as sane as possible, update your system and run pacman -Sc to remove uninstalled packages from cache before backing up your packages. Before reinstalling them, also update your system.

Offline

#8 2010-09-26 19:15:24

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Copy packages from current Arch install to new Arch install

If you have a slow connection, there's a special repo: http://archdelta.net/$repo/os/i686 (yes, 32-bit only atm) that uses xdelta-compressed packages that contain only the "difference" between the package versions; usually, version 1.0.3 isn't all that different from version 1.0.2. The packages are often a couple times smaller than the regular ones.
https://bbs.archlinux.org/viewtopic.php?id=92085 - be sure to read the NOTES part.

Offline

#9 2010-09-27 15:40:38

magyckleo
Member
Registered: 2010-09-24
Posts: 30

Re: [SOLVED] Copy packages from current Arch install to new Arch install

karol wrote:

From the repo-add manpage: 'repo-add [-q] <path-to-db> <package1> [<package2>...]'
This should create the dbs you need.
Honestly, *I* think, that the manpage is enough and you don't need the wiki (in this case at least).

You know what, do a test, pick a couple packages, copy them somewhere and create a tiny local repo.

Awesome! I managed to make pacman read the package db I created using add-repo.

I added the repo to the pacman.conf. Had to do a little trial & error to figure out I had to put it like this:

[name of db file]
Server = file:///path/to/folder_of_db partition

I was trying to put the file.db.tar.gz complete rute. Of course, pacman let me know with an error that wasn't right.

I tried installing something simple, like wine. First, I did a sudo pacman -Scc to clear the cache. Then I did sudo pacman -S wine. It installed successfully! I'm gonna try with a fresh install this afternoon. I'll let you know of the result.

Thanks everyone! big_smile

Last edited by magyckleo (2010-09-27 15:46:05)

Offline

#10 2010-09-28 17:59:16

magyckleo
Member
Registered: 2010-09-24
Posts: 30

Re: [SOLVED] Copy packages from current Arch install to new Arch install

Success! I did a fresh install, moved the packages back to the home directory in my new install from a partition (Using Ubuntu), then on Arch added the new repository and I was able to do installs of almost everything I had in my old Arch (Had a couple of problems reinstalling X, but that was because of me skipping and forgetting a couple of steps) ... And it was way faster! Thanks everyone.

Offline

Board footer

Powered by FluxBB