Migration from LXD to Incus and Updating Ubuntu
server
Published: 2024-10-06

Introduction

This article contains notes on migrating from Ubuntu 22.04 to 24.04 and from LXD to Incus.

Updating from Ubuntu 22.04 to 24.04

  • First, execute the update:

    # sudo apt update && sudo apt upgrade -y
    
  • Upgrade to 24.04:

    # sudo do-release-upgrade
    
    • If do-release-upgrade cannot be found, install it with the following command:
      # sudo apt install ubuntu-release-upgrader-core
      

Migration to Incus

  • Install Incus:

    # sudo apt install incus incus-tools
    
  • Verify that incus and lxd can be executed:

    # incus info
    # lxc info
    
  • Migrate from LXD to Incus:

    # sudo lxd-to-incus
    => Looking for source server
    ==> Detected: snap package
    => Looking for target server
    ==> Detected: systemd
    => Connecting to source server
    => Connecting to the target server
    => Checking server versions
    ==> Source version: 5.21.2
    ==> Target version: 6.0.0
    => Validating version compatibility
    => Checking that the source server isn't empty
    => Checking that the target server is empty
    => Validating source server configuration
    
    The migration is now ready to proceed.
    At this point, the source server and all its instances will be stopped.
    Instances will come back online once the migration is complete.
    Proceed with the migration? [default=no]: yes
    => Stopping the source server
    => Stopping the target server
    => Wiping the target server
    => Migrating the data
    => Migrating database
    => Writing database patch
    => Cleaning up target paths
    => Starting the target server
    => Checking the target server
    Uninstall the LXD package? [default=no]: yes
    => Uninstalling the source server
    
    • If the version of lxd is too new, the migration will fail:
      # lxd-to-incus
      => Looking for source server
      ==> Detected: snap package
      => Looking for target server
      ==> Detected: systemd
      => Connecting to source server
      => Connecting to the target server
      => Checking server versions
      ==> Source version: 6.1
      ==> Target version: 6.0.0
      => Validating version compatibility
      Error: LXD version is newer than maximum version "5.21.99"
      
      • In this case, downgrade the lxd version (backup recommended):
        # sudo snap refresh lxd --channel=5.21/stable
        
    • Migration can also fail if unsupported configurations are present:
      # lxd-to-incus
      => Looking for source server
      ==> Detected: snap package
      => Looking for target server
      ==> Detected: systemd
      => Connecting to source server
      
      The source server (LXD) has the following configuration keys that are incompatible with Incus:
       - core.trust_password
      
      The present migration tool cannot properly connect to the LXD server with those configuration keys present.
      Please unset those configuration keys through the lxc config unset command and retry lxd-to-incus.
      
      Error: Unable to interact with the source server
      
      • In this case, change the lxd configuration:
        # lxc config unset core.trust_password 
        
  • Verify after migration:

    # incus list
    
  • Set up aliases:

    # cat << _EOF_ >> ~/.bashrc
    alias lxc='incus'
    alias lxd='incus'
    _EOF_
    
    • Without this, you might accidentally run lxc or lxd commands that will reinstall them via snap.

Conclusion

  • The update from Ubuntu 22.04 to 24.04 was completed successfully using do-release-upgrade.
  • The migration from LXD to Incus was straightforward with lxd-to-incus.
  • From 24.04 onwards, incus can be installed using apt.