Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

While working in command prompt, I accidentally typed following command:

sudo apt-get install python3-

and ubuntu started removing python3 and everything depends on it (including firefox and much more). Fortunately I closed that terminal immediately and reverted everything by checking dpkg log file, but I was wondering why an install command should act like remove?

Is it a bug?

Consider the situation that you are looking for a package name (pressing Tab twice) and going through possibilities by pressing Enter key and those Enter keys remain in the keyboard buffer and.... youhaaaa... apt-get is removing the entire installation in front of your eyes.

share|improve this question
    
Just tried that command on my machine, It is really selecting so many system packages to remove. and the funny thing is that those are not meta-packages but actual install packages. By the way, I also tried appending - with some other package names but that produced an error. looks like this is only happening with python3- –  Gufran Nov 7 '12 at 10:43
    
I'm pretty sure apt-get asks for confirmation by default. –  nyuszika7h Sep 23 at 14:11

2 Answers 2

up vote 8 down vote accepted

Just tried this minus (or dash) sign after a package and yes , apt-get acting like remove.

Funny thing is I didn't know this function of apt-get . This minus sign is valid for every package . I tried with smplayer- with firefox- and always acting like remove. So the only thing I can think is that the dash sign at the end of a package considered by apt-get like a minus and install command converted to remove.

If you wanted to install everything about python3 , then you had to add an asterisk sign after this dash(minus) sign

sudo apt-get install python3-*

In the begin I thought this was just a conflict issue , but is not. Sometimes when you install some package and conflict with an other package then the already installed package will be removed due to new installed package , but this is not our situation here.

We've learned something useful today.

From the man-page of apt-get . To read the man-page via your terminal give man apt-get

If a hyphen (-) is appended to the package name (with no intervening space), the identified package will be removed if it is currently installed. Similarly a plus sign (+) can be used to designate a package to install. These latter features may be used to override decisions made by apt-get's conflict resolution system.

Eventually is not a new option or something weird , is just we don't read the man-pages carefully.

share|improve this answer
    
I want to be sure that this function was implemented by purpose (not a bug). I took a look on man page of apt but I did not find such a function. It is appreciated if you could add a link to such document. –  M.Elmi Nov 7 '12 at 11:23
1  
@M.Elmi, linux.die.net/man/8/apt-get –  Sean Cheshire Nov 7 '12 at 15:08
    
Thank you. What do you think about a suugestion to canonical for disabling this by default? While this option is not so common, it simply may cause unwanted remove of packages. Of course one can enable it later from a config file. –  M.Elmi Nov 7 '12 at 16:18
    
You can open a bug with a future request (or wish) , but I don't think that Canonical has something to do with it. You should open a bug assigned to debian. Here => debian.org/bugs –  NikTh Nov 7 '12 at 19:11

This is apparently a feature of apt.

From the manpage for the apt-get command Manpage icon,

If a hyphen is appended to the package name (with no intervening space), the identified package will be removed if it is installed. Similarly a plus sign can be used to designate a package to install. These latter features may be used to override decisions made by apt-get's conflict resolution system.


Simulating with an installed package and a hyphen appended to the end of the package gives me this output:

$ apt-get install -s retext-
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  retext-wpgen
Use 'apt-get autoremove' to remove it.
The following packages will be REMOVED:
  retext
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Remv retext [3.1.3-1]

Similarly, with an uninstalled package and a plus sign appended to the end of the package, I get this output:

$ apt-get remove -s googlecl+
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  python-gdata
Suggested packages:
  python-gdata-doc
The following NEW packages will be installed:
  googlecl python-gdata
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Inst python-gdata (2.0.17-1 Ubuntu:12.10/quantal [all])
Inst googlecl (0.9.13-1.1 Ubuntu:12.10/quantal [all])
Conf python-gdata (2.0.17-1 Ubuntu:12.10/quantal [all])
Conf googlecl (0.9.13-1.1 Ubuntu:12.10/quantal [all])
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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