3

Ubuntu is great and thus I installed it in my father's computer. But the computer is quite old and Ubuntu was becoming slower after every upgrade (now it's on version 18.04 LTS). Thus I installed Lubuntu on top of it. Now he just uses Lubuntu and he's quite happy about it.

How can Ubuntu be removed from a computer which has both Ubuntu and Lubuntu? They are both in the same partition.

13
  • 1
    Did you installed both in same partition or different partitions? – MOHSIN SHAHZAD Dec 25 '20 at 20:44
  • You'll need to clarify "on top of it". To me that implies you've just run sudo apt install lubuntu-desktop and added the Lubuntu desktop to your existing machine, and you want to just remove the GNOME/Ubuntu desktop options at login. It however could also mean you've a dual boot system, and you're asking how to remove the second installed OS; currently it's unclear. What do you mean by "on top of it"? (those two options have very different fixes) – guiverc Dec 25 '20 at 21:13
  • 1
    My workstation was an initial Ubuntu Desktop install; I added ubuntu-mate-desktop, xubuntu-desktop and lubuntu-desktop. I recently needed disk space, and decide a quick fix was to remove ubuntu-mate-desktop (my least used) so for me it was just a sudo apt remove ubuntu-mate-desktop. I of course read the packages that were going to be removed; saw no negative consequences (but would have corrected any if there) & it ran. My MATE/Ubuntu-MATE option is now gone. Is this what you mean? – guiverc Dec 25 '20 at 21:16
  • 1
    A sudo apt remove ubuntu-desktop will just remove a tiny metapackage designed to pull in all packages deemed essential for the desktop. Even a sudo apt autoremove afterwards will not remove most of the actual packages. Without a list if actually installed packages, you cannot automatically remove an installed desktop granularity. – vanadium Dec 26 '20 at 10:11
2

As I alluded to on Ask Ubuntu, I would expect a simple

sudo apt remove ubuntu-desktop

To do what you want. I haven't done that recently on a 18.04 Ubuntu base install with another desktop added, so without testing I can't be sure if any problems are to be expected. I wouldn't expect any (results may differ depending on changes you've made however).

As I also stated on Ask Ubuntu I'd type the command and scan the output of packages to be removed looking for any potential problems (not expecting any, but better safe than sorry), then proceed. If I noted any, I'd fix them by a sudo apt install either before the ubuntu-desktop removal (which will cause package(s) to be marked as manually installed; thus they'll remain), OR after it (same end effect, after the remove it may require the package to be re-downloaded being the difference; tiny bandwidth hit)

For years all my installs were Ubuntu desktop, with my wanted desktop added later as my ISP allowed bandwidth quota free download of Ubuntu ISOs only, updated packages were also quota free so adding lubuntu-desktop (etc) afterwards used none of my monthly bandwidth quota. They no longer offer this so I no longer do it this way.

If you're worried about the effect, I'd install Ubuntu Desktop on a VM, apt install lubuntu-desktop, reboot the VM, then do the sudo apt remove lubuntu-desktop, restart the VM and look for ill effects; I wouldn't expect any, but currently I'm unwilling to do that test.

this answer was written first on discourse.ubuntu.com, thus the references to this site in my wording

3
  • ps: I didn't mention sudo apt autoremove to remove previously installed dependencies that are no longer required (related to the GNOME desktop); I run it daily anyway (I use hirsute or the development release), so I didn't think of it sorry. – guiverc Dec 26 '20 at 11:42
  • Removing merely the metapackage for the desktop environment will not remove the desktop, even if you have it followed by an autoremove. – vanadium Dec 26 '20 at 14:04
  • It'll leave behind some configs etc, but I don't see that as an issue (neither the plymouth screen I see as wallpaper (of no importance, though yeah I know users here raise questions about it being left behind quite often). The apt remove ubuntu-mate-desktop removed MATE programs on my box. – guiverc Dec 26 '20 at 21:20
5

You can try this

Start in text-only mode

Switch on your computer. Wait until the BIOS has finished loading, and press and hold Shift, which will bring up the Grub menu.
Select the line which starts with Advanced options.
Select the line ending with (recovery mode)
Press Return and your machine will begin the boot process.
After a few moments, your PC should display a menu with a number of options, including Drop to root shell prompt. Press Return with this option highlighted.
The PC will start in a terminal.

Run these commands:

Mount partitions in read-write mode

mount -o remount,rw /
mount --all

Update repositories

apt-get update

Install aptitude and deborphan

apt-get install --reinstall aptitude deborphan

Eliminate the components of gnome that are not necessary in lubuntu

aptitude remove '?and(?reverse-depends(gnome),?not(?reverse-depends(?exact-name(lubuntu-desktop))))'

Reinstall lubuntu-desktop

apt-get install --reinstall lubuntu-desktop

Eliminate orphan packages

deborphan
apt-get --purge remove $(deborphan)
deborphan --libdevel
apt-get --purge remove $(deborphan --libdevel)
deborphan --find-config
dpkg --purge $(deborphan --find-config)

Remove unnecessary packages

apt-get autoremove

Remove downloaded packages

apt-get clean

Restart system

reboot
7
  • That's a great answer! – marc-andre benoit Dec 25 '20 at 21:57
  • 3
    Looks dangerous! A little mistake can ruin the system. – Akib Azmain Dec 26 '20 at 5:53
  • @Akib Azmain: What part of the operating system do you think is affected, it is just a matter of removing the desktop environment? – kyodake Dec 26 '20 at 13:48
  • From your shell commands, I think you are instructing aptitude to remove all packages on which GNOME depends. But what for packages on which both GNOME and system packages (e.g command-line applications) depends? Wouldn't they be removed too, with a large number of packages depending on them? – Akib Azmain Dec 26 '20 at 14:12
  • @AkibAzmain: only the Gnome packages are removed keeping the packages that may be required by Lxde, however before restarting, lubuntu-desktop is reinstalled – kyodake Dec 26 '20 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.