lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.94k stars 272 forks source link

Idle check fails (says always idle) when SERVER_PUBLIC = false and PUID != 0 #413

Closed Tremolo4 closed 3 years ago

Tremolo4 commented 3 years ago

Some time ago, my server stopped creating backups except when restarting, saying the server is always idle. Now I've finally figured out why.

I have SERVER_PUBLIC=false and PUID=something-non-root, so the idle check uses tcpdump. The problem is that only root can do tcpdump and when it fails, the script assumes that the server is idle when it's actually not:

tcpdump: eth0: You don't have permission to capture on that device
(socket: Operation not permitted)

Log gives the following, even though I am on the server at that moment and have also been on the 29th.

Sep 30 23:00:09 supervisord: valheim-backup DEBUG - [71] - Received signal to backup world
Sep 30 23:00:09 supervisord: valheim-backup DEBUG - [71] - Not running backup as there has been no server activity since Tue 28 Sep 2021 10:32:04 PM UTC

We should at least make it so that when tcpdump fails for other reasons than "no packets", it is assumed that the server is NOT idle. I'll try to look into that, but I wanted to post this issue first.

lloesche commented 3 years ago

@Tremolo4 thank you for the issue and @solacelost thank you for the PR that fixes it. Waiting for all tests to become green in #417.