this post was submitted on 29 Nov 2023
18 points (100.0% liked)

Linux

48655 readers
479 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hi everyone :)

After installing the emacs package and trying to remove it afterwards:

sudo apt remove --purge --autoremove emacs

It only removed that package and not the other dependencies installed with it (emacs-gtk, emacs-common...). I had to manually remove them one-by-one.

Isn't that command supposed:

  • remove package
  • it's configuration files
  • remove unused packages automatically installed ?

What am I missing here?

Also after reading the Stupid things you've done that broke your Linux installation post, I read a lot of people messing up their debian system after using the above command... So I assume that's not the correct way of doing things in Linux?

Some insight from experienced user would be great :)

top 5 comments
sorted by: hot top controversial new old
[–] [email protected] 5 points 1 year ago (1 children)

It is a very typical way of doing things, you just have to read the output and make sure no important packages are in the list.

Your command should be working. It won’t remove manually installed dependencies but should take care of automatic ones. You can check an individual package with apt show and look at the APT-Manual-Installed field.

[–] deepdive 2 points 1 year ago (1 children)

Hi thanks for your quick response !

I already checked with apt show emacs and the output clearly shows emacs-gtk as depends on. And while installing the emacs package with: sudo apt-get install emacs it installed a ~400Mo package and all dependencies.

So why doesn't sudo apt remove --purge --autoremove emacs removes everything ? I thought this command would be the exact opposite of sudo apt install package-name

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (1 children)

Ah, I can duplicate this behavior too. I think it is probably related to emacs being a metapackage. It does not include emacs itself but forces the install of emacs-gtk. In my mind removing the metapackage should allow you to autoremove dependencies, but people have broken their systems badly with this behavior so it may have been changed or it’s stuck behind some configuration option.

Removing emacs-gtk itself will work as you expect. You can also install emacs-nox for a cli-only one that is smaller.

Edit: there is a setting called APT::Never-MarkAuto-Sections that by default includes meta packages and I think is the cause of this.

[–] deepdive 1 points 1 year ago (1 children)

Thank you very much for your enlighten answer :D !

Removing emacs-gtk itself will work as you expect

Yes that's what I found out with apt show emacs-gtk, it shows all the dependencies but I found it quiet odd behavior (lack of knowledge).

I wasn't aware of metapackages, something new to put into my knowledge database.

Edit: While writing my replay and searching through the web and my console, even though I wouldn't have had understood it while reading it... It actually tells me in the description that emacs is a metapackage... Bad reading skills :/ sorry about that !

Description: GNU Emacs editor (metapackage) GNU Emacs is the extensible self-documenting text editor. This is a metapackage that will always depend on the latest recommended Emacs variant (currently emacs-gtk).


If you don't mind I have a last question. Imagine I want to remove docker-ce, which depends on iptables among others, if I sudo apt remove --purge --autoremove docker-ce, this isn't going to remove iptables and break my system right? Because it's used by other packages, system... I guess, no?

I think a more general question would be how can I be sure I not going to fuck my system while removing packages? Maybe I'm to paranoïd and today it's relatively safe to do so, compared to years ago??

Thank you :)

[–] [email protected] 2 points 1 year ago

If something else depends on it then it shouldn’t be removed, it’s only removing things that are not used elsewhere.

Usually just reading through the packages it’s listing and double check what it’s doing is enough. If something is removing a ton of gnome and you’re not trying to remove gnome, that would be an issue. If something is trying to remove the kernel (unless it’s an old kernel) or grub that’s also worth digging into. I’ve never run into problems with it, I don’t think it’s common these days.