Can't launch instance from remote computer via ssh

Hi
The problem is that I can’t launch a new LXC instance from the remote computer

For example

ssh admin@200.200.200.200 lxc copy example new-instance

works as expected

but

ssh admin@200.200.200.200 lxc launch ubuntu:20.04 new-instance

looks hanging forever

Are there some restrictions for launch command in this scenario?

lxc launch expects to read the instance’s config from STDIN, this is why its hanging.
You need to ensure that STDIN is closed on your ssh command.

Try using ssh -n

-n Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be
used when ssh is run in the background. A common trick is to use this to run X11 pro‐
grams on a remote machine. For example, ssh -n shadows.cs.hut.fi emacs & will start an
emacs on shadows.cs.hut.fi, and the X11 connection will be automatically forwarded over
an encrypted channel. The ssh program will be put in the background. (This does not
work if ssh needs to ask for a password or passphrase; see also the -f option.) Refer to
the description of StdinNull in ssh_config(5) for details.

ssh admin@200.200.200.200 lxc launch ubuntu:20.04 new-instance </dev/null

works too and is more suitable in my case

Thomas, many thanks for Your help again!

1 Like