Author Topic: Careful with autoremove!  (Read 405 times)

0 Members and 1 Guest are viewing this topic.

Offline fox

  • Member
  • Master
  • *
  • Posts: 2083
Careful with autoremove!
« on: January 16, 2022, 07:59:42 am »
I learned an expensive lesson this week (expensive time-wise that is). If you have a Debian or Ubuntu-based distro, you have a command line option to clean up unused applications, including older versions of your current kernel if you have more than two of them. The command:
Code: [Select]
sudo apt autoremoveI used it mainly as a quick way to clean up old, unneeded kernels, as the five kernel packages take up almost a half gig of space. After awhile, I just used it automatically without looking at what it was going to remove. This time I got a nasty surprise, as among the packages it removed were a bunch of i386 packages needed by JMP (my old statistical program) and Microsoft Office 2010 running on Codeweaver's Crossover Linux. I spent about 2 hours getting those programs to run again, and it could have been worse had I not saved some notes about the i386 packages needed to install and run JMP.

The safer way to have done this would have been to look over the list of packages that would be deleted if you execute the autoremove command. (It lists those packages first and then gives you the option to execute the command or not.) The alternative would have been to use the Synaptic program and search for the packages you want to remove. For example, if you want to remove older versions of the 5.13 kernel packages, search for "5.13.0-" and you'll get a list of all packages meeting that description in your repositories, with those installed marked as such. You then have the option to remove them individually.

I suspect that there is a command line option that lets one remove a subset of the packages listed by the autoremove command, but I'm happy with the Synaptic option and haven't bothered to look this up.
« Last Edit: January 16, 2022, 11:52:38 am by fox »
Ubuntu 22.04 on 2019 5k iMac
Ubuntu 20.04 on Dell XPS 13 2 in 1

Offline ssfc72

  • Member
  • Master
  • *
  • Posts: 1952
Re: Careful with autoremove!
« Reply #1 on: January 16, 2022, 08:36:19 am »
Thanks fox, for the headsup about using the autoremove command.  One Gig of Drive space for old kernals sure is a lot of wasted SSD storage space.

I will have to do a cleanup of old kernals on my notebook computers, as well.

Edit: I just ran an autoremove command and it said it was going to remove 30 items but it only listed 15 items. I wonder what the other 15 items are, that it wanted to remove??
Mint 19.1 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MX Linux)
Cellphone Samsung A50, PCMobile pay as you go

Offline fox

  • Member
  • Master
  • *
  • Posts: 2083
Re: Careful with autoremove!
« Reply #2 on: January 16, 2022, 11:57:36 am »
Thanks fox, for the headsup about using the autoremove command.  One Gig of Drive space for old kernals sure is a lot of wasted SSD storage space.
....
Oops, my mistake. A kernel takes up less than 0.5 Gig. I corrected the error.
Ubuntu 22.04 on 2019 5k iMac
Ubuntu 20.04 on Dell XPS 13 2 in 1

Offline Jason

  • Administrator
  • Master
  • *****
  • Posts: 4039
  • Humanist. Skeptic. Husband.
Re: Careful with autoremove!
« Reply #3 on: January 16, 2022, 08:29:38 pm »
Thanks fox, for the headsup about using the autoremove command.  One Gig of Drive space for old kernals sure is a lot of wasted SSD storage space.

I will have to do a cleanup of old kernals on my notebook computers, as well.

Edit: I just ran an autoremove command and it said it was going to remove 30 items but it only listed 15 items. I wonder what the other 15 items are, that it wanted to remove??

Are you using Mint? Because Mint will roll several packages into what is counted as a single update. For example, it might say there are 5 updates available and show them but when run at the command-line with apt, it might say 8 because Mint rolls several packages that work together as one update. I'm wondering if the same thing is happening here. When it happens next time, see if you can note what packages were removed vs. how many were listed.
"With all its sham, drudgery, and broken dreams, it is still a beautiful world." - Max Ehrmann, Desiderata

Offline Jason

  • Administrator
  • Master
  • *****
  • Posts: 4039
  • Humanist. Skeptic. Husband.
Re: Careful with autoremove!
« Reply #4 on: January 16, 2022, 08:35:53 pm »
Thanks for the tip, Fox.

I usually give it a once over but I can see if you've installed something that wasn't installed through the package management system, it might pull packages that it shouldn't because it doesn't know they're dependencies. I assume that those programs you mentioned weren't installed through apt?

Here's another good reason to use Timeshift. ;-) Yeah, yeah, I'll shut up now. :)

Honestly, though, I hadn't thought about it potentially breaking other programs so good to point out.
"With all its sham, drudgery, and broken dreams, it is still a beautiful world." - Max Ehrmann, Desiderata

Offline fox

  • Member
  • Master
  • *
  • Posts: 2083
Re: Careful with autoremove!
« Reply #5 on: January 16, 2022, 10:37:35 pm »
Correct, these programs weren't installed through apt.
Ubuntu 22.04 on 2019 5k iMac
Ubuntu 20.04 on Dell XPS 13 2 in 1

Offline ssfc72

  • Member
  • Master
  • *
  • Posts: 1952
Re: Careful with autoremove!
« Reply #6 on: January 17, 2022, 02:16:40 am »
Yes, on this notebook computer, I am running Linux Mint.


Are you using Mint? Because Mint will roll several packages into what is counted as a single update. For example, it might say there are 5 updates available and show them but when run at the command-line with apt, it might say 8 because Mint rolls several packages that work together as one update. I'm wondering if the same thing is happening here. When it happens next time, see if you can note what packages were removed vs. how many were listed.
Mint 19.1 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MX Linux)
Cellphone Samsung A50, PCMobile pay as you go

Offline Jason

  • Administrator
  • Master
  • *****
  • Posts: 4039
  • Humanist. Skeptic. Husband.
Re: Careful with autoremove!
« Reply #7 on: January 17, 2022, 01:51:42 pm »
Then I do think it might have something to do with that. I'll try to keep an eye open the next few times I use autoremove on Linux Lite.
"With all its sham, drudgery, and broken dreams, it is still a beautiful world." - Max Ehrmann, Desiderata