• Welcome to Peterborough Linux User Group (Canada) Forum.
 

Careful with autoremove!

Started by fox, January 16, 2022, 07:59:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fox

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:
sudo apt autoremove
I 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.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

ssfc72

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 20.3 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MXLinux)
Cellphone Samsung A50, Koodo pre paid service

fox

Quote from: ssfc72 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.
....
Oops, my mistake. A kernel takes up less than 0.5 Gig. I corrected the error.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

Jason

Quote from: ssfc72 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??

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.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

Jason

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.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13

fox

Correct, these programs weren't installed through apt.
Ubuntu 24.10 on 2019 5k iMac
Ubuntu 24.04 on Dell XPS 13

ssfc72

Yes, on this notebook computer, I am running Linux Mint.


Quote from: Jason on January 16, 2022, 08:29:38 PM
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 20.3 on a Dell 14" Inspiron notebook, HP Pavilion X360, 11" k120ca notebook (Linux Lubuntu), Dell 13" XPS notebook computer (MXLinux)
Cellphone Samsung A50, Koodo pre paid service

Jason

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.
* Zorin OS 17.1 Core and Windows 11 Pro on a Dell Precision 3630 Tower with an
i5-8600 3.1 GHz 6-core processor, dual 22" displays, 16 GB of RAM, 512 GB Nvme and a Geforce 1060 6 GB card
* Motorola Edge (2022) phone with Android 13