Is there a way to transition from Linux Mint with Mate desktop to Ubuntu MATE without re-install?

Brief history: For variety of reasons, I had transitioned back then from Ubuntu desktop with Gnome 2.0 to Ubuntu XFCE (got sick from Gnome 3), then to Cinnamon desktop environment, which somehow pushed me into Linux Mint world. And then I got Mate desktop which seems to be what I needed for time being. Only Linux Mint turns out to be rather what I'd like to get rid off.

Now the challenge is I have a dev environment. And while I do keep backups, I'd like to transition to Ubuntu back without full re-install and restore.

The switch between stock Ubuntu and e.g. Xubuntu looks simple - just switch apt sources set and let apt do the business. But Linux Mint has some more hooks for "calculations" of URLs and paths. So the darn thing does not let me go back, or at least I perceive it so. I tried to find existing howto to no avail.

Any personal experience would be great, but what I need is a set of steps which describes what to do, at least minimal guidance about pitfalls and (optionally) some hints more about apt under-the-hood changes which do not let me go off now.


Solution 1:

Assuming that the development environment is somewhere in your home directory, here is what I would try. Please note, I haven't tried this myself so this comes with absolutely no warranty. In short, I would install Ubuntu with MATE in another partition, then install any packages that you have installed in Mint, and reuse your current home directory in the new system.

More in detail:

  1. in your current system, get the list of installed packages in a form usable by dpkg --set-selections:

    apt-mark showmanual | sed -e 's/$/ install/' > pkgs.txt
    

    (this gets you only the list of packages that you manually installed; I believe that this should be good enough, or you can get the list of every installed package with dpkg --get-selections '*' > pkgs.txt).

  2. Install Ubuntu on a new partition.

  3. Install MATE:

    sudo apt-get install mate-core
    

    for a minimal MATE desktop or

    sudo apt-get install mate-desktop-environment
    

    for the complete MATE desktop.

  4. Reuse your home from Mint. You can do this by just copying it all over, or (with a minimal risk of having it somehow altered by the new system) mount it directly into the new system by editing the /etc/fstab in Ubuntu and adding this lines:

    /dev/disk/by-uuid/<uuid-of-mint-part> /mnt/mint auto nosuid,nodev,nofail,user,exec 0 0
    /mnt/mint/home/<user>   /home/<user> none bind
    

    where you can use the blkid /dev/<mint-partition> command to find out should find out the UUID of the mint partition. Also remember to create the /mnt/mint directory because I believe that it must exist in order for the mount to succeed.

  5. Reboot (into Ubuntu again); when the system comes up, your home directory should be the one you have in Mint.

  6. Install the extra packages you had installed in Mint: copy the pkgs.txt file you created in step 1 into the new system, and from there issue the commands:

    sudo dpkg --set-selections < selection.txt
    sudo apt-get -u dselect-upgrade
    

If everything works out as expected, and you used the "bind mount" trick for your home, you could move it for good into the new location, and then delete your Mint partition.

Solution 2:

Use at your own risk. Some working knowledge of the command-line etc is necessary. Until this gets enough upvotes for community verification, you should also be able to repair a broken system, etc).

To install on the same partition. (Best use the command-line for this, as you switch the GUI on-the-fly: do Ctrl-Alt-F1 f.ex. to switch to a console)

  1. install some ubuntu-derivative, (here f.ex. lubuntu)

    sudo apt install lubuntu-desktop
    

    confirm when the system asks you if you want to replace mdm with lightdm. Use

    sudo apt install ubuntu-mate-core
    

    for Mate, instead, as described at How do I install MATE (the desktop environment)? (mine).

  2. if you do not want to reboot (no need to, but maybe easier), you can use the steps

    sudo service mdm stop
    sudo service lightdm start
    

    to switch window managers etc.

  3. to make the system aware that it is Ubuntu, not Mint, you need to change the file /etc/lsb-release (at least) To do this, you should be able to (this did not work out-of-the-box for me, so please correct if broken)

    sudo apt purge mintsystem
    sudo apt reinstall base-files
    

    Somehow yet, this did not replace the files /etc/lsb-release, /etc/issue and /etc/issue.net, so you might need to replace by hand

    dpkg-deb -x /var/cache/apt/archives/base-files* /tmp/
    cp /tmp/etc/{lsb-release,issue,issue.net} /etc
    
  4. sources.list

    The main answer at How do I restore the default repositories? was a bit hard, so just go to https://repogen.simplylinux.ch/, recreate sources.list file, replace /etc/apt/sources.list and remove /etc/apt/sources.list.d/official...

    apt purge mintsources
    
  5. this gets you started. It might be that you want to remove some additional packages along the way. All feedback for this solution is appreciated (it was a bit rough when I tried it, but it should work for you.)