CSGO icon indicating copy to clipboard operation
CSGO copied to clipboard

Can't connect to the server

Open Gryfenfer97 opened this issue 3 years ago • 18 comments

Hello,

I have the same issue than the #56 . I can't connect to the server in local. I've used docker run -d --net=host -v $(pwd)/csgo-data:/home/steam/csgo-dedicated/ --name=csgo-dedicated cm2network/csgo to connect (I haven't set SRCDS_TOKEN because everything is on the same computer).

I am running the container on ArchLinux and the logs seems normal :

sv_camera_fly_enabled - missing cvar specified in bspconvar_whitelist.txt
Executing dedicated server config file
Unknown command "sm_cvar"
Unknown command "sv_unlag"
Unknown command "tv_allow_camera_man"
maxplayers set to 64
Console: "> ESL GOTV Config loaded - 14.01.2016 <"
Unknown command "sm_cvar"
Unknown command "sv_unlag"
Unknown command "tv_allow_camera_man"
maxplayers set to 64
Console: "> ESL GOTV Config loaded - 14.01.2016 <"
exec: couldn't exec gamemode_competitive_server.cfg
PrecacheScriptSound 'Survival.VO.Taunt4a' failed, no such sound script entry
PrecacheScriptSound 'Snowball.Bounce' failed, no such sound script entry
CHostage::Precache: missing hostage models for map de_dust2. Adding the default models.
PrecacheScriptSound 'balkan_epic_blank' failed, no such sound script entry
Commentary: Could not find commentary data file 'maps/de_dust2_commentary.txt'. 
Error parsing BotProfile.db - unknown attribute 'Rank'
Error parsing BotProfile.db - unknown attribute 'Rank'
[S_API] SteamAPI_Init(): SteamAPI_IsSteamRunning() did not locate a running instance of Steam.
[S_API] SteamAPI_Init(): Loaded '/home/steam/.steam/sdk32/steamclient.so' OK.
CAppInfoCacheReadFromDiskThread took 1 milliseconds to initialize
Looking up breakpad interfaces from steamclient
Calling BreakpadMiniDumpSystemInit
SteamInternal_SetMinidumpSteamID:  Caching Steam ID:  76561198247692264 [API loaded yes]
SteamInternal_SetMinidumpSteamID:  Setting Steam ID:  76561198247692264
Setting breakpad minidump AppID = 740

Do you have any idea ? I probably haven't setup docker correctly, that's my first time using it.

Thank's.

Gryfenfer97 avatar Jan 24 '22 21:01 Gryfenfer97

I just tested the official nginx docker image and it worked perfectly. I was able to connect to the server, so I think the problem doesn't come from my docker install.

Gryfenfer97 avatar Jan 25 '22 15:01 Gryfenfer97

The server appears correctly in the list of community servers (LAN tab) but I still can't connect to it: connection failed after 30 retries.

Gryfenfer97 avatar Jan 25 '22 18:01 Gryfenfer97

The server appears correctly in the list of community servers (LAN tab) but I still can't connect to it: connection failed after 30 retries.

How are you trying to connect? Via console?

CM2Walki avatar Jan 25 '22 21:01 CM2Walki

I tested the both way, the console and the gui. I have the same error in both cases

Gryfenfer97 avatar Jan 26 '22 05:01 Gryfenfer97

Are you behind a NAT? Also did you use your private or public IP to connect via the console?

I haven't operated a csgo server in a local network, yet. But I have developed games with Steamworks before. The connection via the GUI will likely fail because Steam will publish your public IP (there is no way to overwrite this behavior) and without port forwarding on the router, you will fail to connect.

Connection via console should work if you utilize your PC's private IP.

CM2Walki avatar Jan 26 '22 12:01 CM2Walki

As the docker is on the same machine as csgo, I use connect 127.0.0.1 to connect to the server

Gryfenfer97 avatar Jan 26 '22 18:01 Gryfenfer97

Could try your local IP? It could be that this: https://github.com/CM2Walki/CSGO/blob/master/etc/entry.sh#L70-L71 Only listens to your private IP and not your loopback interface. Technically it should listen to both, but you never know 🤷.

CM2Walki avatar Jan 26 '22 18:01 CM2Walki

I've set my local ip (192.xx.xx.xx) for the variables SRCDS_NET_PUBLIC_ADDRESS and SRCDS_IP and it didn't change anything.

Gryfenfer97 avatar Jan 26 '22 19:01 Gryfenfer97

I actually managed to successfully connect to the server. The main point of the solution is to edit the value of sv_lan in the csgo/cfg/server.cfg file from 0 to 1.
Note that adding +sv_lan 1 as argument doesn't work.

Here is the full line I used to launch the server: docker run -d --net=host -v $(pwd)/csgo-data:/home/steam/csgo-dedicated/ -e SRCDS_PORT=27016 -e SRCDS_IP="0.0.0.0" -e SRCDS_PW="" --name=csgo-dedicated cm2network/csgo

Then to connect you must use the local address of your machine (not 127.0.0.1).

Last point for those who are using the same PC for the server and the game: the port 27015 seems to be already used (but I am not 100% sure about that ) so I used the port 27016.

Gryfenfer97 avatar Jan 26 '22 22:01 Gryfenfer97

See cb5a890410183b1b0a09d3e5474d91e72c45c21e, I removed sv_lan 0 from the config and added it to the environment variables instead. This should make it overwritable. Can you try again @Gryfenfer97?

CM2Walki avatar Feb 06 '22 12:02 CM2Walki

I don't really understand why but it doesn't change anything when it should work. The +sv_lan should overwrite the one in the config so I'm surprised that it doesn't work.

Changing it directly in the config still work however.

Edit: This is the command I used to start the container:

docker run -d --net=host \
        -v $(pwd)/${volume_name}:/home/steam/csgo-dedicated/ \
        -e SRCDS_PORT="$port" \
	-e SRCDS_TV_PORT="$tvport" \
        -e SRCDS_IP="$ip" \
        -e SRCDS_PW=""  \
        -e SRCDS_LAN=1 \
	--name=$1 \
        cm2network/csgo:sourcemod   

Gryfenfer97 avatar Feb 06 '22 14:02 Gryfenfer97

So just to clarify. You did remove it from your server.cfg and pulled the latest version of the image that passes it as a command line variable?

Unfortunately, I don't have a system where I can test local network things like this. So sorry for asking such trivial things.

CM2Walki avatar Feb 06 '22 14:02 CM2Walki

Hey, i'm also trying to get a local server up and can't seem to be able to connect to it even tho they are on the same machine. I'm using WSL on windows btw, don't know if that may have something to do with it, but other images are working fine, as @Gryfenfer97 also said.

I'm using a compose file to structure the setup:

version: '3'
services:
  csgo:
    image: cm2network/csgo
    container_name: csgo
    environment:
      - SRCDS_LAN="1"
      - SRDCS_IP="0.0.0.0"
      - SRCDS_PORT=27016
      - SRCDS_PW=""
    network_mode: host

Also, I've just tried deleting and pulling the lastet version of the image, and the SV_LAN option did not work as @CM2Walki said it should on the last pull request, I had to manually change it on the server.cfg file, but still couldn't connect.

Dezainer avatar Feb 07 '22 03:02 Dezainer

So just to clarify. You did remove it from your server.cfg and pulled the latest version of the image that passes it as a command line variable?

Unfortunately, I don't have a system where I can test local network things like this. So sorry for asking such trivial things.

No I didn't delete it from the server.cfg because the +sv_lan 1 should overwrite the variable in the server.cfg file. I just edited the variable in the server.cfg to make it work. However I will test this soon.

Gryfenfer97 avatar Feb 10 '22 06:02 Gryfenfer97

I actually managed to successfully connect to the server. The main point of the solution is to edit the value of sv_lan in the csgo/cfg/server.cfg file from 0 to 1.

This did not work for me. Had the issue that I could not connect to the server as: Server only accepting connections from game lobby was returned.

Already tried restarting the server and my game multiple times. I had used port 27015. Using another port doesn't seem to even give me any response from the server.

EDIT: (i got it to work through the server browser) I just used the server browser and although this was the command to start the server: podman run -d --net=host -v (pwd)/server:/home/steam/csgo-dedicated/ --name=csgo-ds3 -e SRCDS_RCONPW="testing" -e SRCDS_LAN="1" -e SRCDS_PORT=27016 -e SRCDS_IP="0.0.0.0" -e SRCDS_PW="" 689e0a485abc the server uses port 27017. This seems really weird.

michihupf avatar Feb 20 '22 19:02 michihupf

@michihupf check that you don't have another container running at the same time that is using the port ( docker container ls) If you try to start a server on the port n while another one is running on that same port, the server will start on the port n+1

Gryfenfer97 avatar Feb 23 '22 05:02 Gryfenfer97

A few notes:

  • I had to manually edit server.cfg to set sv_lan to 1. Without this, the error "only accepting connections from game lobby" kept popping up.
  • It appears that maybe the EXPOSE lines in the Dockerfile conflict with docker-compose? I saw weird behaviour with additional ports being forwarded even when I didn't include them in my ports configuration. I built a local version of the image without the EXPOSE statements, which appears to work fine.
  • I'm not sure it makes sense to use EXPOSE (which is supposed to be for documentation purposes only), considering that the actual ports in use depend on environment variables.
  • Host networking is not required for this to work.
  • I'm still trying to figure out which ports are required to forward so that the server shows up in the server browser. Not entirely sure this is possible as the process can't bind to a LAN address when running with container networking, and thus probably wouldn't know what IP to provide to the server browser.

teotwaki avatar Feb 23 '22 12:02 teotwaki

@michihupf check that you don't have another container running at the same time that is using the port ( docker container ls) If you try to start a server on the port n while another one is running on that same port, the server will start on the port n+1

I do not even have another container stopped which is the weird part. The only running container is this csgo container.

I had to manually edit server.cfg to set sv_lan to 1. Without this, the error "only accepting connections from game lobby" kept popping up.

I had the same issue this fixed it for me as well.

Edit: ~~Some additional info with a really weird behaviour: So basically I had the game open and connected to the server (it had used 27017 instead of 27016 - maybe the game used it or something?). After that I forgot about the server and went into a Dangerzone match with a friend. I got kicked because my files were not matching the game files of the Dangerzone server. I then closed my game but to my surprise Steam thought that I had the game running still until I shut down my local server container and restarted Steam.~~ This was actually caused by some launch paramenters that I had set on CS:GO. This was not an issue with this repository.

michihupf avatar Feb 23 '22 16:02 michihupf

Can confirm this is still an issue as of the writing of this comment. Despite SRCDS_LAN set to 1, I have to manually set sv_lan to 1 in server.cfg to connect.

kamild1996 avatar Jan 12 '23 17:01 kamild1996