Thursday, May 2, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 3356  / 1 Year ago, tue, january 10, 2023, 3:43:27

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



sudo apt-get install python3-


and ubuntu started removing python3 and everything that 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.


More From » command-line

 Answers
3

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.


[#34422] Thursday, January 12, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronicod

Total Points: 71
Total Questions: 111
Total Answers: 111

Location: Montenegro
Member since Fri, Dec 10, 2021
2 Years ago
ronicod questions
Thu, Nov 11, 21, 06:26, 3 Years ago
Sun, May 7, 23, 13:57, 1 Year ago
Sun, Jun 26, 22, 06:13, 2 Years ago
Fri, Oct 14, 22, 13:55, 2 Years ago
;