Minimum requirement for lxd-p2c

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

Does not work with the =.
Also, in your command, I can see some Unicode quotes which are a big no no.
I cannot understand how you go them, since this forum software does not do any superfluous text formatting.

Here the following is on Ubuntu 18.04, running Go 1.11 (snap package).

$ go version
go version go1.11 linux/amd64
$ go get -a -v -x -ldflags '-extldflags "-static"' github.com/lxc/lxd/lxd-p2c
...
$ cd $GOPATH/bin
$ ldd lxd-p2c 
	not a dynamic executable
Exit 1

Verify that ldd says that the executable is not dynamic (i.e. it’s static).

I manually re-typed the whole line, got the ldd output as you indicate, copied it over to a centos 6 box:

[root@nj-web01-cl01 ~]# uname -a
Linux nj-web01-cl01 2.6.32-042stab127.2 #1 SMP Thu Jan 4 16:41:44 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@nj-web01-cl01 ~]# ./lxd-p2c
FATAL: kernel too old
Aborted

What kernel version does Centos 6 have? Distrowatch says Linux 2.6. Is that really your kernel version on Centos?

You can add the --enable-kernel=x.y.z option when you compile the binary.
See more at http://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html

Did you ever find a resolution to this? I am having the same problem. I started a new thread.

Is the lxd server a member of a cluster?

Thanks,

This thread is about generating the lxd-p2c executable file.
Your thread is about an issue with lxd-p2c not working.

Sorry for the delay in getting back to you. The kernel is 2.6.32 in centos.

I built it with this am still getting the kernel too old message:

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

I was able to build a static version of lxd-p2c on CentOS 6 by using the Developer Toolset which provides a newer version of gcc than the one installed by default:

yum install -y centos-release-scl
yum install -y devtoolset-8-binutils devtoolset-8-gcc-c++ devtoolset-8-binutils-devel devtoolset-8-libstdc++-devel devtoolset-8-runtime devtoolset-8-gcc

go get -d -v github.com/lxc/lxd/lxd-p2c
scl enable devtoolset-8 bash
go build -v -x --tags netgo --ldflags '-extldflags "-static"' github.com/lxc/lxd/lxd-p2c

Then the resulting executeable lxd-p2c is static:

# ldd lxd-p2c
        not a dynamic executable

There is a Makefile target for a static lxd-p2c build.