I have been running these commands:

sudo dpkg --clear-selections
sudo dpkg --set-selections < [Path to packages_list ]>
sudo apt-get autoremove

with the file packages_list which looks like this

acpi-support                    install
acpid                       install
adduser                     install
adium-theme-ubuntu              install
adobereader-enu                 install
aisleriot                   install
akonadi-server                  install
alacarte                    install
alsa-base                   install
alsa-utils                  install
anacron                     install

I have been getting these errors while using the second command mentioned above..

dpkg: --set-selections takes no arguments

Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Type dpkg --license for copyright license and lack of warranty (GNU GPL) [*].

Can some one help me out please..

2 Answers 2


Wherever you copied this from:

sudo dpkg --set-selections < [Path to packages_list ]>

you mangled it and misunderstood the result. I can tell because you have <> arranged like an extra pair of brackets, which if they were actually there in the instructions you found, would be unnecessary (and inconsistently spaced).

It complains that it doesn't take arguments because it takes stdin, You're supposed to use the stdin redirection operator < before your filename. And no > anywhere.


dpkg: --set-selections takes no arguments

It doesn't use arguments, but it takes standard input (stdin) instead.

As per man 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.

So for multiple selection, use file:

dpkg: --set-selections < myfile

For one package, you can use with echo, e.g.

echo "acpid hold" | dpkg: --set-selections

For multiple packages, you can use with printf (line separated by \n), e.g.

echo "alsa-base hold\nalsa-utils\n" | dpkg: --set-selections

See also:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .