Minimum requirement for lxd-p2c

lxd-p2c is there any snap or apt-get ppa for this migration script. (@stgraber - really like your FOSDEM demo. Thanks

UPDATE: the following is wrong: The tool lxd-p2c is available with the LXD 3.0 snap package as lxd-p2c. My lxd-p2c was actually from ~/GO/bin/ (was compiled from Go).

You can compile it (assuming you have set up the Go language on your computer) with the following:

$ cd /tmp
$ go build github.com/lxc/lxd/lxd-p2c
$ ls lxd-p2c
lxd-p2c
$ ./lxd-p2c --version
3.0.0.beta7

Actually, it’s not in the snap, on purpose.

As the tool is meant to be run on the source machine and such a source machine is very unlikely to be running a modern Linux distribution, the expected way to interact with lxd-p2c is to build it statically with go get github.com/lxc/lxd/lxd-p2c then transfer the resulting binary to the system you want to import into LXD.

Thanks. I compiled the go. I am trying it with desitnation:

  driver: lxc
  driver_version: 2.0.8
  kernel: Linux
  kernel_architecture: x86_64
  kernel_version: 4.13.0-39-generic
  server: lxd
  server_pid: 4840
  server_version: 2.0.11

source

  driver: lxc
  driverversion: 2.0.7
  kernel: Linux
  kernelarchitecture: x86_64
  kernelversion: 4.4.0-119-generic
  server: lxd
  serverpid: 1432
  serverversion: 2.0.9

It fails with Error: not implemented.
any suggestions to fix.
Basically what are the minimum versions for source and destination. I like to stay with LTS if possible.

Target should be 2.21 or higher, we haven’t tested with prior releases. I think the “not implemented” there refers to push migration which didn’t exist until a year or so ago.

Thanks for the quick info. I installed backports
 it is now transferring. Let you know how it goes later!
driver: lxc
driver_version: 2.0.8
kernel: Linux
kernel_architecture: x86_64
kernel_version: 4.13.0-39-generic
server: lxd
server_pid: 9484
server_version: "2.21"
storage: zfs
storage_version: 0.6.5.11-1ubuntu3.3

One more question. Thelxd-p2c <target URL> <container name> <filesystem root> [<filesystem mounts>...] [flags]

Do I assume I need to give / and /home as 2 separate filesystem mounts in the above command.
Edit: Yes. https://youtu.be/JKztAWZOj9g?t=318

Hello all and thank you for the great work!

Here is my issue:

I converted an ubuntu 18.04 LTS from vbox to lxc and I am having the following issue:http://paste.debian.net/1024609

Next when I enter the container > http://paste.debian.net/1024610

I tried to configure the “/etc/network/interfaces” but after restart the machine still does not not read the config


I tried adding the ipv4 settings using “ip add blah blah” it takes the values it connects but if I restart it does not retain the settings

http://paste.debian.net/1024611/ < after this the connection works and I can interact with the container in the network but after restart all configuration is lost and I see only the ipv6 config

Little help will be greatly appreciated.

Sincerely,

Ubuntu 18.04 uses netplan rather than ifupdown, so you’ll likely need to put network configuration in /etc/netplan/ if you want it to persist.

1 Like

@stgraber,

Works perfectly!

jair@budgie3:~$ cat /etc/netplan/01-network-manager-all.yaml

Let NetworkManager manage all devices on this system

network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
dhcp6: no
addresses: [192.168.0.9/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.101,192.168.0.102,8.8.8.8]

&

root@server1:~# lxc list
±--------±--------±-------------------±---------------------------------------------±-----------±----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
±--------±--------±-------------------±---------------------------------------------±-----------±----------+
| budgie3 | RUNNING | 192.168.0.9 (eth0) | 2405:6580:2cc0:100:216:3eff:fe2e:a982 (eth0) | PERSISTENT | 0 |
±--------±--------±-------------------±---------------------------------------------±-----------±----------+
| c1 | STOPPED | | | PERSISTENT | 0 |
±--------±--------±-------------------±---------------------------------------------±-----------±----------+
| c2 | STOPPED | | | PERSISTENT | 0 |
±--------±--------±-------------------±---------------------------------------------±-----------±----------+
| debian1 | RUNNING | 192.168.0.4 (eth0) | 2405:6580:2cc0:100:216:3eff:fe16:2801 (eth0) | PERSISTENT | 0 |
±--------±--------±-------------------±---------------------------------------------±-----------±----------+

Thank you so much!

The only question I have now is: How do we maintain the TeamViewer or nomachine application working after the VM being converted to a container?

When I run the OS in VirtualBox works perfectly but as LXC I don’t get the window mamager to work or basically there is something missing for me to have the same functionality as in a VM.

Thank you in advance for your input in advance!

I don’t know about teamviewer/nomachine. I suspect they may be tied to somehow having a display attached to the system where they can render, which would be missing in a container?

You may need to tweak some init scripts or configurations to have them start on a headless system.

1 Like

@stgraber,

I see. headless, that is the vocabulary I am looking for to investigate how to make them work. Of course, the majority of the containers I will be using will not be running a graphical window manager like GNOME or XFCE, but sometimes I would like to have that option.

I will investigate further. Thank you again!

In ubuntu xenial compiling fails. Care to help? Thx

go get github.com/lxc/lxd/lxd-p2c
# golang.org/x/sys/unix
go/src/golang.org/x/sys/unix/ioctl.go:18: undefined: runtime.KeepAlive
go/src/golang.org/x/sys/unix/ioctl.go:28: undefined: runtime.KeepAlive

All LXD code requires Go 1.10 or higher to build.

I believe there’s a backport version of Go 1.10 available for xenial, alternatively, build the tool on a bionic system and transfer the binary. As Go binaries are static, there’s no problem with sending them between systems.

Hmmm I too thought that way.

lxd-p2c_3.4 (compiled in bionic)

is unable to transfer from xenial/x86_64 to another xenial server with (lxc - 3.0.1).

Generating a temporary client certificate. This may take a minute...
Certificate fingerprint: 9f545454655757586846d1d6245dab91657bb712c995
ok (y/n)? y
Admin password for https://1.24.4.4:8443
Error: Failed to rsync: exit status 2
[Receiver] Invalid dir index: -1 (-101 - -101)
rsync error: protocol incompatibility (code 2) at flist.c(2630) [Receiver=3.1.1]

but
lxd-p2c 3.0.0 can do it. (compiled on May 2,2018)

Another issue: Trying to transfer xenial/i386 system to another xenial server ((lxc - 3.0.1) gives this error (of course I try as root):

./lxd-p2c_3.0.0 https://1.2.3.4:8443  vm3 /
./lxd-p2c_3.0.0: 1: ./lxd-p2c_3.0.0: Syntax error: "(" unexpected

with lxd-p2c 3.4
-bash: ./lxd-p2c: Text file busy

lxd-p2c:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=3cff6b2cd5e3a7bd84e0389946cb47eff82356bc, not stripped
lxd-p2c_3.0.0: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=0f73a863186e0dd34d23a4bef2b1181dc1c366c5, not stripped

Any suggestions. Thanks

1 Like

I’m having a problem with this one. I have about an openvz container with centos 6. I can’t seem to get go to build lxd-p2c on that machine, so I built it on Ubuntu 18.04, and copied it to the centos machine as you suggest. However when I try to run it, it complains that I have the wrong version of glibc on the centos side:
./lxd-p2c
./lxd-p2c: /lib64/libc.so.6: version `GLIBC_2.14’ not found (required by ./lxd-p2c)

Try building it with -tags netgo that should result in a fully static binary so getting rid of that glibc link you have right now.

Same error. I built it with both go 1.10 and 1.11 on Ubuntu 18.04. Works fine there, but when I copy it to centos 6, I get:

./lxd-p2c
./lxd-p2c: /lib64/libc.so.6: version `GLIBC_2.14’ not found (required by ./lxd-p2c)

I built it this way to get rid of the GLIBC_2.14 error:

go get -a -v -x -ldflags ‘-extldflags “-static”’ github.com/lxc/lxd/lxd-p2c

OK, maybe it’s just me. I used your suggestion (thank you!) but it seemed to need an equals after extldflags in order to compile.

go get -a -v -x -ldflags ‘-extldflags=“-static”’ github.com/lxc/lxd/lxd-p2

Got it to compile, moved it to my centos6 machine
 same thing. Thinking maybe it was just some bad mojo with that machine, I moved it to another centos6 machine, same error.

sean