8

I have installed Linux Mint and now I want to change it to Ubuntu but I have a lot of apps and information on it.

Is there any way to get Ubuntu without losing data? Or how to back up my information and apps, then install a fresh Ubuntu and copy the backup on it?

Melebius
  • 11,431
  • 9
  • 52
  • 78
Ashkan
  • 183
  • 1
  • 1
  • 3
  • 4
    Welcome to Ask Ubuntu. I firstly make a list of installed packages (dpkg -l). How you backup is up to you; me I cp (or rsync my data to remote (nfs) storage, making copies on two devices). Then I boot the Ubuntu ISO of what I want to install; select 'try' & ensure it runs okay, then click 'install'. Here I'd suggest using "Something else" & select partitions (what you've already got & use) ensuring you don't have 'format' selected) and let it install. It should recognize the pre-Ubuntu(-like) system & try and restore the programs already installed, and you're done (after reboot)... – guiverc Jul 23 '18 at 05:09

3 Answers3

8

TL;DR It is possible, but very difficult.

The method below is presented without any warranty. Use it on your own risk.

LinuxMint MATE 18.3 (Sylvia) -> Ubuntu Xenial Xerus 16.04 LTS

I have had installed LinuxMint MATE 18.3 (Sylvia). I asked myself a question - is it possible to convert it to normal Ubuntu Xenial Xerus 16.04 LTS without reinstallation?

I found great answer with script for listing packages from known repository. I adapted it to my situation:

cat > find_origin.sh << \EOF
LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' | \
fgrep ':install ok installed' | cut -d: -f1 | \
(while read pkg; do inst_version=$(apt-cache policy $pkg \
| fgrep Installed: \
| awk '{ print $2 }'); origin=$(apt-cache policy "$pkg" \
| fgrep " *** ${inst_version}" -C1 \
| tail -n 1 \
| cut -c12-); echo $pkg $origin; done)
EOF

Then ran it to find Mint packages and remove them:

sh find_origin.sh | grep packages.linuxmint.com > mint-packages-all.txt

cat mint-packages-all.txt | grep -v "E:" | grep -v ^bash | grep -v ^base-files | grep -v ^mintsources | grep -v grub > mint-packages-remove.txt

sudo apt-get install aptitude sudo aptitude purge $(cat mint-packages-remove.txt | awk '{print $1}')

sudo sed -i 's/^deb http://packages.linuxmint.com/#deb http://packages.linuxmint.com/g' /etc/apt/sources.list.d/official-package-repositories.list sudo rm /etc/apt/preferences.d/official-package-repositories.pref

Then rebooted and launched Aptitude with sudo aptitude.
Set all packages from Obsolete and Locally Created Packages section to purge.

And checked locally installed package with:

sh find_origin.sh | grep /var

So I reinstalled two packages listed here - bash and base-files from xenial-updates repository from terminal:

sudo apt-get install bash=4.3-14ubuntu1.2 base-files=9.4ubuntu4.7

Then purged all packages that does not have ii state (such as rc) with:

sudo apt-get purge $(dpkg -l | grep -v ^ii | tail -n +6 | awk '{print $2}')
sudo apt-get install linux-image-generic linux-headers-generic
sudo apt-get purge linux-image-4.10.0-*-generic linux-headers-4.10.0-*-generic
sudo locale-gen en_US.UTF-8

Remove Mint files from home directory:

rm -rf ~/.linuxmint/

Check system integrity with debsums:

sudo apt-get install debsums
sudo debsums_init
sudo debsums -a -c # carefully check all files listed here with `dpkg -S filepath`

sudo apt-get install --reinstall cups-filters gnome-accessibility-themes im-config imagemagick sound-theme-freedesktop imagemagick-6.q16 libreoffice-draw libreoffice-math gnome-colors-common vino gnome-orca sudo apt-get -o Dpkg::Options::="--force-confask" install --reinstall acpid libcompizconfig0 mate-menus systemd xdg-user-dirs-gtk vino # select Y

Then I checked system for files, that are not from Ubuntu repositories:

sudo find /bin /etc /lib /lib64 /opt /sbin /srv /usr /var -type f -exec dpkg -S {} \; 2> ~/Desktop/results.out

Removed the following objects:

sudo rm -rf /etc/linuxmint
sudo rm /usr/lib/python2.7/dist-packages/oneconf/distributor/LinuxMint.pyc

And finally installed Ubuntu MATE desktop:

sudo apt-get install ubuntu-mate-desktop^

Reboot and I have nearly normal Ubuntu Xenial 16.04 LTS :)

LinuxMint MATE 19 (Tara) -> Ubuntu Bionic Beaver 18.04 LTS

Warning: this method was not tested. Based on 18.3 -> 16.04 LTS above.

Let's do a listing of packages from known repository:

cat > find_origin.sh << \EOF
LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' | \
fgrep ':install ok installed' | cut -d: -f1 | \
(while read pkg; do inst_version=$(apt-cache policy $pkg \
| fgrep Installed: \
| awk '{ print $2 }'); origin=$(apt-cache policy "$pkg" \
| fgrep " *** ${inst_version}" -C1 \
| tail -n 1 \
| cut -c12-); echo $pkg $origin; done)
EOF

Find Mint packages and remove them:

sh find_origin.sh | grep packages.linuxmint.com > mint-packages-all.txt

cat mint-packages-all.txt | grep -v "E:" | grep -v ^bash | grep -v ^base-files | grep -v ^mintsources | grep -v grub > mint-packages-remove.txt

sudo apt-get install aptitude sudo aptitude purge $(cat mint-packages-remove.txt | awk '{print $1}')

sudo sed -i 's/^deb http://packages.linuxmint.com/#deb http://packages.linuxmint.com/g' /etc/apt/sources.list.d/official-package-repositories.list sudo rm /etc/apt/preferences.d/official-package-repositories.pref

Launch Aptitude with sudo aptitude.
Set all packages from Obsolete and Locally Created Packages section to purge.

Check locally installed packages with:

sh find_origin.sh | grep /var

Reinstall two (maybe more!) packages listed here - bash and base-files from bionic-updates repository from terminal:

sudo apt-get install bash=4.4.18-2ubuntu1 base-files=10.1ubuntu2.1 desktop-file-utils=0.23-1ubuntu3.18.04

Then purge all packages that does not have ii state (such as rc) with:

sudo apt-get purge $(dpkg -l | grep -v ^ii | tail -n +6 | awk '{print $2}')
sudo apt-get install linux-image-generic linux-headers-generic
sudo locale-gen en_US.UTF-8

Remove Mint files from home directory:

rm -rf ~/.linuxmint/

Check system integrity with debsums:

sudo apt-get install debsums
sudo debsums_init
sudo debsums -a -c # carefully check all files listed here with `dpkg -S filepath`

sudo apt-get install --reinstall caja casper compton cups-filters engrampa gnome-icon-theme gnome-accessibility-themes im-config imagemagick libgs9 mate-desktop mate-icon-theme mate-screensaver mate-screensaver-common mate-system-monitor mate-utils openjdk-11-jre sound-theme-freedesktop imagemagick-6.q16 libreoffice-draw libreoffice-math gnome-colors-common vino gnome-orca sudo apt-get -o Dpkg::Options::="--force-confask" install --reinstall acpid libcompizconfig0 mate-menus systemd xdg-user-dirs-gtk vino # select Y

Then check system for files, that are not from Ubuntu repositories:

sudo find /bin /etc /lib /lib64 /opt /sbin /srv /usr /var -type f -exec dpkg -S {} \; 2> ~/Desktop/results.out

Remove the following objects (may be other!):

sudo rm -rf /etc/linuxmint
sudo rm -rf /usr/lib/linuxmint
sudo rm /usr/lib/python2.7/dist-packages/oneconf/distributor/LinuxMint.pyc

And finally install Ubuntu MATE desktop:

sudo apt-get install lightdm-gtk-greeter ubuntu-mate-lightdm-theme ubuntu-mate-themes ubuntu-mate-wallpapers* ubuntu-mate-core ubuntu-mate-default-settings ubuntu-mate-artwork ubuntu-mate-icon-themes plymouth-theme-ubuntu-mate-logo plymouth-theme-ubuntu-mate-text grub2-themes-ubuntu-mate mate-tweak ubuntu-mate-guide caja-eiciel compiz-mate eom mate-accessibility-profiles mate-applet-appmenu mate-applet-brisk-menu mate-calc mate-dock-applet mate-hud mate-menu mate-netbook mate-optimus mate-user-guide mate-window-applets-common mate-window-buttons-applet mate-window-menu-applet mate-window-title-applet folder-color-caja deja-dup-caja gsettings-ubuntu-schemas indicator-messages indicator-power indicator-session indicator-sound brasero shotwell simple-scan smbclient ubuntu-standard vlc gdebi gdebi-core plank seahorse tilda sessioninstaller

Reset MATE desktop settings to the defaults:

dconf reset -f /org/mate
gsettings set org.mate.panel default-layout "'default'"

Install MATE Welcome and Software Boutique as Snaps:

snap install software-boutique --classic
snap install ubuntu-mate-welcome --classic

Reboot and have nearly normal Ubuntu Bionic 18.04 LTS :)

LinuxMint MATE 20 (Ulyana) -> Ubuntu Focal Fossa 20.04 LTS

Let's do a listing of packages from known repository:

cat > find_origin.sh << \EOF
LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' | \
fgrep ':install ok installed' | cut -d: -f1 | \
(while read pkg; do inst_version=$(apt-cache policy $pkg \
| fgrep Installed: \
| awk '{ print $2 }'); origin=$(apt-cache policy "$pkg" \
| fgrep " *** ${inst_version}" -C1 \
| tail -n 1 \
| cut -c12-); echo $pkg $origin; done)
EOF

Find Mint packages and remove them:

sh find_origin.sh | grep packages.linuxmint.com > mint-packages-all.txt

cat mint-packages-all.txt | grep -v "E:" | grep -v ^bash | grep -v ^base-files | grep -v ^mintsources | grep -v grub > mint-packages-remove.txt

sudo apt-get install aptitude sudo aptitude purge $(cat mint-packages-remove.txt | awk '{print $1}')

sudo sed -i 's/^deb http://packages.linuxmint.com/#deb http://packages.linuxmint.com/g' /etc/apt/sources.list.d/official-package-repositories.list sudo rm /etc/apt/preferences.d/official-package-repositories.pref

Launch Aptitude with sudo aptitude.
Set all packages from Obsolete and Locally Created Packages section to purge.

Check locally installed packages with:

sh find_origin.sh | grep /var

Reinstall two (maybe more!) packages listed here - bash and base-files from focal-updates repository from terminal:

sudo apt-get install base-files=11ubuntu5 xapps-common=1.6.10-2

Then purge all packages that does not have ii state (such as rc) with:

sudo apt-get purge $(dpkg -l | grep -v ^ii | tail -n +6 | awk '{print $2}')
sudo apt-get install linux-image-generic linux-headers-generic
sudo locale-gen en_US.UTF-8

Remove Mint files from home directory:

rm -rf ~/.linuxmint/

Check system integrity with debsums:

sudo apt-get install debsums
sudo debsums_init
sudo debsums -a -c # carefully check all files listed here with `dpkg -S filepath`

sudo apt-get install --reinstall caja casper compton cups-filters engrampa gnome-icon-theme gnome-accessibility-themes im-config imagemagick libgs9 mate-desktop mate-icon-theme mate-screensaver mate-screensaver-common mate-system-monitor mate-utils openjdk-11-jre sound-theme-freedesktop imagemagick-6.q16 libreoffice-draw libreoffice-math gnome-colors-common vino gnome-orca adwaita-icon-theme-full info sudo apt-get -o Dpkg::Options::="--force-confask" install --reinstall acpid libcompizconfig0 mate-menus systemd xdg-user-dirs-gtk vino casper # select Y

Then check system for files, that are not from Ubuntu repositories:

sudo find /bin /etc /lib /lib64 /opt /sbin /srv /usr /var -type f -exec dpkg -S {} \; 2> ~/Desktop/results.out

Remove the following objects (may be others!):

sudo rm -rf /etc/linuxmint
sudo rm -rf /usr/lib/linuxmint
sudo rm /usr/lib/python3/dist-packages/__pycache__/mintreport.cpython-38.pyc

And finally install Ubuntu MATE desktop on first login:

sudo apt-get install lightdm-gtk-greeter ubuntu-mate-lightdm-theme ubuntu-mate-themes ubuntu-mate-wallpapers* ubuntu-mate-core ubuntu-mate-default-settings ubuntu-mate-artwork ubuntu-mate-icon-themes plymouth-theme-ubuntu-mate-logo plymouth-theme-ubuntu-mate-text grub2-themes-ubuntu-mate mate-tweak ubuntu-mate-guide caja-eiciel compiz-mate eom mate-accessibility-profiles mate-applet-appmenu mate-applet-brisk-menu mate-calc mate-dock-applet mate-hud mate-menu mate-netbook mate-optimus mate-user-guide mate-window-applets-common mate-window-buttons-applet mate-window-menu-applet mate-window-title-applet folder-color-caja deja-dup-caja gsettings-ubuntu-schemas indicator-messages indicator-power indicator-session indicator-sound brasero shotwell simple-scan smbclient ubuntu-standard vlc gdebi gdebi-core plank seahorse tilda

Reset MATE desktop settings to the defaults:

dconf reset -f /org/mate
gsettings set org.mate.panel default-layout "'default'"

Install MATE Welcome and Software Boutique as Snaps:

sudo snap install software-boutique --classic
sudo snap install ubuntu-mate-welcome --classic

Reboot and have nearly normal Ubuntu Focal 20.04 LTS :)

N0rbert
  • 99,918
  • which part change in order to have Ubuntu 18.04? some package version, or need to add other package? – damadam Jul 23 '18 at 09:40
  • I created Mint 19 -> to Ubuntu 18.04 part of the answer. This method was not tested. If you want you can test it, but do not forget to backup all your data. – N0rbert Jul 23 '18 at 09:50
  • I found that find_origin.sh script didn't result in a list of specific mint packages but was empty. Then I noticed that my system was set up using a mirror instead of packages.linuxmint.com You'll probably need to check /etc/apt/sources.list.d/official-package-repositories.list to be sure what hostname to use. – Roberg Aug 20 '20 at 11:21
0

1) Backup to an external drive your applications to a list in a text file which you'll need later, and follow this method when it comes to restoring them on Ubuntu.

2) Backup to an external drive your data using rsync, or it's GUI equivalent Grsync command.

3) Back up to an external drive your home directory (again withrsync). This is more tricky to restore on Ubuntu as you'll need to find the UUID after Ubuntu installation and ensure it's correctly entered in the fstab file, or it won't mount at boot-up.

4) You can also back up all Debian repositories. I understand Mint uses the same ones as Ubuntu (except Canonical). These will be restored in the /etc/apt folder.

5) Install Ubuntu from Live UFD, making partitions for home, swap, and root. Restore home folder contents to newly made home partition and check UUID configuration in fstab as in 3). You will likely have to make a new entry for it. Restore apps and data files as in 1 - 2.

Paul Benson
  • 1,022
0

I successfully performed steps similar to those described by @N0rbert. In my case turning Mint 18.3 into Ubuntu 16.04 LTS and process went more-less like this:

  1. I commented out packages.linuxmint.com repo from /etc/apt/preferences.d/official-package-repositories.pref

  2. apt update && apt upgrade

  3. apt remove --purge *mint*, confirm if it complains about removing mintsystem and synaptic

  4. I did install apt install bash=4.3-14ubuntu* base-files=9.4ubuntu*

  5. At this point lsb_release -a should already show Ubuntu. Removing mintsystem was likely to be broken, do this:

    update-rc.d -f mintsystem remove
    rm /var/lib/dpkg/info/mintsystem.postinst
    rm -rf ~/.linuxmint/
    sudo rm -rf /etc/linuxmint
    sudo rm /usr/lib/python2.7/dist-packages/oneconf/distributor/LinuxMint.pyc
    dpkg --purge mintsystem
    
  6. Then for upgrade to next Ubuntu version, apt install update-manager-core.

  7. Now you can check for update with do-release-upgrade -c and update with do-release-upgrade. The updater should fix anything that's been left broken. For me it worked 100% fine, but before upgrading I've also removed everything I could find related to desktop environment, since I wanted to convert it to a server-exclusive machine.

Note: if along the way apt suddenly is not found, don't panic! It just changed its path to default. Enter bash and in the new prompt it will work again.

p0358
  • 94