How to manage the LXD snap

The recommended way to manage LXD is its snap package.

For the installation guide, see: Install the LXD snap package. For details about the LXD snap, including its channels, tracks, and release processes, see: Releases and snap.

View snap information

To view information about the LXD snap, including the available channels and installed version, run:

snap info lxd

To view information about the installed version only, run:

snap list lxd

Sample output:

root@instance:~# snap list lxd
Name  Version         Rev    Tracking     Publisher   Noteslxd   5.21.3-c5ae129  33110  5.21/stable  canonical✓  -

The first part of the version string corresponds to the LXD release (in this sample, 5.21.3).

Manage updates

When LXD is installed as a snap, it begins tracking the specified snap channel, or the most recent stable LTS track if not specified. Whenever a new version is published to that channel, the LXD version on your system automatically updates.

For control over the update schedule, use either of the following approaches:

For clustered LXD installations, also follow the instructions below to synchronize updates for cluster members.

For more information about snap updates in general, see the Snap documentation: Managing updates.

Schedule updates with the refresh timer

Set the snaps refresh timer to regularly update snaps at specific times. This enables you to schedule automatic updates during times that don’t disturb normal operation. The refresh timer is set system-wide; you cannot set it for the LXD snap only. It does not apply to snaps that are held indefinitely.

For example, to configure your system to update snaps only between 8:00 am and 9:00 am on Mondays, set the following option:

  sudo snap set system refresh.timer=mon,8:00-9:00

You can also use the refresh.hold setting to hold all snap updates for up to 90 days, after which they automatically update. See Control updates with system options in the snap documentation for details.

Hold updates

You can hold snap updates for the LXD snap, either indefinitely or for a specific duration. If you want to fully control updates to your LXD snap, you should set up an indefinite hold until you decide to update.

To indefinitely hold all updates, run:

sudo snap refresh --hold lxd

When you want to update, remove the hold:

sudo snap refresh --unhold lxd

Then after performing a manual update, reinstate the hold.

For detailed information about holds, including how to hold snaps for a specific duration rather than indefinitely, see: Pause or stop automatic updates in the Snap documentation.

Manual updates

For an LXD snap installed as part of a cluster, see the section on synchronizing cluster updates below.

Otherwise, run:

sudo snap refresh lxd

This updates your LXD snap to the latest release within its channel.

Synchronize updates for a LXD cluster cohort

All LXD cluster members must run the same LXD version. Even if you apply updates manually, versions can fall out of sync; see Updates on clusters for details.

To ensure synchronized updates, set the --cohort="+" flag on all cluster members. You only need to set this flag once per LXD snap. This can occur during installation, or the first time you perform a manual update.

To set this flag during installation:

sudo snap install lxd --cohort="+"

To set this flag later, during a manual update:

sudo snap refresh lxd --cohort="+"

After you set this flag, snap list lxd shows in-cohort in the Notes column. Example:

root@instance:~# snap list lxd
Name  Version         Rev    Tracking     Publisher   Noteslxd   5.21.3-c5ae129  33110  5.21/stable  canonical✓  in-cohort

Subsequent updates to this snap automatically use the --cohort="+" flag, even if you change its channel or use automated or scheduled updates. Thus, once the snap is in-cohort, you can omit that flag for future updates.

Workaround if the cohort flag malfunctions

If for some reason, the --cohort="+" flag does not work as expected, you can update using a matching revision on all cluster members manually:

sudo snap refresh lxd --revision=<revision_number>

Example:

sudo snap refresh lxd --revision=33110

Manage updates with an Enterprise Store proxy

For Snap Store Proxy users

If you previously used the Snap Store Proxy, see the migration guide in the Enterprise Store documentation for instructions on transitioning to the Enterprise Store.

If you manage a large LXD cluster and require absolute control over when updates are applied, consider using the Enterprise Store. This proxy application sits between your machines’ snap clients and the Snap Store, giving you control over which snap revisions are available for installation.

To get started, follow the Enterprise Store documentation to install and register the service. Once it’s running, configure all cluster members to use the proxy; see Configure devices for instructions. You can then override the revision for the LXD snap to control which version is installed:

sudo enterprise-store override lxd <channel>=<revision>

Example:

sudo enterprise-store override lxd stable=25846

Configure the snap

The LXD snap has several configuration options that control the behavior of the installed LXD server. For example, you can define a LXD user group to achieve a multi-user environment for LXD. For more information, see: Confine users to specific LXD projects via Unix socket.

See the LXD snap page for a list of available configuration options.

To set any of these options, run:

sudo snap set lxd <key>=<value>

Example:

sudo snap set lxd daemon.user.group=lxd-users

To see all configuration options that are explicitly set on the snap, run:

sudo snap get lxd

For more information about snap configuration options, visit Configure snaps in the Snap documentation.

Change the snap channel

While it is possible to change the channel used at installation, proceed with caution.

You can upgrade (move to a newer track, such as from 5.21 to 6), as well as move to different risk level with the same track. However, downgrading (moving to a channel with an older track, such as from 6 to 5.21) is neither recommended nor supported, as breaking changes can exist between major versions.

To change the channel, run:

sudo snap refresh lxd --channel=<target channel>

This command immediately updates the installed snap version.

Manage the LXD daemon

Installing LXD as a snap creates the LXD daemon as a snap service. Use the following snap commands to manage this daemon.

To view the status of the daemon, run:

snap services lxd

To stop the daemon, run:

sudo snap stop lxd

Stopping the daemon also stops all running LXD instances.

To start the LXD daemon, run:

sudo snap start lxd

Starting the daemon also starts all previously running LXD instances.

To restart the daemon, run:

sudo snap restart lxd

This also stops and starts all running LXD instances. To keep the instances running as you restart the daemon, use the --reload flag:

sudo snap restart --reload lxd

For more information about managing snap services, visit Service management in the Snap documentation.