How to run TeamViewer in LXD

TeamViewer is a popular remote desktop tool. It is the typical tool to use, in order to help remotely your colleagues that keep using Windows.

You can install TeamViewer on Linux using these instructions on installing TeamViewer on Linux. In this post though, you will install TeamViewer in a LXD (pronounced LexDee) container on your desktop.

The benefits of installing TeamViewer in a container are:

  1. the TeamViewer executable will be restricted to the filesystem of the container,
  2. you can easily remove the installation by deleting the container, and be sure that it is 100% gone,
  3. you get GPU acceleration from your desktop environment, compared to running over ssh -X (X11 forwarding over SSH).

The latest version of TeamViewer is 13, and just a few months ago it was released on Linux. Compared to previous versions, TeamViewer 13 is a native application based on the Qt Framework. Previous versions of TeamViewer for Linux have been using Wine (Windows emulation on Linux).

TeamViewer 13 is quite new, rewritten and several features are missing at the moment. There are some complaints at the TeamViewer Linux community forums. Here is another one, TeamViewer 13 does not work yet in LXD. It is a peculiar issue and there is lots of head-scratching. What happens, is that TeamViewer 13 in LXD cannot connect to the network at all! In this post, we are installing  one of the previous versions.

Prerequisites

  • Follow this guide to setup a container on your desktop. This container will have access to your desktop’s graphics environment and will benefit from any graphics acceleration you have available. I assume you named that container guiapps.
  • Set up a password for the non-root user in the container. The Ubuntu container images have a default ubuntu user account. Set up a password by running the following. lxc exec executes a command in the container guiapps. The command is anything after the characters, and it’s just passwd ubuntu.
    $ lxc exec guiapps -- passwd ubuntu
    Enter new UNIX password: <type a password>
    Retype new UNIX password: <type again the same password>
    passwd: password updated successfully

Connecting to the container

Connect to the container using the lxc console command. This command is quite new to LXD, therefore you need a recent LXD version. You should either install LXD from the backports repository, or migrate the snap version of LXD.

The lxc console command gives you a console to the container, as in /dev/console. It is yet another way to connect to a LXD container (the others being lxc exec and ssh). Let’s connect then. It’s lxc console, and then the container name. You are asked for your username and password. Then, type tty to see the TTY device.

$ lxc console guiapps
To detach from the console, press: <ctrl>+a q

Ubuntu 16.04.3 LTS guiapps console

guiapps login: ubuntu
Password: <type your password>
run-parts: /etc/update-motd.d/98-fsck-at-reboot exited with return code 1
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.13.0-32-generic x86_64)

* Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

Get cloud support with Ubuntu Advantage Cloud Guest:
 http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


ubuntu@guiapps:~$ tty
/dev/console
ubuntu@guiapps:~$

Let’s compare with connecting over SSH. Substitute the IP address with correct IP address of your own guiapps container. You can find it by running lxc list.

$ ssh ubuntu@10.52.252.96
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.13.0-32-generic x86_64)

* Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

Get cloud support with Ubuntu Advantage Cloud Guest:
 http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


ubuntu@guiapps:~$ tty
/dev/pts/0
ubuntu@guiapps:~$

Finally, let’s compare with getting access using lxc exec.

$ lxc exec guiapps -- sudo --user ubuntu --login 
ubuntu@guiapps:~$ tty
not a tty
ubuntu@guiapps:~$

The reason why we use lxc console is that TeamViewer gives a variety of errors when using the other methods.

Installing TeamViewer12 on Linux

Visit the page with the previous versions of TeamViewer and download the highlighted file, TeamViewer deb 32-Bit / 64-Bit Multiarch. Then, add the i386 architecture to apt. Install the downloaded .deb file, and finally install any missing packages for Teamviewer. The commands are shown below the screenshot.

ubuntu@guiapps:~$ sudo dpkg --add-architecture i386
ubuntu@guiapps:~$ sudo apt update
ubuntu@guiapps:~$ wget http://download.teamviewer.com/download/version_12x/teamviewer_i386.deb
ubuntu@guiapps:~$ sudo dpkg -i teamviewer_i386.deb 
ubuntu@guiapps:~$ sudo apt install -f

Running TeamViewer

Now run TeamViewer.

ubuntu@guiapps:~$ teamviewer

Init...
CheckCPU: SSE2 support: yes
XRandRWait: No value set. Using default.
XRandRWait: Started by user.
Checking setup...
Launching TeamViewer ...
Launching TeamViewer GUI ...

Here is the TeamViewer window.

Conclusion

TeamViewer is a very important application for those that need to use it. At the moment, it takes effort to install TeamViewer and especially to confine it from the rest of your Linux desktop.

Ideally, TeamViewer (the company) should create snap packages of TeamViewer, and distribute it as a snap, just like the Skype team does for Skype. By doing so, TeamViewer (the company) will be able to push out new packages for Linux with the click of a button.

TeamViewer 13 is new and is still in development. I am quite mystified as to why it would not work in a LXD container. The application would not be able to connect to the Internet, just to the local network . The log files mention errors relating to the framebuffer. There are frequent updates though, therefore a future update may fix the issues.

Permanent link to this article: https://blog.simos.info/how-to-run-teamviewer-in-lxd/

2 comments

  1. Did not work for me, i already had guiapps working, i use it a lot, but i can only open display with lxc exec. I installed lxd from snap on xubuntu 18.04 (LTS)

  2. Does not work with recent TeamViewer versions (although I followed your more recent guide “Running X11 software in LXD containers”), .local/share/teamviewer15/logfiles/TeamViewer15_Logfile.log:
    G!! SysSessionInfoManager::GetOwnProcessSession: No session found!, Errorcode=11
    G!!!Own session could not be resolved, unable to startup, Errorcode=11

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.