Score:0

'sudo apt autoremove' breaks the GNOME desktop

nl flag

I'm running Ubuntu 20.04.3 LTS on a Lenovo ThinkPad W541 mobile workstation. This machine has both Intel Integrated Graphics and an NVIDIA Quadro KD1200 GPU. Everything works fine except for the following:

When I upgrade my packages with 'sudo apt upgrade', it does so successfully but also informs me that many packages which were previously automatically installed are no longer required and can be removed with 'sudo apt autoremove'. When I execute this command, it removes the unwanted packages ok. On the next boot however, GNOME fails to come up, instead the system 'hangs' on a blank screen with a flashing white cursor at the upper left corner of the screen.

output of 'sudo apt upgrade' command

Fortunately, I am able to [Ctrl][Alt][F1] into a terminal session from the blank screen, login and run 'sudo timeshift --restore' to bring back the system to a previous state using a timeshift snapshot stored on my external USB drive. After the timeshift restore, the system reboots normally, albeit with the unwanted packages back in there.

How can I clean up my system from unneeded packages without breaking GNOME in the process?

Regards, jonnym

Organic Marble avatar
us flag
Most of these are video driver related and it seems that you actually do need them. You could just mark these packages as manually installed, and then it won't remove them. It appears that some virtual package that all these things depend on got removed, so they have no anchor in the package system. You didn't perchance remove one of those `nvidia-drivers` "transitional packages" did you?
guiverc avatar
cn flag
The `sudo apt autoremove` is not breaking your desktop; you've added packages prior to this that *broke* your desktop, with the problem being *kicked down the road* until the autoremove is performed... ie. prior actions are the cause & your actual issue. You should correct your prior package installs of which you gave no details.
user10489 avatar
in flag
If in doubt, install ubuntu-desktop which depends on lots of gnome pieces including the ones you list. If gnome-desktop is already there, then there are probably newer versions of the ones you list, so it is actually safe to remove them.
johnnym avatar
nl flag
@Organic Marble: This sounds like a great idea. How would I mark those packages as manually installed? Sorry, new to Linux from Windows.
johnnym avatar
nl flag
@guiverc: Sorry, new to Linux. You are suggesting that I added packages previously which broke the desktop. The desktop worked ok after applying any new packages; this problem would not show during reboots even after an 'sudo apt autoremove'. I'm not aware of specific packages that I added which would cause this problem now. I always promptly apply new updates when notified by the system as presumably they are needed. This Ubuntu was installed with the default options on this machine. I don't know how to identify the prior packages I might have installed to which you are referring...
johnnym avatar
nl flag
@user10489: This seems like a big step and with me being new to Linux, I am a bit reluctant to reinstall the whole desktop component. I will try to narrow down which specific package being removed breaks the desktop by removing one-by-one and rebooting. If the system breaks, I can restore it and try again.
guiverc avatar
cn flag
`apt autoremove` just cleans up packages marked for deletion/removal in prior commands; it does not & cannot decide to remove any that weren't already marked for removal - it just performs the removal tasks that were scheduled by prior `apt remove` or `apt purge` commands. You can search your `apt` logs for clues on what command caused it (ie. `/var/log/apt/history.log `) but `autoremove` is just cleaning stuff prior command marked for removal.
guiverc avatar
cn flag
FYI: A `sudo apt install ubuntu-desktop` is not a dangerous command; is often used to fix things (or `apt install --reinstall` as it's fast.. yeah less precise that specific packages, but also avoids marking packages as *manually installed* if they weren't marked that way... (*my opinion anyway*)
Organic Marble avatar
us flag
If you wish to mark them as manually installed there are several ways. Try searching here and on unix&linux stack to find one you like. Here is one such question https://superuser.com/questions/51158/in-ubuntu-debian-how-do-i-mark-a-package-as-non-auto-removable Not sure the accepted answer is the best though, which is why I suggest doing some searching.
user10489 avatar
in flag
`apt install ubuntu-desktop` does not reinstall your desktop unless you removed it. Normally it would do nothing except make sure that `ubuntu-desktop` was marked as manually installed. At worst, it would add the gnome desktop when you already had kubuntu or something.
johnnym avatar
nl flag
Thanks @guiverc, I tried both commands but they did not do anything... I will try the article you sent to mark them as non-autoremovable.
guiverc avatar
cn flag
FYI: You asked the `apt-mark` question of another user, so I didn't respond to that, or provide any links on using `apt-mark` etc. (I may have mentioned *manually installed* & used like language, but only as it was somewhat relevant to what I was saying & the topic)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.