[GH-ISSUE #1154] LGSM recently blocks nested sessions #905

Closed
opened 2026-02-27 02:54:14 +03:00 by kerem · 15 comments
Owner

Originally created by @CasperAlant on GitHub (Oct 25, 2016).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/1154

I run multiple LGSM servers on the same machine. I create a tmux session for each user and login with that user account and run LGSM as a nested session.

I've been doing this for more than a year now and it has worked flawlessly. I installed a new server on 2016-10-13 with no problem. When I did the same today, I got the following errors:

[ FAIL ] Install csgo-server: tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session.
Information! LGSM creates a tmux session when starting the server.

Tmux allows nested sessions.

Originally created by @CasperAlant on GitHub (Oct 25, 2016). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/1154 I run multiple LGSM servers on the same machine. I create a tmux session for each user and login with that user account and run LGSM as a nested session. I've been doing this for more than a year now and it has worked flawlessly. I installed a new server on 2016-10-13 with no problem. When I did the same today, I got the following errors: [ FAIL ] Install csgo-server: tmuxception error: Sorry Cobb you cannot start a tmux session inside of a screen session. Information! LGSM creates a tmux session when starting the server. Tmux allows nested sessions.
kerem 2026-02-27 02:54:14 +03:00
  • closed this issue
  • added the
    type: bug
    label
Author
Owner

@CasperAlant commented on GitHub (Oct 25, 2016):

I bypassed the error by commenting out the following lines in ~/lgsm/functions/check_tmuxception.sh:
fn_check_is_in_tmux
fn_check_is_in_screen

<!-- gh-comment-id:255940132 --> @CasperAlant commented on GitHub (Oct 25, 2016): I bypassed the error by commenting out the following lines in ~/lgsm/functions/check_tmuxception.sh: fn_check_is_in_tmux fn_check_is_in_screen
Author
Owner

@dgibbs64 commented on GitHub (Oct 25, 2016):

How are you running LGSM within a tmux session? Unless you are only using debug mode

<!-- gh-comment-id:255948431 --> @dgibbs64 commented on GitHub (Oct 25, 2016): How are you running LGSM within a tmux session? Unless you are only using debug mode
Author
Owner

@CasperAlant commented on GitHub (Oct 25, 2016):

  1. I ssh and login to my machine with my admin account.
  2. I create a tmux session.
  3. In the tmux session, I login with one of the LGSM user accounts I created.
  4. I run LGSM like normal (./csgoserver command). No debug mode.

The only funny part is when I run ./csgoserver console, the server console is a nested tmux session. So you need to double Ctrl+B to control the inner session.

<!-- gh-comment-id:255950732 --> @CasperAlant commented on GitHub (Oct 25, 2016): 1. I ssh and login to my machine with my admin account. 2. I create a tmux session. 3. In the tmux session, I login with one of the LGSM user accounts I created. 4. I run LGSM like normal (./csgoserver _command_). No debug mode. The only funny part is when I run ./csgoserver console, the server console is a nested tmux session. So you need to double Ctrl+B to control the inner session.
Author
Owner

@UltimateByte commented on GitHub (Oct 25, 2016):

How come does it even work ? Other people got errors all around. What's the point of nesting tmux sessions ?

<!-- gh-comment-id:256001278 --> @UltimateByte commented on GitHub (Oct 25, 2016): How come does it even work ? Other people got errors all around. What's the point of nesting tmux sessions ?
Author
Owner

@CasperAlant commented on GitHub (Oct 25, 2016):

I've never received any errors doing this. The only problem I can recall is to give LGSM user accounts permission to usermod -a -G tty user.

My reason for doing this is so that I don't need to login to the LGSM user account every time I want to change or do something on a server.

I have an open tmux session for every server like this:
casper@_host-machine_:~$ tmux list-sessions
csgo_prac_server_1: 1 windows (created Tue Oct 25 06:53:32 2016) [204x61]
csgo_server_1: 1 windows (created Tue Oct 11 06:26:34 2016) [204x61]
csgo_server_2: 1 windows (created Tue Oct 11 06:39:57 2016) [204x61]
csgo_server_3: 1 windows (created Tue Oct 11 06:41:49 2016) [204x61]
csgo_server_4: 1 windows (created Tue Oct 11 06:43:03 2016) [204x61]
csgo_server_5: 1 windows (created Tue Oct 11 06:44:31 2016) [204x61]
csgo_server_6: 1 windows (created Tue Oct 11 06:45:33 2016) [204x61]
csgo_server_7: 1 windows (created Tue Oct 11 06:55:44 2016) [204x61]
csgo_server_8: 1 windows (created Tue Oct 11 06:56:50 2016) [204x61]

Each of the sessions is logged into a user account with the same name. Those user accounts are my LGSM accounts, each running a game server.

I'm running Ubuntu Server 15.10 with tmux 2.0.

<!-- gh-comment-id:256012835 --> @CasperAlant commented on GitHub (Oct 25, 2016): I've never received any errors doing this. The only problem I can recall is to give LGSM user accounts permission to usermod -a -G tty _user_. My reason for doing this is so that I don't need to login to the LGSM user account every time I want to change or do something on a server. I have an open tmux session for every server like this: casper@**_host-machine**_:~$ tmux list-sessions csgo_prac_server_1: 1 windows (created Tue Oct 25 06:53:32 2016) [204x61] csgo_server_1: 1 windows (created Tue Oct 11 06:26:34 2016) [204x61] csgo_server_2: 1 windows (created Tue Oct 11 06:39:57 2016) [204x61] csgo_server_3: 1 windows (created Tue Oct 11 06:41:49 2016) [204x61] csgo_server_4: 1 windows (created Tue Oct 11 06:43:03 2016) [204x61] csgo_server_5: 1 windows (created Tue Oct 11 06:44:31 2016) [204x61] csgo_server_6: 1 windows (created Tue Oct 11 06:45:33 2016) [204x61] csgo_server_7: 1 windows (created Tue Oct 11 06:55:44 2016) [204x61] csgo_server_8: 1 windows (created Tue Oct 11 06:56:50 2016) [204x61] Each of the sessions is logged into a user account with the same name. Those user accounts are my LGSM accounts, each running a game server. I'm running Ubuntu Server 15.10 with tmux 2.0.
Author
Owner

@UltimateByte commented on GitHub (Oct 25, 2016):

Well, issues happen with tmux < 2.0 for sure, debian 8 for example uses tmux 1.9 and this fails.

Here is for example the output people will usually got when trying to nest tmux sessions together:

ultimatebyte@game:~$ ./gmodserver start
[ INFO ] Starting gmod-server: Steam login not set. Using anonymous login.
session not found: gmod-server
[ FAIL ] Starting gmod-server: Unable to start LinuxGSM
[ FAIL ] Starting gmod-server: Unable to start LinuxGSM: Tmux error:

Command
=================================
tmux new-session -d -s "gmod-server" "./srcds_run -game garrysmod -strictportbind -ip 164.132.201.49 -port 27015 -tickrate 66 +host_workshop_collection  -authkey  +clientport 27005 +tv_port 27020 +gamemode sandbox +map gm_construct +sv_setsteamaccount  +servercfgfile gmod-server.cfg -maxplayers 16 +r_hunkalloclightmaps 0"

Error
=================================
sessions should be nested with care, unset $TMUX to force

Fix
=================================
ultimatebyte is not part of the tty group.

        tty:x:5:

Run the following command with root privileges.

        usermod -G tty ultimatebyte

https://gameservermanagers.com/tmux-op-perm

So i'm personally OK to allow tmux inside tmux (even if i think it's incredibly stupid) if we can find the condition that determines if it will work or not. My guess is that it's not as simple as checking tmux version, but i could be wrong.

<!-- gh-comment-id:256052026 --> @UltimateByte commented on GitHub (Oct 25, 2016): Well, issues happen with tmux < 2.0 for sure, debian 8 for example uses tmux 1.9 and this fails. Here is for example the output people will usually got when trying to nest tmux sessions together: ``` ultimatebyte@game:~$ ./gmodserver start [ INFO ] Starting gmod-server: Steam login not set. Using anonymous login. session not found: gmod-server [ FAIL ] Starting gmod-server: Unable to start LinuxGSM [ FAIL ] Starting gmod-server: Unable to start LinuxGSM: Tmux error: Command ================================= tmux new-session -d -s "gmod-server" "./srcds_run -game garrysmod -strictportbind -ip 164.132.201.49 -port 27015 -tickrate 66 +host_workshop_collection -authkey +clientport 27005 +tv_port 27020 +gamemode sandbox +map gm_construct +sv_setsteamaccount +servercfgfile gmod-server.cfg -maxplayers 16 +r_hunkalloclightmaps 0" Error ================================= sessions should be nested with care, unset $TMUX to force Fix ================================= ultimatebyte is not part of the tty group. tty:x:5: Run the following command with root privileges. usermod -G tty ultimatebyte https://gameservermanagers.com/tmux-op-perm ``` So i'm personally OK to allow tmux inside tmux (even if i think it's incredibly stupid) if we can find the condition that determines if it will work or not. My guess is that it's not as simple as checking tmux version, but i could be wrong.
Author
Owner

@cedarlug commented on GitHub (Oct 25, 2016):

I believe the distinction here is that we want to prevent the end-user of lgsm from running tmux inside of tmux.

But what @CasperAlant wants to do is to run tmux as the super-lgsm user where he then su's to the actual lgsm end-user to fire up the game-specific tmux session.

So if the the TMUX environment is set, but the tmux pty isn't owned by the current user (owned by "casper" instead of csgoserver, for example), then allow it?

<!-- gh-comment-id:256087738 --> @cedarlug commented on GitHub (Oct 25, 2016): I believe the distinction here is that we want to prevent the end-user of lgsm from running tmux inside of tmux. But what @CasperAlant wants to do is to run tmux as the super-lgsm user where he then su's to the actual lgsm end-user to fire up the game-specific tmux session. So if the the TMUX environment is set, but the tmux pty isn't owned by the current user (owned by "casper" instead of csgoserver, for example), then allow it?
Author
Owner

@CasperAlant commented on GitHub (Oct 25, 2016):

Yes, @cedarlug, that is how I run my lgsm servers.

I just did a test where I logged in as a LGSM user, started a tmux session as that user and ran ./csgoserver start. In this case, it does indeed throw an error as @UltimateByte described:

[  OK  ] Console csgo-server: Starting
sessions should be nested with care, unset $TMUX to force
<!-- gh-comment-id:256091600 --> @CasperAlant commented on GitHub (Oct 25, 2016): Yes, @cedarlug, that is how I run my lgsm servers. I just did a test where I logged in as a LGSM user, started a tmux session as that user and ran _./csgoserver start_. In this case, it does indeed throw an error as @UltimateByte described: ``` [ OK ] Console csgo-server: Starting sessions should be nested with care, unset $TMUX to force ```
Author
Owner

@cedarlug commented on GitHub (Oct 25, 2016):

@CasperAlant - do you sudo su csgo_server_1 or ???

You shouldn't have any errors if you included the dash: sudo su - csgo_server_1 and then start the game as usual.

How do you switch to your sub accounts?

<!-- gh-comment-id:256098373 --> @cedarlug commented on GitHub (Oct 25, 2016): @CasperAlant - do you `sudo su csgo_server_1` or ??? You shouldn't have any errors if you included the dash: `sudo su - csgo_server_1` and then start the game as usual. How do you switch to your sub accounts?
Author
Owner

@dgibbs64 commented on GitHub (Oct 25, 2016):

@CasperAlant It would be a good idea if you could work with us to ensure that we can still prevent users from starting LGSM within a tmux session but still being able to achieve your goal. Since @cedarlug appears to know what you need to do it would be great if you guys could collaborate on this and put forward a fix for this. I'm am happy to accept a pull requests for this issue

<!-- gh-comment-id:256105588 --> @dgibbs64 commented on GitHub (Oct 25, 2016): @CasperAlant It would be a good idea if you could work with us to ensure that we can still prevent users from starting LGSM within a tmux session but still being able to achieve your goal. Since @cedarlug appears to know what you need to do it would be great if you guys could collaborate on this and put forward a fix for this. I'm am happy to accept a pull requests for this issue
Author
Owner

@UltimateByte commented on GitHub (Oct 25, 2016):

Well in your case it's not a stupid usage at all but rather a controlled and clever way, so don't take account for what i said before.
So @CasperAlant @cedarlug feel free to pull request (to devbranch) needed changes so that this usage is allowed.
https://github.com/GameServerManagers/LinuxGSM/blob/development/lgsm/functions/check_tmuxception.sh

<!-- gh-comment-id:256127004 --> @UltimateByte commented on GitHub (Oct 25, 2016): Well in your case it's not a stupid usage at all but rather a controlled and clever way, so don't take account for what i said before. So @CasperAlant @cedarlug feel free to pull request (to devbranch) needed changes so that this usage is allowed. https://github.com/GameServerManagers/LinuxGSM/blob/development/lgsm/functions/check_tmuxception.sh
Author
Owner

@cedarlug commented on GitHub (Oct 25, 2016):

It may already allow what @CasperAlant wants to do. @CasperAlant, could you describe how you're transitioning from the casper account to the game-specific accounts? (See my question above.)

<!-- gh-comment-id:256209497 --> @cedarlug commented on GitHub (Oct 25, 2016): It may already allow what @CasperAlant wants to do. @CasperAlant, could you describe how you're transitioning from the casper account to the game-specific accounts? (See my question above.)
Author
Owner

@CasperAlant commented on GitHub (Oct 26, 2016):

I log in using su as you described. With or without the dash, ${TERM} is still set to "screen" which caused fn_check_is_in_screen to trigger. The last commit I made allows checking for a screen session without this issue.

<!-- gh-comment-id:256323539 --> @CasperAlant commented on GitHub (Oct 26, 2016): I log in using `su` as you described. With or without the dash, ${TERM} is still set to "screen" which caused _fn_check_is_in_screen_ to trigger. The last commit I made allows checking for a screen session without this issue.
Author
Owner

@UltimateByte commented on GitHub (Nov 9, 2016):

This has been merged to master. Please re-open if it's not fixed, but should be fine now.

<!-- gh-comment-id:259312464 --> @UltimateByte commented on GitHub (Nov 9, 2016): This has been merged to master. Please re-open if it's not fixed, but should be fine now.
Author
Owner

@lock[bot] commented on GitHub (Jul 19, 2018):

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

<!-- gh-comment-id:406138557 --> @lock[bot] commented on GitHub (Jul 19, 2018): This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Sign in to join this conversation.
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#905
No description provided.