[SOLVED] Stuck, unable to upgrade packages - dpkg: error: need an action option

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
juliohm
Level 1
Level 1
Posts: 10
Joined: Mon Apr 28, 2014 1:14 pm

[SOLVED] Stuck, unable to upgrade packages - dpkg: error: need an action option

Post by juliohm »

I haven't been able to find any good hints about this on Google, so here it goes...

Recently did a fresh install of Linux Mint 18 Sarah on my PC and have been using it for about a week now. Added a few sources to /etc/apt/sources.list.d/ and it all seemed great until today.

checked for new updates...

Code: Select all

jhem@jhempc ~ $ apt update
Ign:1 http://mint-packages.c3sl.ufpr.br sarah InRelease
Hit:2 http://ubuntu.c3sl.ufpr.br/ubuntu xenial InRelease                 
Hit:3 http://mint-packages.c3sl.ufpr.br sarah Release                    
Hit:4 http://ubuntu.c3sl.ufpr.br/ubuntu xenial-updates InRelease         
Hit:5 http://ubuntu.c3sl.ufpr.br/ubuntu xenial-backports InRelease       
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [94,5 kB]                                               
Hit:8 http://ppa.launchpad.net/gencfsm/ppa/ubuntu xenial InRelease                                                        
Hit:9 http://apt.syncthing.net syncthing InRelease                                                                        
Hit:10 http://archive.canonical.com/ubuntu xenial InRelease                                                
Hit:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease                                   
Fetched 94,5 kB in 0s (129 kB/s)                    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.
tried upgrading...

Code: Select all

jhem@jhempc ~ $ apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  mintupload nvidia-prime-applet openssh-client ssh-askpass-gnome
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/673 kB of archives.
After this operation, 1.024 B disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' 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;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
E: Sub-process /usr/bin/dpkg returned an error code (2)
also tried sudo apt-get upgrade, but with the same result.

Code: Select all

jhem@jhempc ~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  mintupload nvidia-prime-applet openssh-client ssh-askpass-gnome
4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/673 kB of archives.
After this operation, 1.024 B disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' 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;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
E: Sub-process /usr/bin/dpkg returned an error code (2)
I have no idea what this error message means, and I can't install or upgrade any packages. Can anyone give me any hints?

Kind regards.
Last edited by juliohm on Tue Aug 16, 2016 5:10 pm, edited 1 time in total.
juliohm
Level 1
Level 1
Posts: 10
Joined: Mon Apr 28, 2014 1:14 pm

Re: Stuck, unable to upgrade packages - dpkg: error: need an action option

Post by juliohm »

Thanks. But that seems to relate to a specific corrupted package.

In my case, no package name is given in the error message. The ones shown listed for upgrade were downloaded correctly. I was able to cd into /var/cache/apt/archives and install them manually using dpkg.

Code: Select all

jhem@jhempc /var/cache/apt $ cd /var/cache/apt/archives

jhem@jhempc /var/cache/apt/archives $ sudo dpkg -i mintupload_4.0.8_all.deb 
(Reading database ... 238718 files and directories currently installed.)
Preparing to unpack mintupload_4.0.8_all.deb ...
Unpacking mintupload (4.0.8) over (4.0.7) ...
Setting up mintupload (4.0.8) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
Processing triggers for mime-support (3.59ubuntu1) ...

jhem@jhempc /var/cache/apt/archives $ sudo dpkg -i nvidia-prime-applet_1.0.5_all.deb 
(Reading database ... 238718 files and directories currently installed.)
Preparing to unpack nvidia-prime-applet_1.0.5_all.deb ...
Unpacking nvidia-prime-applet (1.0.5) over (1.0.4) ...
Setting up nvidia-prime-applet (1.0.5) ...

jhem@jhempc /var/cache/apt/archives $ sudo dpkg -i openssh-client_1%3a7.2p2-4ubuntu2.1_amd64.deb 
(Reading database ... 238718 files and directories currently installed.)
Preparing to unpack openssh-client_1%3a7.2p2-4ubuntu2.1_amd64.deb ...
Unpacking openssh-client (1:7.2p2-4ubuntu2.1) over (1:7.2p2-4ubuntu1) ...
Setting up openssh-client (1:7.2p2-4ubuntu2.1) ...
Processing triggers for man-db (2.7.5-1) ...

jhem@jhempc /var/cache/apt/archives $ sudo dpkg -i ssh-askpass-gnome_1%3a7.2p2-4ubuntu2.1_amd64.deb 
(Reading database ... 238718 files and directories currently installed.)
Preparing to unpack ssh-askpass-gnome_1%3a7.2p2-4ubuntu2.1_amd64.deb ...
Unpacking ssh-askpass-gnome (1:7.2p2-4ubuntu2.1) over (1:7.2p2-4ubuntu1) ...
Setting up ssh-askpass-gnome (1:7.2p2-4ubuntu2.1) ...
Processing triggers for man-db (2.7.5-1) ...
But as soon as I try installing, reinstalling or removing anything via apt, the same error appears. For example, trying to install emacs:

Code: Select all

jhem@jhempc /var/cache/apt/archives $ apt install emacs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg libm17n-0 libotf0 m17n-db
Suggested packages:
  ncurses-term m17n-docs
Recommended packages:
  emacs24-el
The following NEW packages will be installed:
  emacs emacs24 emacs24-bin-common emacs24-common emacs24-common-non-dfsg libm17n-0 libotf0 m17n-db
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/22,2 MB of archives.
After this operation, 97,1 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' 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;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
E: Sub-process /usr/bin/dpkg returned an error code (2)
... or trying to reinstall htop, which is already installed.

Code: Select all

jhem@jhempc /var/cache/apt/archives $ sudo apt-get install --reinstall htop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 76,6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ubuntu.c3sl.ufpr.br/ubuntu xenial/universe amd64 htop amd64 2.0.1-1 [76,6 kB]
Fetched 76,6 kB in 0s (4.389 kB/s)
dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' 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;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
E: Sub-process /usr/bin/dpkg returned an error code (2)
... or trying to remove it:

Code: Select all

jhem@jhempc /var/cache/apt/archives $ sudo apt-get remove htop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  htop
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 215 kB disk space will be freed.
Do you want to continue? [Y/n] 
dpkg: error: need an action option

Type dpkg --help for help about installing and deinstalling packages [*];
Use 'apt' 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;

Options marked [*] produce a lot of output - pipe it through 'less' or 'more' !
E: Sub-process /usr/bin/dpkg returned an error code (2)
juliohm
Level 1
Level 1
Posts: 10
Joined: Mon Apr 28, 2014 1:14 pm

Re: Stuck, unable to upgrade packages - dpkg: error: need an action option

Post by juliohm »

Yes!

This reddit thread provided a good hint.

Back when we had the PC reinstalled, some of us fancied with unattended upgrade files, specifically /etc/apt/apt.conf.d/50unattended-upgrades. Along with extra options for Allowed-Origins, someone slapped the following lines into this file:

Code: Select all

Dpkg::Options {
       “–force-confnew”;
}
... hoping it would force dpkg to replace all configuration files (such as the ones in /etc) with whatever is provided in the upgraded package.

This broke dpkg at the command line system wide. After removing the -force-confnew option, everything is back to normal.

Thanks all for the help!
Post Reply

Return to “Software & Applications”