Copy LXD container to another host

(Sergei) #1

Hi! I have a two hardware hosts (svr1, svr2)
svr1(, diz) - old host with ubuntu16.04 and have a many containers (LXD version 2.0.11)
svr2(, blade) - new host with ubuntu 18.04 (LXD version 3.0.2)
I create br0 bridge on the srv2 and manually assign new network profile to any new containers created on this host (svr2), i don’t create default bridge in “lxd init”.

I want copy a few containers from svr1 to svr2

i taking a snapshot container named “upsource” on svr1 and copying

sudo lxc copy upsource/snap0 blade:upsource

i see, on the svr2 show up container named “upsource”, after that a receive error:

error: Failed container creation:

i don’t have firewall
i guess network 172.17, 172.18 - it’s a docker networks
how to copy container without network settings? it is possible? or what i doing wrong?

(Stéphane Graber) #2

Exit status 12 suggests a rsync feature mismatch which would be explained by the difference in rsync arguments between the two versions.

It’s something we’ve since resolved and that will be solved in 3.0.3.

Until then, one trick that may work is to force the source server to pass the missing rsync option by wrapping rsync.

You could do this by writing:

exec /usr/bin/rsync "$@" --xattrs

to /usr/local/bin/rsync, then make it executable with chmod +x /usr/local/bin/rsync and attempt the migration again.

Note that you’ll want to remove this file once done with the transfers as it’d otherwise make every rsync call on the system use that --xattrs option which is unlikely to be desired.

(Sergei) #3

it’s works!! Thank you very much!

(S S) #4

Hi @stgraber , im still having this issue but in my case it’s not a exit 12 error, I can’t seem to find any logs on the host or remote for more details any thoughts would be greatly appreciated.

1- confirmed that the remote host was added into local (qwerty) remote list
2- confirmed that remote host is listening on port 8443, and is open for network access

ubuntu@odin:/var/log$ lxd --version
ubuntu@odin:/var/log$ lxc --version

ubuntu@qwerty:~$ lxd --version
ubuntu@qwerty:~$ lxc --version

remote list:
ubuntu@qwerty:~$ lxc remote list
| images | asdfsadf | simplestreams | | YES | NO |
| local (default) | unix:// | lxd | tls | NO | YES |
| odin | https://xxx:8443 | lxd | tls | NO | NO |

network test
ubuntu@qwerty:~$ nc -vz xxx 8443
Connection to xxx 8443 port [tcp/*] succeeded!

copy statement:
ubuntu@qwerty:~$ lxc copy u1/current-snap odin:u1-current
Error: Failed container creation:
- Error transferring container data: Unable to connect to:
- Error transferring container data: Unable to connect to:
- Error transferring container data: Unable to connect to:
- https://[fd42:4cee:6c8f:8a41::1]:8443: Error transferring container data: Unable to connect to: [fd42:4cee:6c8f:8a41::1]:8443

(Stéphane Graber) #5

Looks like a network path issue when the target server connects to the source one.

You may want to try with --mode=relay

(S S) #6

@stgraber – that did the trick! Many many thanks!