Lxc launch via ssh fails with LXD 4.0.1

Hello,
I recently update LXD from 3.0.4 to 4.0.1 using snap, since it is the default version in Ubuntu 20.04.

I have created a tool that manages the containers via ssh.

The tool works with LXD 3.0.4.

With the 4.0.1 I have some trouble.
Running “lxc ls” returns “command not found”.

giuseppe@macbook-pro-di-giuseppe ~ % ssh root@x.x.99.25 "lxc ls"
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
bash: lxc: command not found

using the absolute path “/snap/bin/lxc ls” works, but “/snap/bin/lxc launch ubuntu” doesn’t work(it waits forever).

giuseppe@macbook-pro-di-giuseppe ~ % ssh root@x.x.99.25 "/snap/bin/lxc ls"
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
+-------------------+---------+------+------+-----------+-----------+
|       NAME        |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+-------------------+---------+------+------+-----------+-----------+
| accurate-chipmunk | RUNNING |      |      | CONTAINER | 0         |
+-------------------+---------+------+------+-----------+-----------+
| correct-mackerel  | RUNNING |      |      | CONTAINER | 0         |
+-------------------+---------+------+------+-----------+-----------+
| relaxed-rooster   | RUNNING |      |      | CONTAINER | 0         |
+-------------------+---------+------+------+-----------+-----------+
giuseppe@macbook-pro-di-giuseppe ~ % ssh root@x.x.99.25 "/snap/bin/lxc launch ubuntu"
Warning: untrusted X11 forwarding setup failed: xauth key data not generated

I tryed to update the PATH, but the results are the same

giuseppe@macbook-pro-di-giuseppe ~ % ssh root@x.x.99.25 'echo $PATH'
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
giuseppe@macbook-pro-di-giuseppe ~ % ssh root@x.x.99.25 'export PATH=$PATH:/snap/bin:/var/lib/snapd/snap/bin; lxc ls'
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
+-------------------+---------+------+------+-----------+-----------+
|       NAME        |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+-------------------+---------+------+------+-----------+-----------+
| accurate-chipmunk | RUNNING |      |      | CONTAINER | 0         |
+-------------------+---------+------+------+-----------+-----------+
| correct-mackerel  | RUNNING |      |      | CONTAINER | 0         |
+-------------------+---------+------+------+-----------+-----------+
| relaxed-rooster   | RUNNING |      |      | CONTAINER | 0         |
+-------------------+---------+------+------+-----------+-----------+
giuseppe@macbook-pro-di-giuseppe ~ % ssh root@x.x.99.25 'export PATH=$PATH:/snap/bin:/var/lib/snapd/snap/bin; lxc launch ubuntu'
Warning: untrusted X11 forwarding setup failed: xauth key data not generated

I also tried to update the “/etc/environment” but it doesn’t work.

Do you have any idea to make it work?

Giuseppe

lxc launch reads from stdin for an optional YAML document.

When not running attached to a termina as is the case here, it will just wait indefinitely.

You likely want to use the -t argument to ssh to avoid this issue.

Thank you, it works :slight_smile: