Question

I'm looking at maybe moving from an older AMD64 to a new Intel dual-core which is 32 bit. Installation isn't a problem but can I transfer all the installed apps? I haven't been able to find anything so far on Google except where the migration is to a similar platform and file-system. I won't change the filesystem but the platform will be different. Is there something on the lines of the "World" file in Gentoo?

Was it helpful?

Solution

You can save your list of packages easily: see "man dpkg" and search for --set-selections and --get-selections.

The basic of it, though is that to save the list of packages:

dpkg --get-selections > package_list

To restore that list on another system:

cat package_list | sudo dpkg --set-selections && sudo apt-get dselect-upgrade

Moving across architectures means that there will be some packages unavailable. They will be ignored; for example, ia32-libs will not be installable on a 32-bit system. That selection will be ignored if you're moving from x86-64 to x86.

OTHER TIPS

Funny, here I was using SO as a howto repository (write a question and then select my own answer), but in the time that it took me to write my own answer, I was beaten to the punch thrice!

Anyway, here's my take for the record:

Use dpkg's --get-selections and --set-selections options to capture and select your currently installed packages.

First, export your current package list on your old system:

sudo dpkg --get-selections > mypackages.txt

Then select this list as the packages to install on your new system:

sudo dpkg --set-selections < mypackages.txt

(For extra credit, copy your apt cache directory over to minimize downloads: /var/cache/apt)

Finally, tell apt to download and install the selected packages:

sudo apt-get dselect-upgrade

For everything you've used apt-get to install, if you want to create a record of what's installed run the following:

dpkg -l|awk '/^ii\s*(.*)\s*/ {print $2}'|packages.txt

This will create a text file with all the packages you have installed. Then after you do the install, create and run a script with the following:

#!/bin/sh
for p in $(cat packages.txt); do apt-get install $p; done

Notes:
1) Since you're moving from 64 bit to 32 bit, some of the packages might not be compatible. I would grep packages.txt for '64' before running the script above and find alternatives if they are needed.
2) Anything you've installed from source, you'll have to make a note of and install from source again.

Good luck!

If (like me) you didn't do this before you messed up your system, you can boot into a live-cd or another install, and use chroot to get at this info.

sudo chroot /path/to/old/system /bin/bash

Then do the dpkg --get-selections dance, and you can use the resulting file to setup your new system.

This is what I generally do to solve similar problem (migrated to a new laptop several times).

There is two addition to the other answers to this question, this will also move your update-alternatives and debconf settings, which always takes a long time to realize those were not transferred.

Backup on old system:

sudo apt-get install dselect debconf-utils
mkdir system-selections
update-alternatives --get-selections > system-selections/alternatives-selections
dpkg --get-selections '*' > system-selections/dpkg-selections
sudo debconf-get-selections > system-selections/debconf-selections

Copy config directory to the newsystem ("scp -r oldsystem:system-selections ~"):

sudo apt-get install dselect debconf-utils
sudo dselect update
sudo dpkg --set-selections  < system-selections/dpkg-selections
sudo debconf-set-selections < system-selections/debconf-selections
sudo apt-get -u dselect-upgrade
sudo update-alternatives --set-selections < system-selections/alternatives-selections

Also, you can use same method to regularly take backups of your home directory and system-selections (mentioned above) to a remote storage. So in case of your laptop broken/stolen, building a similar system is pretty fast.

I'm not sure if this is an answer, but I just discovered the existence of the command aptitude-create-state-bundle. Yes, that's one command. Check out the man page.

The best way I can think of to go about this is to back up the list of installed packages on your current system and then use that list to set what packages to install on the new system. General instructions on how to backup and restore your package selections:

Install tools

sudo apt-get install dselect

Backup Package List

dpkg --get-selections | grep -v deinstall > ubuntu-files

Restore Package Selections

sudo apt-get update
sudo apt-get dist-upgrade
dpkg --set-selections < ubuntu-files
sudo dselect

This will open up a dselect session. Type ‘I‘ and allow dselect to install of the the packages listed in your ubuntu-files document. When it’s finished, type ‘Q‘ and hit the ENTER key to exit dselect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top