[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Installing same packages in a Squeeze installation in a new Wheezy installation



Ken Heard wrote:
> In a new box where the Wheezy OS will be freshly installed I want to
> install all the packages which I presently have in a box with Squeeze.

This is a question that appears on the list every so often.  People
want to be able to do this.  But unfortunately it isn't easy to do
well in practice.  It is easy do sloppily.  But hard to do well.  And
so there are many proposed solutions but none of them work well.

> # dpkg --get-selections '*' > selection.dpkg
> # debconf-get-selections    > selection.debconf
> ...
> You can transfer these 2 files to another computer, and install there
> with the following.
> # dselect update
> # debconf-set-selections < myselection.debconf
> # dpkg --set-selections  < myselection.dpkg
> # apt-get -u select-upgrade    # or dselect install

Typo there: s/select-upgrade/dselect-upgrade/

That is definitely the old venerable way of doing this on Debian from
a decade of years ago.  When working on the same version of Debian it
even worked relatively well.  Then.  But now we have extended_states
in APT supporting 'apt-get autoremove'.  With regards to that the
above no longer works well.  For one problem it completely breaks the
extended_states paradigm.

The extended_states paradigm is to track for each package whether it
was installed manually or installed as a dependency of another
package.  If you install foo and foo depends upon libfoo then foo is
marked as manual and libfoo is marked as automatic.

With the above get-selections, set-selections method then everything
is set to manually installed.  So if you do this then you must also
take into consideration the extended states and handle it somehow.

I suppose setting everything to auto, then running autoremove and
saying no, then manually selecting top level packages to mark as
manual, then repeating the autoremove, until the list is as desired
would work okay.

> Will this command sequence generally work when the "from" box has
> Squeeze and the "to" box has Wheezy?  Specifically, will the packages
> installed in the Wheezy box having the same names as the ones in the
> Squeeze box be the Wheezy versions rather than the Squeeze versions?

Some will and some won't.  Some packages names in Squeeze 6 have been
dropped from Wheezy 7.

Easier to answer this question yourself.  Simply generate a list of
all package names installed on your Squeeze 6 system and then test
if they are available on a Wheezy 7 system.

  apt-get install dctrl-tools
  grep-status -s Package -n "install ok installed" > squeeze.list

  apt-get install apt-show-versions
  apt-show-versions $(cat squeeze.list) > wheezy.status

Then examine the wheezy list and see what squeeze packages are in wheezy.

> I would assume that when the second group of commands is run any
> packages or config files already in the Wheezy box which are later
> versions of than those in the Squeeze box would be left alone.

The get-selections, set-selections process doesn't know about
versions.  APT will select for installation the newest available from
the sources.list file.

> Also it would appear that where there are no exact equivalents in the
> two boxes the Squeeze versions would be installed if the dependency
> situation allowed it; otherwise they would not be.
> 
> To know what happened when the second group of commands is run can a
> log file be thereby created for that purpose?

When I am faced with this problem I set up a second machine and then
install the packages that I want installed.  Then I manually do the
task transfer from one machine to the other.  Edit /etc config files.
Copy over raw data.  Check out files that are checked into version
control.  That type of thing.  Then I know for sure what has gone into
the new system.  And I know that lint and cruft on the old system
isn't transfered.  Or if it is transferred then it is all freshly done
and available for documentation and future cleanup.  Don't leave cruft
to be tripped over later.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: