UbuntuアップデートとLXDからIncusへの移行
サーバ
Published: 2024-10-06

はじめに

Ubuntu 22.04から24.04への移行のメモと、LXDからIncusへの移行のメモです。

Ubuntu 22.04から24.04へのアップデート

  • まずはアップデートの実行

    # sudo apt update && sudo apt upgrade -y
    
  • 24.04へのアップデート

    # sudo do-release-upgrade
    
    • do-release-upgradeが見つからない場合は、以下のコマンドでインストール
      # sudo apt install ubuntu-release-upgrader-core
      

Incusへの移行

  • Incusのインストール

    # sudo apt install incus incus-tools
    
  • incusとlxdが実行できるか確認

    # incus info
    # lxc info
    
  • LXDから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
    
    • lxdのバージョンが新しすぎると移行に失敗する
      # 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"
      
      • この場合は、lxdのバージョンを下げる(バックアップ推奨)
        # sudo snap refresh lxd --channel=5.21/stable
        
    • サポートしていない設定が入っている場合も移行に失敗する
      # 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
      
      • この場合は、lxdの設定を変更
        # lxc config unset core.trust_password 
        
  • 移行後の確認

    # incus list
    
  • aliasを設定

    # cat << _EOF_ >> ~/.bashrc
    alias lxc='incus'
    alias lxd='incus'
    _EOF_
    
    • これをしておかないと、lxcコマンドやlxdコマンドを癖で打ってしまうと、snapで勝手に再インストールされてしまう。

    おわりに

    • Ubuntu 22.04から24.04へはdo-release-upgradeでアップデートができた
    • LXDからIncusへの移行はlxd-to-incusで簡単にできた
    • 24.04からはaptでincusがインストールできる