`multipass get` command (preview)

See also: get & set keys

[not available yet]

The multipass get command provides a way to obtain Multipass’s settings. For example:

$ multipass get local.driver
qemu

Available settings are documented in the reference.

When used without arguments, it displays all available settings as a list of <key>=<value> pairs:

$ multipass get
client.gui.autostart=true
client.gui.hotkey=Ctrl+Alt+U
client.primary-name=primary

With the --keys option, it lists only settings keys:

$ multipass get --keys
client.gui.autostart
client.gui.hotkey
client.primary-name

In all cases, get returns only settings that are available at the moment when it is executed.

This command can also be given positional arguments, restricting what settings are to be retrieved. Such arguments can take the form of either plain keys (e.g. client.primary-name) or key wildcards (e.g. local.*).

multipass get filters the settings according to the positional arguments it is given, returning only the subset of available settings that satisfy them:

$ multipass get client.gui.*
client.gui.autostart=true
client.gui.hotkey=Ctrl+Alt+U
$ multipass get client.gui.* local.driver
client.gui.autostart=true
client.gui.hotkey=Ctrl+Alt+U
local.driver=qemu

When only one setting satisfies the input arguments, its key is omitted and only its value is printed, unless --keys is also provided (in which case only the key is printed, still):

$ multipass get client.gui.autostart
true

If no setting matches the arguments, multipass will complain that it cannot recognize the settings key(s).

With the --raw option, values are printed in raw format. For now this affects only the representation of empty values:

$ multipass get --raw client.primary-name

$ multipass get client.primary-name
<empty>

Use multipass help get for a quick reference:

$ multipass help get
Usage: multipass get [options] [<arg>]
Get the configuration setting corresponding to the given key, or all settings if no key is specified.
(Support for multiple keys and wildcards coming...)

Some common settings keys are:
  - client.gui.autostart
  - local.driver
  - local.privileged-mounts

Use `multipass get --keys` to obtain the full list of available settings at any given time.

Options:
  -h, --help     Displays help on commandline options
  -v, --verbose  Increase logging verbosity. Repeat the 'v' in the short option
                 for more detail. Maximum verbosity is obtained with 4 (or more)
                 v's, i.e. -vvvv.
  --raw          Output in raw format. For now, this affects only the
                 representation of empty values (i.e. "" instead of "<empty>").
  --keys         List available settings keys. This outputs the whole list of
                 currently available settings keys, or just <arg>, if provided
                 and a valid key.

Arguments:
  arg            Setting key, i.e. path to the intended setting.

% multipass get local.driver

returns…

Unable to read settings: access error (consider running with an administrative role)

Why do I need to sudo this command?

This is a caveat of our current implementation of settings. Daemon settings are kept in a root-owned file, which the multipass client accesses directly.

We now have a new implementation where no sudo is needed anymore, because the settings are routed to and from the daemon. But it hasn’t been released yet.

1 Like

Ah. Thank you Ricardo. I’ll be waiting for the new release to drop.