Upgrade from LMDE 1 to LMDE 2 (Betsy)

Clem, the fantastic lead programmer behind the Linux Mint project, has written a nice article detailing the process of upgrading your system from LMDE 1 UP8 to LMDE 2 Betsy that I suggest you read first.

In the comments of this article, wilo108 posted the following comment:

Is there all that much value in an upgrade? With a separate home partition, and a list of installed packages (`dpkg –get-selections > installed_packages.txt`) I can have a clean install up-to-speed in a hour or so; I can't help feeling that this would take longer and be more likely to throw up issues I'd have to dig into. Just throwing it out there as an option some folk might consider, if they've not already.

The reflection it brought me to was:
After about two years of happily using LMDE, my system is still running smoothly. Although I know that, here and there, scattered around my system, are some garbage files that I might as well seize the opportunity to get rid of !

I once tried wine on this machine but finally didn't keep it, preferring to go for a VirtualBox solution. I also had a lot of trouble trying to get Skype to work correctly before I gave up, just to name a few of the installations that, in the end, were removed from my system. And although I, each time, made my best to remove them as completely and properly as possible, there are still a lot of those garbage that I see around from time to time.

I know it won't be a snap to move from one system to the other (and re-install everything), but since my /home has it's own partition, it should already be easier… doesn't it?

As always, if you're willing to replicate what is described here below, BE SURE TO BACKUP ALL OF YOUR DATA FIRST !
Some commands used here could COMPLETELY WIPE YOUR HARD DISK, so please read carefully and double check your DEVICES IDs before throwing the commands. It happened to me once, tired in the middle of the night, but I LOST MY MAIN HARD DRIVE DATA, trust me, you don't want this to happen!



As I:

  • Don't expect to have my shinny new LMDE 2 install configured and completed with all applications and utilities that I currently use in LMDE 1 before a few days.
  • Still have a spare 256GB SSD
  • Have my current /home in a separated partition

The safest, fastest and most convenient way I can think of in order to make this LMDE 2 clean switch is to:

  • Keep my current main system SSD (512GB) untouched, so I can switch back to it at boot time and be back in “business as usual”
  • Install a clean LMDE 2 system in a partition on the spare SSD (256GB)
  • Complete the LMDE 2 install with all the necessary applications and utilities


The most straight forward way to install LMDE 2 on our SSD256, which will be hooked to an external USB3 adapter, is to first “burn” a LMDE 2 iso file to a USB Key, ours is a 4GB stick.

Please refer to this tutorial on Linux Mint's community site to get more info on how to “burn” the LMDE 2 iso file to a USB Key.
LMDE 2 iso files are to be found on this page of the Linux Mint website.



Although we don't plan to keep using the SSD256 on the long term, we'll apply a partition scheme that's compatible with a usage as main system drive. One thing to note here maybe is that LMDE 2 has EFI and GPT tables compatibility (as stated by Clem himself in his response to a comment).

As my current machine, a Clevo W150HR, has a BIOS I, fortunately, do not have to care about (U)EFI support and specificity. In case your system has (U)EFI, it is recommended that you refer to http://www.rodsbooks.com/refind/ to learn more about the requirements for multi-booting.

That being said, here is my final SSD256 partitioning scheme:

  • root partition - 19GB - ext4 - boot flag
  • swap partition - 2GB - swap
  • lvm partition - 229GB - lvm2
    • volume group - vg00 - 229GB
      • logical volume - vg00-opt - 10GB
      • logical volume - vg00-home - 202.88GB


Obviously the last point in our installation plan, Complete the LMDE 2 install with all the necessary applications and utilities, is probably the most complicated to achieve. How indeed not to forget some of the packages you installed?
In the Clem's article comment, a suggestion was made to output all the currently installed packages to later reinstall them all in one go:

> dpkg --get-selections > installed_packages.txt

Digging a little on the above suggestion, I was brought to this forum post on Ask Ubuntu, which suggests a much more complete “backup and restore” solution, here is the commands summary:


Installed Packages

backup

> dpkg --get-selections > ~/Package.list
> sudo cp -R /etc/apt/sources.list* ~/
> sudo apt-key exportall > ~/Repo.keys

Restore

> sudo apt-key add ~/Repo.keys
> sudo cp -R ~/sources.list* /etc/apt/
> sudo apt-get update
> sudo apt-get install dselect
> sudo dselect update
> sudo dpkg --set-selections < ~/Package.list
> sudo apt-get dselect-upgrade -y

Settings and Personal Data

With a separated partition

Has I have my /home directory in a separate partition, all I'll have to do is mount this partition as /home in /etc/fstab.
Note that, in my configuration, /opt is also on a separated partition, so it also appears in /etc/fstab:

> sudo nano /etc/fstab

# UNCONFIGURED FSTAB FOR BASE SYSTEM
proc    /proc   proc    defaults        0       0
# /dev/sdc1 [root]
UUID=74f1f74a-25bb-4444-b587-e3679d482938       /       ext4    rw,errors=remount-ro    0       1
# /dev/sdc2 [swap]
UUID=07ca33fa-f4d2-4f94-ab0e-9b63d603555b       swap    swap    sw      0       0
# /dev/sda8 [opt]
UUID=60f6fd48-ac6a-4bee-8e4a-408cfb9e75a5       /opt    ext4    defaults        0       1
# /dev/sda5 [home]
UUID=2d265aa6-e56c-481c-a44e-5e5d69f4cd39       /home   ext4    defaults        0       1

To apply the changes made to /etc/fstab it's recommended to reboot (as your /home directory is concerned).

It is always safer to reference your partition using their UUID, this avoids any possible confusion in case your hard drive would get mounted under another reference. This is particularly true when using external USB devices.
To find out what's the UUID of your partition, use the lsblk command, note that you have to use sudo to access the devices UUIDs:

> sudo lsblk -f

NAME          FSTYPE      LABEL    UUID                                   MOUNTPOINT
sda                                                                       
|-sda1        ext4        EFI-boot 79cf031a-dcdf-4b94-90c5-80f90a35c9a0   
|-sda2        ext4                 6f90c930-8e1d-49ab-8eda-b6302ed883b7   
|-sda3                                                                    
|-sda5        ext4        home     2d265aa6-e56c-481c-a44e-5e5d69f4cd39   /home
|-sda6        ext4        var      f9967fb4-d1f7-4ef8-9fe7-3b9e0abdd024   
|-sda7        ext4        tmp      01467053-9441-4c02-8b93-f6f832894965   
`-sda8        ext4        opt      60f6fd48-ac6a-4bee-8e4a-408cfb9e75a5   /opt
sdb                                                                       
|-sdb1        ext4                 74f1f74a-25bb-4444-b587-e3679d482938   /
|-sdb2        swap        swap     07ca33fa-f4d2-4f94-ab0e-9b63d603555b   [SWAP]
`-sdb3        LVM2_member          iPczLk-BV7W-ONO8-Ttl6-106n-qY55-jStvHq 
  |-vg00-opt                                                              
  `-vg00-home                                                             
sr0

Without a separated partition

Make sure your new /home partition is big enough to receive all data from your “old” one. Otherwise you will not be able to transfer some files to the newly created partition.

I'd recommend you first partition your target disk, creating a separated /home partition, possibly using LVM, ending with a partition scheme as follow:

sdb                                                                       
|-sdb1        ext4                 
|-sdb2        swap        swap     
`-sdb3        LVM2_member           
  |-vg00-opt                                                              
  `-vg00-home

Then mount the /home partition

> sudo mkdir /tmp/home2
> sudo vgscan
> sudo vgchange -a y
> sudo mount /dev/vg00/home /tmp/home2

Now duplicate all content from the “old” /home to the new one.

> sudo rsync --progress /home/<username> /tmp/home2/

This may take a while depending on the volume of the /home directory, but you'll end up having a copy of it on your future LMDE 2 hard disk.

To deactivate a LVM2 physical volume and remove the drive

> sudo umount /tmp/home2
> sudo lvchange -an </dev/vg00>
> sudo vgchange -an <vg00>

If you also want to remove the device maps you can use

> dmsetup ls
> sudo dmsetup remove <name>


Reboot your machine with the USB key inserted an, during the boot process, press the keyboard key that gives access to the “boot device” and select your USB Key identifier (on my system the key is F7). This is for BIOS machines, for (U)EFI systems please read the previous section Install from USB Key.

The “Live Key” should bring you to a Linux Mint Desktop. On the desktop is a Linux Mint icon, named “Install Linux Mint”, double click it and fill the installer's required information. When asked for the partition to use as installation target, select the primary partition that was previously created, in our example /dev/sdb1

sdb                                                                       
|-sdb1        ext4      18GB

As of this writing, a bug seems to sometimes appear, causing the installer to get stuck after pressing the “Forward” icon when completing account information. You can read this thread in the Linux Mint forum for more details.

If you encounter this problem, what you have to do is launch the installer from a terminal, complete the information in the installer, press CTRL+C in the terminal when installer's stuck… and the process will go on as if nothing happened!

To launch the installer from the terminal use:

> gksu live-installer

Once the install process has completed, reboot the machine once again, now selecting the Hard Drive where we newly installed LMDE 2.


Switch /home

If you need to switch the /home partition, edit your /etc/fstab as described earlier.


Switch Repos

The defaults Linux Mint repos are pointing to the US servers, depending on your geographical location, it might be of interest to switch for better performing ones. To do this simply open the Software Manager app, then select the Edit > Software Sources menu.

You'll see two main entries, one for “Main (betsy)“, one for Base (jessie). They respectively point to http://packages.linuxmint.com and http://ftp.us.debian.org/debian. Click on each of these references and select the best performing mirror for your location.



As explained at the beginning of this article, the objective here is not to blindly re-install everything that was present in a previous install. What we want is to operate a selective reinstall of only the pieces of software that we need in our new system.

To do so, we'll compare the fresh LMDE 2 installed packages list with my old system's installed packages list. Considering we followed the previously described way of exporting your system's installed packages, sources and keys, we'll now compare those to the ones from our fresh LMDE 2.

For the sake of clarity, let's say we have the following files structure where LMDE1 is our “old” install and LMDE2 is our “fresh” install:

LMDE1
|--sources.list.d
|  |--official-package-repositories.list
|  |--google-chrome.list
|  |--chrome-remote-desktop.list
|  |--additional-repositories.list
|--sources.list
|--Repo.keys
|--Package.list

LMDE2
|--sources.list.d
|  |--official-package-repositories.list
|--sources.list
|--Repo.keys
|--Package.list

Restore "old" keys

To avoid the burden of restoring each repo keys individually, we'll add them from our LMDE 1 saved file:

> sudo apt-key add /home/<user>/Documents/LMDE1/Repo.keys

Install Meld as diff tool

MELD is a GUI for the diff tool , it's easily installed through the Software Manager app and will greatly help us spot the differences in ours lists.

Go to: Menu → Software Manager → Search: “Meld” → Double click (line saying: Graphical tool to diff and merge files) → Install

You've got Meld available in your “Applications / Programming” menu !


List Package Differences

Using this “diff” technique, here is the list of packages that were not present in the “fresh” install, indicating what should be re-installed.


Desktop Environment

parcellite                           lightweight GTK+ clipboard manager

solaar                               Logitech Unifying Receiver peripherals manager for Linux

synapse                              semantic file launcher

Re-installed:

Parcellite

Menu → Software Manager → Search: parcellite → Install

Synapse

Download wheezy package: https://packages.debian.org/wheezy/amd64/synapse/download
Double click .deb → Install
Additional packages: libgee2, libgtkhotkey1, libunique-1.0-0, libzeitgeist-1.0-1

f.lux

See this page of the wiki to install f.lux.

Solaar

> sudo sh -c 'echo "deb http://pwr.github.io/Solaar/packages/ ./" >> /etc/apt/sources.list.d/solaar.list'
> sudo sh -c 'echo "deb-src http://pwr.github.io/Solaar/packages/ ./" >> /etc/apt/sources.list.d/solaar.list'
> sudo apt-get update
> sudo apt-get install solaar

Applications

Having a separated /opt partition allows to access some custom installed applications.

rssowl                               Newsreader for RSS, RDF and Atom Newsfeeds

terminator                           multiple GNOME terminals in one window

viber                                Free Text & Calls.

IntelliJ IDEA

Already in /opt.

For this app to work, we need to switch from OpenJDK to Oracle Java7 JDK. This operation is detailed on this page of the wiki.

RSSOwl

> wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
> sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu vivid-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
> sudo apt-get update
> sudo apt-get install rssowl

Terminator

Menu → Software Manager → Search: terminator → Install
Menu → System Settings → Preferred Applications → Terminal : Terminator

Viber

Download Viber for linux: http://www.viber.com/en/products/linux
Double click Viber.deb file → Install Package

Audio

audacity                             fast, cross-platform audio editor
audacity-data                        fast, cross-platform audio editor (data)

spotify-client                       Spotify desktop client

Re-installed:

Audacity

Menu → Software Manager → Search: audacity → Install

Spotify

Create source repo reference: /etc/apt/sources.list.d/spotify.list

# Spotify
> sudo sh -c 'echo "deb http://repository.spotify.com testing non-free" >> /etc/apt/sources.list.d/spotify.list'

note: we are using the “testing” repo as, today (2015.07.23), the “stable” version of spotify-client is not compatible with Debian 8 Jessie.

Update your packages list (key addition is not required if you already had it on your “old” system):

> sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 94558F59
> sudo apt-get update
> sudo apt-get install spotify-client

Additional packages: libgconf2-4, libnspr4-0d


Command Line Packages

git                                  fast, scalable, distributed revision control system
git-man                              fast, scalable, distributed revision control system (manual pages)

htop                                 interactive processes viewer

iftop                                displays bandwidth usage information on an network interface

ranger                               File manager with an ncurses frontend written in Python

Re-installed:

git

> sudo apt-get install git

Ranger

> sudo apt-get install ranger

htop

> sudo apt-get install htop

iftop

> sudo apt-get install iftop

Virtual Environment

virtualbox-4.3                       Oracle VM VirtualBox

Re-installed:

VirtualBox 5

Menu → Software Manager → Search : virtualbox → Install
All VMs are available since they reside under /home