I am trying to set up a staging environment in a VM, in order to test updates before applying them to my main system.
In order to do so, I have done a basic installation of Debian Wheezy (same as on the main system) in the VM, then ran as root from within the VM:
# dpkg --clear-selections
# dpkg --add-architecture i386
# apt-get update
# ssh me@main-system 'dpkg --get-selections | grep -v deinstall' | \
dpkg --set-selections
The i386 architecture is unfortunately needed in my case; the system is amd64 native.
The problem is with dpkg --set-selections
run in the VM. I do have some packages that require special handling (those are actually the main reason why I want a staging environment in the first place) but when I run the last command above, I get about a gazillion lines of output like:
dpkg: warning: package not in database at line NNN: package-name
for packages that really should be available in the base system. Examples include xterm
, yelp
and zip
.
Now for my question:
What is the specific process for transferring the package selection list from one Debian system to another (assuming same Debian release level, in Wheezy) and then subsequently applying those changes? The goal is that both have the same list of installed packages, ideally such that doing a diff
between the outputs of dpkg --get-selections
or dpkg --list
on the two comes back showing no differences.
The grep -v deinstall
part is borrowed from Prevent packages from being removed after doing dpkg --set-selections
over on Ask Ubuntu.
I have changed the source in the VM to be the same as on the main system, also installing apt-transport-https
:
deb https://ftp-stud.hs-esslingen.de/debian/ wheezy main non-free
deb-src https://ftp-stud.hs-esslingen.de/debian/ wheezy main non-free
deb https://ftp-stud.hs-esslingen.de/debian/ wheezy-updates main non-free
deb-src https://ftp-stud.hs-esslingen.de/debian/ wheezy-updates main non-free
deb [arch=amd64] http://archive.zfsonlinux.org/debian wheezy main
Looking at the --set-selections output, I'm seeing:
dpkg: warning: package not in database at line 1: a2ps
dpkg: warning: package not in database at line 1: abiword
dpkg: warning: package not in database at line 1: abiword-common
dpkg: warning: package not in database at line 1: abiword-plugin-grammar
dpkg: warning: package not in database at line 1: abiword-plugin-mathview
dpkg: warning: package not in database at line 1: accountsservice
dpkg: warning: package not in database at line 1: acl
dpkg: warning: package not in database at line 4: aglfn
dpkg: warning: package not in database at line 4: aisleriot
dpkg: warning: package not in database at line 4: alacarte
dpkg: warning: package not in database at line 4: alien
...
The line numbers looked odd, and the corresponding portion of the output of --get-selections is:
a2ps install
abiword install
abiword-common install
abiword-plugin-grammar install
abiword-plugin-mathview install
accountsservice install
acl install
acpi-support-base install
acpid install
adduser install
aglfn install
aisleriot install
alacarte install
alien install
Notice that in between acl
and aglfn
are acpi-support-base
, acpid
and adduser
for which no errors are being reported. It seems that the packages for which errors are being reported are either un
according to dpkg -l
, or dpkg -l
doesn't have any idea at all about them (dpkg-query: no packages found matching ...
). I know there are some locally installed packages, but not many. i386
doesn't figure until gcc-4.7-base:i386 install
much farther down the list (line 342 in the --get-selections output).
dpkg --get-selections … | … dpkg --set-selections
is the way to replicate package selections. If it's failing for you, you're going to need to provide more information as to why. Post your full set of sources on both systems, the output fromdpkg --get-selections
, and the full transcript fromdpkg --get-selections
(maybe we can discern a pattern by seeing what works and what doesn't). If the main system amd64 or i386? Does it work if you don't add the i386 architecture?dpkg --get-selections
(and I assume you meant thedpkg --set-selections
transcript?)? Even just the former is over 3,600 lines and right around 100 KB./var/lib/dpkg/Packages
(which is even longer) could be useful, too — this could be a symptom of a broken Packages file.