Skip to content

[Bug]: Valheim Not Listening on Configured Port #4748

@gvschilling

Description

@gvschilling

User story

As a user, I want vhserver to listen on the configured gameport

Game

Valheim

Linux distro

Ubuntu 20.04

Command

command: start, command: details

Further information

My vhserver instance (running as a pod in k8s) is configured to run on the standard port 2456, but the server is listening on 33240 instead.

Relevant log output

./vhserver details:

Distro Details
============================================================================================================================================================
Date:         Tue Jan 14 21:46:47 UTC 2025
Distro:       Ubuntu 20.04.6 LTS
Arch:         x86_64
Kernel:       5.4.0-204-generic
Hostname:     [k8s pod name]
Environment:  docker
Uptime:       26d, 2h, 25m
tmux:         3.0a
glibc:        2.31

Server Resource
============================================================================================================================================================
CPU
Model:      Intel(R) Xeon(R) E-2124 CPU @ 3.30GHz
Cores:      4
Frequency:  3900.000MHz
Avg Load:   7.17, 6.17, 5.77

Memory
Mem:       total  used  free   cached  available
Physical:  55GB   32GB  23GB   8.0GB   23GB
Swap:      8.0GB  94MB  8.0GB

Storage
Filesystem:  /dev/rbd14
Total:       98G
Used:        2.4G
Available:   96G

Network
IP:           0.0.0.0
Internet IP:  [public ip]

Valheim Resource Usage
============================================================================================================================================================
CPU Used:  177%
Mem Used:  1%    608MB

Storage
Total:        2.4G
Serverfiles:  2.3G

Valheim Server Details
============================================================================================================================================================
Server name:      [server name]
App ID:           896660
Server IP:        0.0.0.0:2456
Internet IP:      [public ip]:2456
Server password:  [server password]
Game world:       vhserver
Save interval:    1800s
Master server:    not listed
Status:           STARTED

vhserver Script Details
============================================================================================================================================================
Script name:       vhserver
LinuxGSM version:  v24.3.4
glibc required:    2.15
Discord alert:     off
Email alert:       off
Gotify alert:      off
IFTTT alert:       off
Pushbullet alert:  off
Pushover alert:    off
Rocketchat alert:  off
Slack alert:       off
Telegram alert:    off
Update on start:   off
User:              linuxgsm
Location:          /opt/linuxgsm

Backups
============================================================================================================================================================
No Backups created

Command-line Parameters
============================================================================================================================================================
 ./valheim_server.x86_64 -name '[server name]' -password [server password] -port 2456 -world vhserver -public 0 -savedir '/opt/linuxgsm/.config/unity3d/IronGate/Valheim' -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 -crossplay -instanceid 1

Ports
============================================================================================================================================================
Change ports by editing the parameters in:
/opt/linuxgsm/lgsm/config-lgsm/vhserver

Useful port diagnostic command:
ss -tuplwn | grep valheim_server.

DESCRIPTION  PORT  PROTOCOL  LISTEN
Game         2456  udp       0
Query        1     udp       0

Status: STARTED

ss -tuplwn | grep valheim_server

udp     UNCONN   0        0                0.0.0.0:2457           0.0.0.0:*      users:(("valheim_server.",pid=38028,fd=46))

udp     UNCONN   0        0                0.0.0.0:49582          0.0.0.0:*      users:(("valheim_server.",pid=38028,fd=50))

udp     UNCONN   0        0                      *:33240                *:*      users:(("valheim_server.",pid=38028,fd=45))

tcp     LISTEN   0        128            127.0.0.1:46109          0.0.0.0:*      users:(("valheim_server.",pid=38028,fd=33))

Steps to reproduce

  1. Create a new vhserver instance as a Kubernetes service
  2. In the service's ports spec, have a non-standard port be setup to forward towards the standard port, i.e.:
ports:
- name: game
  nodePort: 30000
  port: 2456
  protocol: UDP
  targetPort: 2456
  1. Have the container, as a statefulset, be set to listen to the standard port, i.e.:
containers:
- name: {{ .Chart.Name }}
  securityContext:
    {{- toYaml .Values.securityContext | nindent 12 }}
  image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
  imagePullPolicy: {{ .Values.image.pullPolicy }}
  ports:
  - name: game
    containerPort: 2456
    protocol: UDP
  1. Have port-forwarding setup at the router-level so that inbound traffic to port 30000 goes to the Kubernetes cluster
  2. Start the server
  3. Run the ss -tuplwn | grep valheim_server command
  4. Notice that the listening port is not 2456
  5. Have users attempt to connect to [public ip address]:30000
  6. Users fail to connect

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions