Minimum requirement for lxd-p2c

(Markus Heckmann) #1

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

How to generate image from ISO CD?

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
$ ls lxd-p2c
$ ./lxd-p2c --version

(Stéphane Graber) #3

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 then transfer the resulting binary to the system you want to import into LXD.

(Markus Heckmann) #4

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


  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.

(Stéphane Graber) #5

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.

(Markus Heckmann) #6

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

(Markus Heckmann) #7

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.

(Jair Bolivar) #8

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:

Next when I enter the container >

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 < 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.


(Stéphane Graber) #9

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.

(Jair Bolivar) #10


Works perfectly!

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

Let NetworkManager manage all devices on this system

version: 2
renderer: networkd
dhcp4: no
dhcp6: no
addresses: []
addresses: [,,]


root@server1:~# lxc list
| budgie3 | RUNNING | (eth0) | 2405:6580:2cc0:100:216:3eff:fe2e:a982 (eth0) | PERSISTENT | 0 |
| c1 | STOPPED | | | PERSISTENT | 0 |
| c2 | STOPPED | | | PERSISTENT | 0 |
| debian1 | RUNNING | (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!

(Stéphane Graber) #11

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.

(Jair Bolivar) #12


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!

(Markus Heckmann) #13

In ubuntu xenial compiling fails. Care to help? Thx

go get
go/src/ undefined: runtime.KeepAlive
go/src/ undefined: runtime.KeepAlive

(Stéphane Graber) #15

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.

(Markus Heckmann) #16

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
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]

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  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/, 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/, for GNU/Linux 2.6.32, BuildID[sha1]=0f73a863186e0dd34d23a4bef2b1181dc1c366c5, not stripped

Any suggestions. Thanks

(Sean Fulton) #17

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: /lib64/ version `GLIBC_2.14’ not found (required by ./lxd-p2c)

(Stéphane Graber) #18

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.

(Sean Fulton) #19

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: /lib64/ version `GLIBC_2.14’ not found (required by ./lxd-p2c)

(Quinn Jensen) #20

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

go get -a -v -x -ldflags ‘-extldflags “-static”’

(Sean Fulton) #21

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”’

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.