Currently I have installed Kubuntu 18.04.2 and I want to switch to Ubuntu Mate (the same version) but I want to keep my programs installed. Is there a way to keep the programs that I have installed or do I have to format my HDD?
-
1Default packages are a lot different. But you can export a list of installed apps. https://askubuntu.com/questions/17823/how-to-list-all-installed-packages You may want to manually edit out old kernels and anything you do not want but never removed. Your settings and files are in /home. If a separate partition, but sure to add it during install, but DO NOT format it. If not separate partition you will have to restore from your backup. (You do have backups?). – oldfred May 10 '19 at 20:25
2 Answers
You don't have to reinstall to switch to Mate.
Simply do a
sudo apt install ubuntu-mate-desktop
This will install the Ubuntu Mate Desktop to your computer.
If you want to remove some packages that is needed by kubuntu-desktop
, but not ubuntu-mate-desktop
the following commands will take care of that:
apt-cache depends kubuntu-desktop | grep -E "(Depends|Recomends)" | cut -d ':' -f 2 | xargs sudo apt-mark auto
This sets all packages recomended by kubuntu-desktop
to automatically installed, and thus harvestable by apt autoremove
.
Next, set all packages needed for ubuntu-mate-desktop
as manually installed, and run the uninstall:
apt-cache depends ubuntu-mate-desktop | grep -E "(Depends|Recomends)" | cut -d ':' -f 2 | xargs sudo apt-mark manual
sudo apt remove kubuntu-desktop
sudo apt autoremove
I have tested this, and it appears to have no ill effects. It doesn't uninstall that much since everything installed by the installer is marked as manually installed, but it removes some, and at least removes some manual flags.
The over all extra disk use from installing mate was pretty exactly 1GiB on a stock 18.04.2 install. If this is acceptable to you, you may keep both environments.

- 22,691
-
• The original flavor is Kubuntu, not Ubuntu. In any case, ubuntu-desktop and kubuntu-desktop are metapackages. Purging or removing them won't remove the packages they specify. Please see my answer here. • In any case, I hope the poster has backed up all personal data! – DK Bose May 11 '19 at 01:51
-
-
@DKBose Autoremove will remove packages that is installed as dependencies of other packages. – vidarlo May 11 '19 at 07:13
-
just in case I was wrong, I installed xubuntu-desktop on Lubuntu 18.04. Rebooted into a Xubuntu session, ran
sudo apt purge lubuntu-desktop
followed bysudo apt autoremove
. The result is in this image. May I ask if you've verified practically what you've suggested in your answer? – DK Bose May 11 '19 at 08:33 -
No, I have not. But packages that are automatically installed due to dependencies should be uninstalled by an autoremove. Your result is interesting, and I may do a test later :) – vidarlo May 11 '19 at 09:22
-
1There are some applications, which when one wants to delete them, threaten to delete the corresponding desktop metapackage. That generally worries new users. The Ubuntu Community wiki has this in the section titled Creating Metapackages: "So, when a metapackage is automatically removed by the removal or purging of any one, or more, of its underlying dependencies, all of the other packages that were in the metapackage's depends list are still installed on the system." – DK Bose May 11 '19 at 09:33
-
2This answer explains why I'm wrong. I was not aware that the installer marks packages as manually installed. – vidarlo May 11 '19 at 09:37
-
You can build a list of all the packages you have installed with the command:
sudo dpkg --get-selections > package.list
And to restore the packages use:
sudo dpkg --set-selections < package.list
sudo apt-get dselect-upgrade

- 22,691

- 3,339