Ubuntu – How to upgrade a mkusb Persistent Live system from 16.04 to 18.04

live-usbupgradeusb

I have a 16.04 Persistent Live flash drive made using mkusb.

It is set up just how I want it.

I want to upgrade to 18.04.

When I copy the 16.04 casper-rw partition to the new 18.04 flash drive everything goes wonky.

What can I do?

Best Answer

Upgrade a persistent live system

There are reasons to upgrade a persistent live system, if you use it for other purposes than testing, for example because you want a very portable operating system, more portable than an installed Ubuntu system in an external drive.

  • security upgrades
  • new versions of installed programs
  • new kernels and hardware drivers to make it work with new computers

You upgrade the basic persistent live system by installing it from a new iso file, typically a new daily iso file of an LTS release, but also to a new version of Ubuntu (16.04 to 18.04). But you lose your data files, tweaks and the manually installed programs.

You can copy /home to another version of Ubuntu

The /home directory contains personal data as well as settings and tweaks. These data are almost always independent of the version of version of Ubuntu (or Ubuntu community flavour). It means that you can copy them from one version to another version within a fairly wide scope of versions.

I have tested that

  • you can upgrade from 12.04.5 LTS directly all the way to 18.04 LTS,
  • you can downgrade from 18.04 LTS to 14.04.1 LTS,
  • and in the specific case of the question, you can upgrade from 16.04 to 18.04.

This works when you address the 'home' directory

  • of persistent live systems
    • in the casper-rw partition (or file)
    • in a separate home partition (or file)
  • and of installed systems.

If the user IDs are different, you must make them match in the new system. This means that it is easy to upgrade a persistent live system of Ubuntu to a new version of Ubuntu, or stay within the same community flavour of Ubuntu (Kubuntu, Lubuntu, ... Xubuntu). It is possible but more difficult to switch between flaovurs and to switch between installed systems and persistent live systems.

Do not copy the casper-rw partition to a new version of Ubuntu

You are right, a full upgrade of a persistent live system is not possible, at least not the easy way by copying the casper-rw partition from an old version to a new version. After some upgraded program packages, it doesn't even work to upgrade to a newer [daily] iso file within the same version of Ubuntu (or Ubuntu community flavour).

So you must re-install the program packages, that you installed manually, and you must re-do the system settings, that are not in /home (for example those in /etc).

Methods and tools

mkusb and mkusb-backup-n-restore-home

This method may suit better,

  • if you already have a persistent live drive made by mkusb
  • if you want to combine the upgrade with a backup
  • if you prefer tools with graphical user interfaces

mk-persistent-live_with_home-rw

  • Create a persistent live drive with mk-persistent-live_with_home-rw. This will be different from a drive made by mkusb. The idea is to

  • keep the home-rw partition

  • replace the iso file with a new one
  • create a new file system in the casper-rw partition (format).
  • create a grub.cfg that matches the iso file.

This method may suit better,

  • if there are lots of data in the /home directory
  • if the USB pendrive is big
  • if you want to change between flavours of Ubuntu or between a persistent live system and an installed system, and must tweak the user IDs manually.

  • The following link describes how to install and use this tool,

    Make persistent live drives with casper-rw and home-rw partitions

Related Question