LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Apt Decided to Uninstall 95% of My System -- Why? (https://www.linuxquestions.org/questions/linux-software-2/apt-decided-to-uninstall-95-of-my-system-why-4175648590/)

CajunCoder 02-18-2019 11:13 PM

Apt Decided to Uninstall 95% of My System -- Why?
 
Hi guys.

I've been using Debian, and using the Debian CDROM/DVD .iso's as offline repositories for a system that has only intermittent internet access.

I want to install packages from the local .iso images when offline, and from the official online repositories when online. But, I encountered what appears to be a bug, or user error, but in either case, a very dangerous one:

So, I start off by installing my system from the Debian DVD.iso images, and install additional software this way.

Then, I need a package which is not on the small number of DVD iso's that I've downloaded, so I add an internet repository, run apt update, and while I'm at it, apt-upgrade.

Then later, I comment out the online repository or the DVD repositories, depending on whether I'm online or offline, run apt-get update and install something. This is where the problem happens!

Not always, but sometimes, apt decides that it should remove a whole ton of packages after I comment out a repository. I don't get this. I'm not mixing Stable and Unstable or anything, I'm just switching out repositories. Of course, the online repository is more up-to-date, but... Does using the .iso images mean that once you update from the online repositories, you can't go back? That means that once you do either have to rely on one or the other repository, and that if you ever switch your sources.list to a slightly out of date repo, apt will decide to uninstall your entire system? Am I missing something? This seems a bit extreme. Why can't apt just fall back on older packages for newer installations and keep the installed stuff installed? Why does it go "Oh geez, I don't know where this new version of this thing which is installed (who's older version I know about) came from, so I'm just going to delete it", or at least give me some kind of error before deciding to uninstall 100's or 1000's of packages without my explicit instructions?

How can I do this or something similar without bricking my system again? I'm now deathly afraid of even switching online repositories now for fear that one might be slightly out of date and prompt apt to brick my system.

descendant_command 02-18-2019 11:18 PM

http://forums.debian.net/viewtopic.php?f=16&t=104157

hydrurga 02-18-2019 11:24 PM

Can you please paste your software sources list here.

Do note also that you can run apt-get with the -s switch to simulate an upgrade command without actually doing it.

descendant_command 02-18-2019 11:33 PM

Also, a specific example with apt output would help shed light - it's very difficult to give any type of answer based on your description.
Quote:

Originally Posted by CajunCoder (Post 5963846)
or at least give me some kind of error before deciding to uninstall 100's or 1000's of packages without my explicit instructions?

apt will never remove packages without telling you what it's about to do and asking for confirmation.

CajunCoder 02-19-2019 06:17 PM

Quote:

Originally Posted by descendant_command (Post 5963847)


Thanks! That's really helpful. I didn't realize that meta-packages worked that way.

I still don't get why removing anything from my sources.list would make apt uninstall things, though. Is that how it's supposed to work? I tried commenting out my repos in s virtual machine such that I have no sources, and I couldn't seem to replicate that behaviour.

CajunCoder 02-19-2019 06:23 PM

Quote:

Originally Posted by descendant_command (Post 5963851)
Also, a specific example with apt output would help shed light - it's very difficult to give any type of answer based on your description.
apt will never remove packages without telling you what it's about to do and asking for confirmation.

I think this was due to me running an install script. Even when a script is from a trusted source, they often contain apt commands with the "-y" flag, so while in theory you should always have the chance to review what apt is doing, it's pretty common-place to find scripts with this sort of behaviour.

I do usually glance over scripts before I run them, but it's easy to miss things like that -- and easy to accidentally just press enter and nuke your system if you're not paying attention.

...Yeah, I think I have a new found hatred of meta-packages.

descendant_command 02-19-2019 11:45 PM

Well by running apt commands with -y you have explicitly given it permission to do whatever it’s algorithm deems necessary to achieve your request, without further confirmation.
IMHO this is always a bad idea.

“Install scripts” use it to avoid unwanted ‘interaction’ that their target audience isn’t usually equipped to deal with.
You also have to be aware that the script may not have been designed with your particular system configuration in mind.

Again, by running such scripts, you have given explicit permission for the writer of said script to hose your system for you.

Glad you found that thread helpful - understanding the mechanism is step 1 in the process of making it do exactly what you want.

Metapackages do serve a very useful purpose and remove a lot of tedium tracking down individual packages that you may not even know you need, to supply “expected” functionality.
Once you’re aware of how they work and why, you can easily adjust your system to suit your needs, once you knw exactly what want and don’t want.

ondoho 02-21-2019 06:07 AM

Quote:

Originally Posted by CajunCoder (Post 5963846)
I've been using Debian, and using the Debian CDROM/DVD .iso's as offline repositories for a system that has only intermittent internet access.

...

How can I do this or something similar without bricking my system again? I'm now deathly afraid of even switching online repositories now for fear that one might be slightly out of date and prompt apt to brick my system.

isn't it rather the other way round - the debian .iso is out of date and if ti's the only source for repositories, apt gets confused.
it should really downgrade all these packages back to the original state of your debian .iso, but afaik apt does not have a concept of downgrading, so it just wants to remove lots of stuff.

i know it's possible to configure debian to use offline repositories, and i guess it's possible to configure it in a way that it doesn't break when you upgrade online - but maybe you're doing it wrong?


All times are GMT -5. The time now is 01:54 PM.