Tmux, screen and gnome-terminal only work with security.privileged false

I have an opensuse/42.3 container I exported to a tarball and imported on another system (I will call it “target system”), which is bionic with LXD 3.0.1.

tmux and screen work fine in the system where I exported the image from but there is a strange issue in the target system. The issue only occurs when security.privileged is true. When it’s false everything works as expected.

Issue description

Here is the issue: When I start tmux, it exits the process immediately without error messages. screen demonstrates the same behavior but it notifies that the process exited. No useful information is given to stderr. I ran tmux with strace and found the internal communication between the server and client. This message was transferred through the socket:

create session failed: : Operation not permitted

This is right after tmux server tries to spawn /bin/bash --

Workaround

I am not sure if it is a workaround or expected behavior. I added my user to tty group with:

usermod -aGtty <my-user>

and re-logged in. This fixed the issue. Now I can use those tools with security.privileged true.

Why?

I don’t know why it happens. tty has the same id in the host and container.