Debian 12 LXC, tmux killed on logout no matter what I try...

95GMT400

Member
Jul 21, 2021
10
0
21
22
Hello, I have ran into an interesting issue on my Debian 12 LXC container.
No matter what I try, something is killing my TMUX server on logout.

List of things that I have tried:
Tried editing /etc/systemd/logind.conf and adding
KillUserProcesses=no
KillExcludeUsers=root MY_USER_NAME
then rebooted, tmux still killed on logout

loginctl enable-linger MY_USER_NAME
Then rebooted, tmux still killed on logout

systemd-run --scope --user tmux
This returns an error: Failed to connect to bus: No medium found

Tried reinstalling openssh-server and openssh-client with
apt install -reinstall openssh-server openssh-client
from this Proxmox forum post.

Is there an easy way to see what is killing tmux, and has anyone else run into this recently?

If anyone would like to recreate this, I am using the LXC template available from Proxmox; debian-12-standard_12.7-1_amd64.tar.zst. Unprivileged container with nesting enabled. Steps; login as root, apt install tmux, tmux, start top inside tmux, ctrl+b d to detach, and then logout. Log back in as root, run tmux attach, and get a no sessions message.

Tmux works perfectly from the Proxmox host shell itself, and has for every other linux machine I have used it on.
 
Last edited:
I thought I was going mad! I have the same issue. I've tried with screen & tmux and also tried the steps you listed above. Did you ever solve this issue? I'm using Ubuntu 22.04 LTS.
 
I have unprivileged Debian 12 LXC & it works for me. (Did not have tmux installed initially, so I ran apt install tmux).

Then:

Started tmux session with tmux.
CTRL-b, d for dettach.
Exited putty-session.
Started putty-session & logged in.
tmux attach & session was still there.

I just checked (since I made this LXC some time ago) - it used debian-12-standard_12.0-1_amd64.tar.zst for its creation
 
Last edited:
I have unprivileged Debian 12 LXC & it works for me. (Did not have tmux installed initially, so I ran apt install tmux).

Then:

Started tmux session with tmux.
CTRL-b, d for dettach.
Exited putty-session.
Started putty-session & logged in.
tmux attach & session was still there.

I just checked (since I made this LXC some time ago) - it used debian-12-standard_12.0-1_amd64.tar.zst for its creation
That is super interesting. I wonder if something got changed in the newer version that causes issues. I will see if I can get the version you used and try it.

@95GMT400 looks like it works fine with a privileged container. I just took a backup and restored over itself and changed the privilege level in the restore dialog.
Are there security issues associated with making the container privileged? I assume that is privileged in context to the rest of the proxmox system?
 
Are there security issues associated with making the container privileged? I assume that is privileged in context to the rest of the proxmox system?
Correct, that is privileged within the PVE.
One should definitely avoid using a privileged LXC if possible as this exposes the whole system through that LXC.

I will see if I can get the version you used and try it.
I found a link to that template file here http://ftp.cn.debian.org/proxmox/images/system/debian-12-standard_12.0-1_amd64.tar.zst

If you want to add the template & then create an LXC follow this procedure:


1. SSH into your Proxmox node & go to the templates storage folder. (In local default that is usually cd /var/lib/vz/template/cache).

2. Enter the following command to download the template from the above site:

wget http://ftp.cn.debian.org/proxmox/images/system/debian-12-standard_12.0-1_amd64.tar.zst

3. In the Proxmox GUI this template should now appear.

4. Use the create new CT wizard in the GUI using that template.
 
Yeah. This is a bit of an annoying problem. If your container is debian based. I found you can just use systemd instead.
Here is what I'm using as a hacky work around in my unprivileged container. (Don't change ur container to privledged just to get tmux working...)

Code:
[Unit]
Description=tmux
After=network-online.target

[Service]
Type=forking
User=root
ExecStart=/usr/bin/tmux new-session -d
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

Then you can just do a tmux attach
 
Last edited:
Yeah. This is a bit of an annoying problem. If your container is debian based. I found you can just use systemd instead.
Here is what I'm using as a hacky work around in my unprivileged container. (Don't change ur container to privledged just to get tmux working...)

Code:
[Unit]
Description=tmux
After=network-online.target

[Service]
Type=forking
User=root
ExecStart=/usr/bin/tmux new-session -d
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target

Then you can just do a tmux attach
I like your solution, it's simple. I ended up using the ubuntu-24.04-standard_24.04-2_amd64.tar.zst template and TMUX seems to work properly there. I assume that this has continued to be an issue with the newer Debian templates? I just tested it on a debian 12 VM I have and it works as expected.
 
If anyone would like to recreate this
As I have already said above - I have not managed to recreate your issue.

I have now also tried it with the latest available template debian-13-standard_13.1-2_amd64.tar.zst, and again have no issues with tmux, detaching from session, exiting putty, reconnecting to putty, tmux attach works as it should. I have tried this in the Proxmox console too & all works also.

Can't work out what is not working for you guys!

I use the normally Proxmox downloaded template as above, create unprivileged LXC as normal, use normal root user, (I also allow root ssh login, though this is probably unrelated to your issue).