Im trying to install all the packages installed on the other host.

  • From host = Ubuntu 12.04 LTS
  • To host = Ubuntu 12.04 LTS

I've ran dpkg --get-selections > packages.txt on the 'old'-system. To import them to the newer system i've ran: dpkg --set-selections < packages.txt. This seems to be working fine.

But when I try to install them; apt-get tells me it wants to remove the following packages:

 e2fsprogs libblkid1 (due to e2fsprogs) libuuid1 (due to e2fsprogs) util-linux (due to e2fsprogs) hostname mount libmount1 (due to mount) acpid adduser aptitude console-setup cron dmsetup dselect e2fsprogs eject grub-common
  grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common hostname ifupdown initramfs-tools
  initscripts kbd keyboard-configuration libblkid1 libdevmapper1.02.1 libmount1 libuuid1 libxapian22
  linux-image-3.2.0-49-virtual linux-image-virtual linux-virtual module-init-tools mount mountall
  netbase ntpdate openssh-client openssh-server passwd plymouth procps resolvconf rsync rsyslog
  tasksel tasksel-data ubuntu-minimal udev upstart ureadahead util-linux

The problem is; I see a couple of 'required' packages that I don't want to deinstall/remove. Is there a command like apt-get upgrade --only-install? Or is there a work-around to only INSTALL the packages?


The correct way was parsing the output of --get-selections before importing the list. Now to correct the situation some workarounds should be applied:

On 'old' system:

dpkg --get-selections | grep -v 'deinstall` > packages.txt

This will get you a list of only the packages installed. Now in the target system:

sudo dpkg --clear-selections
sudo dpkg --set-selections < packages.txt

Now lets fix the mess of the previous command:

Save the following to some file, lets call it packages.fix;

e2fsprogs install 
libblkid1 install 
libuuid1 install 
util-linux install 
hostname install 
mount install 
libmount1 install 
acpid install 
adduser install 
aptitude install 
console-setup install 
cron install 
dmsetup install 
dselect install 
e2fsprogs install 
eject install 
grub-common install 
grub-gfxpayload-lists install 
grub-pc install 
grub-pc-bin install 
grub2-common install 
hostname install 
ifupdown install 
initramfs-tools install 
initscripts install 
kbd install 
keyboard-configuration install 
libblkid1 install 
libdevmapper1.02.1 install 
libmount1 install 
libuuid1 install 
libxapian22 install 
linux-image-3.2.0-49-virtual install 
linux-image-virtual install 
linux-virtual install 
module-init-tools install 
mount install 
mountall install 
netbase install 
ntpdate install 
openssh-client install 
openssh-server install 
passwd install 
plymouth install 
procps install 
resolvconf install 
rsync install 
rsyslog install 
tasksel install 
tasksel-data install 
ubuntu-minimal install 
udev install 
upstart install 
ureadahead install 
util-linux install

Now lets do sudo dpkg --set-selections < packages.fix continue with your operation, it should be fine now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.