LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Transfering installed packages on one sys to another (https://www.linuxquestions.org/questions/debian-26/transfering-installed-packages-on-one-sys-to-another-483637/)

MrInept 09-15-2006 12:12 AM

Transfering installed packages on one sys to another
 
I had a really sweet version of etch running a week ago when i upgraded my hard drive, i've got both the old and new in now but i'm running etch off the new. The thought of figuring out which packages to download again kills me so i'm wondering if somewhere i can grab a list of the installed packages on the old system and do something with it, thoughts?

Nathanael 09-15-2006 01:57 AM

boot up the old system and run
dpkg --list
pipe it into a file so you can read it whenever you wish
dpgk --list > packagelist.txt

this list will show you all packages and version numbers of the packages installed.

also:
this will show you package name, current version, available version and priority of installed packages:
aptitude -F '%p %v %V %P' search '~i'

this will show you the same as above but for packages to be updated if you run apt-get upgrade:
aptitude -F '%p %v %V %P' search '~U'

read /usr/share/doc/aptitude/README for more info.

MrInept 09-15-2006 02:29 AM

nice, i should really go over all that piping stuff.

Nathanael 09-15-2006 04:04 AM

in theory you should be able to mount your old system somewhere and simply point apt, dpkg or aptitude to the packages database on that hdd to retreive information :-)

archtoad6 09-15-2006 11:35 AM

Other than using chroot, how might one "point apt, dpkg or aptitude to the packages database on that hdd"?

In addition to the good advice above, before you destroy the old system, also consider:
Quote:

from man dpkg
dpkg --get-selections [package-name-pattern...]
Get list of package selections, and write it to stdout.

dpkg --set-selections
Set package selections using file read from stdin.
This file should be in the format '<package> <state>',
where state is one of install, hold, deinstall or purge.
Blank lines and comment lines beginning with '#' are also permitted.
...
To make a local copy of the package selection states:
dpkg --get-selections >myselections

You might transfer this file to another computer, and install it there with:
dpkg --set-selections <myselections
Note that this will not actually install or remove anything, but just set the selection state on the requested packages. You will need some other application to actually download and install the requested packages. For example, run dselect and choose "Install".

Ordinarily, you will find that dselect(8) provides a more convenient way to modify the package selection states.
I just tried this on a re-install, unfortunately, dpkg --set-selections <myselections re-installed everything including what I had already done w/ the original CD. Would have taken hours if I hadn't aborted it.

Although I haven't tried it yet, I believe apt-get dselect-upgrade might work better:
Quote:

from man apt-get
dselect-upgrade
dselect-upgrade is used in conjunction with the traditional Debian packaging front-end, dselect(8). dselect-upgrade follows the changes made by dselect(8) to the Status field of available packages, and performs the actions necessary to realize that state (for instance, the removal of old and the installation of new packages).

MrInept 09-15-2006 08:39 PM

Quote:

Originally Posted by archtoad6
dselect-upgrade follows the changes made by dselect(8) to the Status field of available packages, and performs the actions necessary to realize that state (for instance, the removal of old and the installation of new packages).

It almost sounds spiritual.

MrInept 09-15-2006 08:47 PM

So anyway seriously, what your saying is i should be able to pipe the state of every package to a file and make dselect just kind of 'make it happen'.

I guess this leaves me one last question, apart from these methods, is there anyway to just transfer everything physically w/o downloading?

TigerOC 09-16-2006 05:28 AM

If you have a cd burner then create a cd repository of the packages;

1. Create a new directory /debs under root

2. copy the files from /var/cache/apt/archives to /debs

3. do as root; dpkg-scanpackages /debs /dev/null | gzip > /debs/Packages.gz

4. write the contents of /debs to a cd

6. add the cdrom to the apt sources by doing; apt-cdrom add

5. you can now retrieve the packages you need from the cd using apt-get install

Nathanael 09-16-2006 05:33 AM

Quote:

Originally Posted by Nathanael
in theory you should be able to mount your old system somewhere and simply point apt, dpkg or aptitude to the packages database on that hdd to retreive information :-)

Apologies, i confused this with another packaging system where this is possible!
but chroot is at least something :-)

MrInept 09-17-2006 02:40 AM

I wish that were possible, but as part of tweaking my system i cleared the cached debs, i guess i have no choice but to d/l. Thanks all for your help, you guys (/gals) on this forum rock.

TigerOC 09-17-2006 04:24 AM

You could just replicate the old system on the new drive. Here is a howto on this.


All times are GMT -5. The time now is 12:22 PM.