介绍
这是关于从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
- 如果找不到do-release-upgrade,请使用以下命令安装
迁移到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的版本(建议备份)
- 如果有不支持的配置,也会导致迁移失败
# 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
- 在这种情况下,需要更改lxd的配置
- 如果lxd的版本过新,迁移会失败
迁移后的确认
# incus list
设置别名
# 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