OpenNebula/addon-lxdone

Single VNC per node

jmdelafe opened this issue · 5 comments

The first container in a virtualization node is the only one who gets graphic session. More info can be found on this lxd issues. https://github.com/lxc/lxd/issues/1129 https://github.com/lxc/lxd/issues/936
This is not an LXDoNe bug, it's related to LXD. Maybe some config can be a workaround.

Any contribution will be appreciated.

It seems that this is coused by crash of svncterm process attached to second (and following) LXD container(s). Maybe LXD is not related.

It can reproduce by using normal bash command instead of 'lxc exec one-XXX bash'.
On this example the first svncterm uses port 5901, and second uses port 5902.

$ svncterm -timeout 0 -rfbport 5901 -c bash &
[1] 29133
$ svncterm -timeout 0 -rfbport 5902 -c bash &
[2] 29222
$ jobs
[1]-  Running                 svncterm -timeout 0 -rfbport 5901 -c bash &
[2]+  Running                 svncterm -timeout 0 -rfbport 5902 -c bash &

Then connect to the second svncterm's port 5902 from remote VNC client, the second svncterm just crashs by buffer overflow.

$ *** buffer overflow detected ***: svncterm terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f7dceee77e5]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f7dcef8856c]
/lib/x86_64-linux-gnu/libc.so.6(+0x116570)[0x7f7dcef86570]
/lib/x86_64-linux-gnu/libc.so.6(+0x1184b7)[0x7f7dcef884b7]
/usr/lib/x86_64-linux-gnu/libvncserver.so.0(rfbProcessNewConnection+0x108)[0x7f7dcf66c6e8]
/usr/lib/x86_64-linux-gnu/libvncserver.so.0(rfbCheckFds+0x3f8)[0x7f7dcf66cc18]
/usr/lib/x86_64-linux-gnu/libvncserver.so.0(rfbProcessEvents+0x1d)[0x7f7dcf663e4d]
svncterm[0x401876]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f7dcee90830]
svncterm[0x402c95]
======= Memory map: ========
00400000-00427000 r-xp 00000000 08:02 160250                             /usr/bin/svncterm
00626000-00627000 r--p 00026000 08:02 160250                             /usr/bin/svncterm
00627000-0062b000 rw-p 00027000 08:02 160250                             /usr/bin/svncterm
01083000-010a4000 rw-p 00000000 00:00 0                                  [heap]
7f7dccadf000-7f7dccaf5000 r-xp 00000000 08:02 534                        /lib/x86_64-linux-gnu/libgcc_s.so.1
7f7dccaf5000-7f7dcccf4000 ---p 00016000 08:02 534                        /lib/x86_64-linux-gnu/libgcc_s.so.1
7f7dcccf4000-7f7dcccf5000 rw-p 00015000 08:02 534                        /lib/x86_64-linux-gnu/libgcc_s.so.1
(snip)
7f7dcfadd000-7f7dcfade000 rw-p 00000000 00:00 0
7ffe24066000-7ffe24087000 rw-p 00000000 00:00 0                          [stack]
7ffe24155000-7ffe24157000 r--p 00000000 00:00 0                          [vvar]
7ffe24157000-7ffe24159000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

[2]+  Aborted                 (core dumped) svncterm -timeout 0 -rfbport 5902 -c bash

On Ubuntu 16.04 environment, I think could be fix this problem by using the svncterm rebuilded with ubuntu offcial libvncserver1 package, as following:

1. install depending packages to build machine

$ sudo apt install make build-essential zlib1g-dev console-data quilt libgnutls28-dev libjpeg-dev libvncserver-dev lintian

2. git clone svncterm and modify its package dependency

$ git clone https://github.com/dealfonso/svncterm
$ cd svncterm/
$ vi debian/control
(change Depends libvncserver0 to libvncserver1)

$ git diff
diff --git a/debian/control b/debian/control
index 7a2f9cc..5e5eb5a 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Package: svncterm
 Version: 1.2-1
 Section: x11
 Priority: optional
-Depends: libc6 (>= 2.7-18), libjpeg62, zlib1g (>= 1:1.2.1), libvncserver0
+Depends: libc6 (>= 2.7-18), libjpeg62, zlib1g (>= 1:1.2.1), libvncserver1
 Maintainer: GRyCAP <products@grycap.upv.es>
 Description: VNC Terminal Emulator
  With svncterm you can start commands and export its standard input and

3. make deb

$ sudo make deb
$ ls -l svncterm_1.2-1_amd64.deb
-rw-r--r-- 1 root root 23038 Jun 18 08:12 svncterm_1.2-1_amd64.deb

4. install rebuilded svncterm to Nodes

On Node, remove old svncterm and depended packages, copy new svncterm_1.2-1_amd64.deb from build machine, and install new svncterm_1.2-1_amd64.deb with libvncserver1.

$ sudo apt remove libgcrypt11 libgnutls26 libvncserver0 svncterm
$ sudo apt install /path/to/svncterm_1.2-1_amd64.deb
(libvncserver1 and other depended packages will install automatically)
dann1 commented

@sw37th Have you tried the new svncterm package?

@dann1 Yes, I tried. It works without this problem on my environment.

dann1 commented

Excellent, I checked out Proxmox yesterday since Debian Stretch came out a few days ago and vncterm, which is the base of svncterm got updated to version 1.5-2, maybe something could be done to update svncterm too. Anyway, if version 1.2-1 works OK, it's good enough for me. Thanks for the contribution.

dann1 commented

Fixed for 1707