Sunday, 25 March 2012

Reusing packages from one system in building a new one

While installing Arch linux on my new Dell Latitude, I wanted to reuse packages on my existing Arch installation on my old laptop. As soon as I was through with the initial install using the net install image, I put all packages from /var/cache/pacman/pkg to a folder called repo on a USB stick. From the command line I mounted the usb stick on my new installation to /mnt/usb.

mount -t vfat /dev/sdb1 /mnt/usb
 
Now, all I had to do was to tell pacman to look for packages in the repo folder in the USB stick. I achieved this by setting CacheDir variable in pacman.conf to /mnt/usb/repo.

#DBPath      = /var/lib/pacman/
CacheDir    = /mnt/usb/repo/
LogFile     = /var/log/pacman.log


Actually, you can also try creating a local repo. It is there in the pacman manual pages. However, this seemed easier and faster to me and worked on first go.

After this setting, when I tried installing Xorg it told me that there is no extra.db and community.db; but I had those repos enabled and therefore it failed. I realized only core.db existed in my system and I had not synced the repo databases even once. I could have achieved that by pacman -Syu; but for my internet connection to work I needed to install wvdial and usb_modeswitch as I use a 3G USB internet card. So, I just copied extra.db and community.db from my old system into the new one and things worked fine.

No comments: