Skip to content

[BUG] Valheim backup doesn't backup the worlds #3300

Description

@jclc

User Story

After doing a few backups of my server, I checked the contents of the tarballs and noticed that they don't actually contain the worlds, which are by default located in ~/.config/.

Basic info

  • Distro: Centos
  • Game: Valheim
  • Command: [Backup]
  • LinuxGSM version: [latest]

To Reproduce

Steps to reproduce the behaviour:

  1. Run ./vhserver backup
  2. Run tar -tf <backup>
  3. Notice the lack of world files

Expected behaviour

Expected for the worlds to be listed.

I assume this can be fixed by changing the save location to be inside the server files directory, but saving the worlds regardless of save directory should be the default behaviour.

Activity

  1. added
    type: bug
    on Feb 24, 2021
  2. mattclaw commented on Feb 25, 2021

    @mattclaw

    Are you sure the version of the script you are running is latest? I think it'd be helpful to double check and share the exact version number in your issue.

    I set up a fresh install just last night and ran a test backup. This backup contains a .config directory which, in turn, contains several nested directories which ultimately house the world files. I recommend updating lgsm and trying again.

    This actually brings up a separate topic which might deserve its own issue... why does this backup script back up the installation of SteamCMD, the game, and miscellaneous support files? I can't think of a reason why I would want anything more than user-created data + configs.

    This decision results in a bloated backup artifact. Default retention could be increased way beyond the current default value of 4 backups / 30 days. My world file is a mere 40MB after a week of playing with 4-7 players. I expect over time it will grow, but it will be some time before its size approaches the ~900MB of data contained within serverfiles/.

  3. jclc commented on Feb 25, 2021

    @jclc
    Author

    I set up a fresh install just last night and ran a test backup. This backup contains a .config directory which, in turn, contains several nested directories which ultimately house the world files. I recommend updating lgsm and trying again.

    This is interesting, did you install the server directly in the home directory or in a subdirectory? I've installed the server in a subdirectory, not sure if that makes a difference. If it's fixed in the latest version then I suppose this issue can be closed.

    Personally I ended up moving the saves into the server directory since it's better to organise everything in one place anyway. The version of script I'm running doesn't have an option for the -savedir switch but that was easy to set up too.

    This actually brings up a separate topic which might deserve its own issue... why does this backup script back up the installation of SteamCMD, the game, and miscellaneous support files? I can't think of a reason why I would want anything more than user-created data + configs.

    Yes, I noticed this too and it is pretty annoying. There seems to be a few open issues for adding support for blacklisting files/directories from backups, though.

  4. mattclaw commented on Feb 25, 2021

    @mattclaw

    My install is bog standard; didn't deviate from the documented instructions, so yeah, there's a vhserver user and everything is installed directory into that user's home directory:
    image

    I am very new to this project, but I spent some time glancing at the scripts last night when I was trying to audit how lgsm works and how configurations work. If you're using a nonstandard file structure, perhaps you can override one of the config variables in your vhserver.cfg. I know there is a serverfiles variable which is widely used, but I'm not 100% sure that a config variable will solve your problem in the first place :/

  5. jclc commented on Feb 25, 2021

    @jclc
    Author

    I'm not using a nonstandard file structure, I've just installed the directory in a subdirectory rather than directly in $HOME. If the script looks for the default save directory relative to the installation directory, that is not acceptable.

  6. netstx commented on Mar 2, 2021

    @netstx

    You can look into the code and check if it does that.

  7. Xalorous commented on Mar 3, 2021

    @Xalorous

    If the script looks for the default save directory relative to the installation directory, that is not acceptable.

    The way the installation works, you can install ANYWHERE and the location you choose is the installroot. All of the other locations are relative to that location. Hardcoding $HOME/$USER as the installroot is restrictive. Suggesting $HOME/$USER is a great way to allow new admins or new linux users to stick to a standard configuration.

    I do this stuff (Senior Linux Admin and DevSecOps) for a living, my serveradmin for valheim is vhserver, my install path is /home/vhserver.

    [vhserver@sv-valheim backup]$ ll -a /home/vhserver
    total 56
    drwx------. 11 vhserver vhserver   261 Feb 13 17:04 .
    drwxr-xr-x.  4 root     root        35 Feb 11 20:51 ..
    -rw-------.  1 vhserver vhserver   597 Feb 19 15:23 .bash_history
    -rw-r--r--.  1 vhserver vhserver    18 Mar 31  2020 .bash_logout
    -rw-r--r--.  1 vhserver vhserver   193 Mar 31  2020 .bash_profile
    -rw-r--r--.  1 vhserver vhserver   231 Mar 31  2020 .bashrc
    drwxrwxr-x.  3 vhserver vhserver    18 Feb 11 20:51 .cache
    drwxrwxr-x.  4 vhserver vhserver    33 Feb 11 20:57 .config
    drwxrwxr-x.  9 vhserver vhserver   113 Feb 17 14:07 lgsm
    -rwxrwxr-x.  1 vhserver vhserver 15934 Feb 11 20:52 linuxgsm.sh
    drwxrwxr-x.  3 vhserver vhserver    19 Feb 11 20:54 .local
    drwxrwxr-x.  4 vhserver vhserver    49 Feb 11 20:53 log
    drwxr-xr-x.  4 vhserver vhserver    39 Jan  6  2019 .mozilla
    drwxrw----.  3 vhserver vhserver    19 Feb 11 20:52 .pki
    drwxrwxr-x.  6 vhserver vhserver  4096 Mar  2 05:03 serverfiles
    drwxrwxr-x.  5 vhserver vhserver    93 Mar  2 23:01 .steam
    -rwxrwxr-x.  1 vhserver vhserver 15936 Feb 11 20:52 vhserver
    -rw-------.  1 vhserver vhserver  1158 Feb 11 21:18 .viminfo
    
  8. foozmeat commented on Mar 9, 2021

    @foozmeat

    I just discovered this deficiency this morning while looking at moving my server to a new container. I installed lgsm into /opt/LinuxGSM and my backups are a good copy of that folder however they don't contain the contents of ~/.config/unity3d/IronGate/Valheim.

    One workaround would be to move the Valheim folder to inside of the LinuxGSM install folder and then symlink it back to the original location.

    Another workaround would be to add the following to common.cfg to override the save dir

    savedir=/opt/LinuxGSM/gamedata/vhserver
    startparameters="-name '${servername}' -password ${serverpassword} -port ${port} -world ${gameworld} -public ${public}"
    

    I think the second one is better as it matches the design pattern of lgsm.

  9. netstx commented on Mar 9, 2021

    @netstx

    This actually brings up a separate topic which might deserve its own issue... why does this backup script back up the installation of SteamCMD, the game, and miscellaneous support files? I can't think of a reason why I would want anything more than user-created data + configs.

    This decision results in a bloated backup artifact. Default retention could be increased way beyond the current default value of 4 backups / 30 days. My world file is a mere 40MB after a week of playing with 4-7 players. I expect over time it will grow, but it will be some time before its size approaches the ~900MB of data contained within serverfiles/.

    @mattclaw I think this is worthy of a new issue. I personally do container backups, but I agree the vhserver script backup should only save user generated data and configs. This makes for a lot smaller backups so you can keep many more versions without using tons of space.

  10. jclc commented on Mar 9, 2021

    @jclc
    Author

    Since apparently you cannot blacklist the Mono runtime from being added to the backup (#3298), I ended up writing a short backup script for myself as a workaround anyway.
    It assumes -savedir "<server dir>/savedir". Resulting archive takes up less than a tenth of the space LGSM's backup uses. Feel free to use it if you like. https://gist.github.com/jclc/6b8a75af0c6f5233331afb4f0ae58e89

  11. mattclaw commented on Mar 9, 2021

    @mattclaw

    @mattclaw I think this is worthy of a new issue. I personally do container backups, but I agree the vhserver script backup should only save user generated data and configs. This makes for a lot smaller backups so you can keep many more versions without using tons of space.

    I realized after making this comment that one reason for this behavior would be to preserve a mod setup. I have no idea whether this is actually the case, but I'm not sure if saves from modded servers can be guaranteed to be backwards-compatible with vanilla saves. Perhaps having the exact server binaries backed up is beneficial in the case you need to rebuild a modded server at a particular version? Even still, I'd argue that would be better as opt-in behavior rather than default.

    That's just my 2c as a newcomer to this project. If backing up all miscellaneous binaries and assets is an LGSM convention, it'd be inconsistent to make this change just to Valheim.

    I ended up writing a short backup script for myself as a workaround anyway.

    Going to yoink this, thanks so much.

  12. jclc commented on Mar 9, 2021

    @jclc
    Author

    Going to yoink this, thanks so much.

    Remember to close the server first if you're going to schedule it. I made a bash script that first closes the server, runs the script and then starts the server again and put that on crontab.

  13. added
    game: Valheim
    on Apr 6, 2021
  14. 7 remaining items

  15. dgibbs64 commented on Nov 1, 2026

    @dgibbs64
    Member

    Fixed in #5129. backup only archived the LinuxGSM folder, so Valheim worlds (kept in ~/.config/unity3d/IronGate/Valheim) were left out whenever the LinuxGSM folder is not the home folder, which is always the case in Docker. backup now adds the game's data folder when it is outside the LinuxGSM folder. The same fix covers Project Zomboid, Don't Starve Together, 7 Days to Die, Craftopia, SCP:SL and Barotrauma. This will be in the next release (v26.5.0). Thanks for the report.

  16. moved this from 🆕 New Issues to ✅ Done in LinuxGSM Backlogon Nov 1, 2026
  17. removed
    outcome: issue resolved
    on Nov 1, 2026
  18. moved this from ✅ Done to 📋 Sentenced Issues in LinuxGSM Backlogon Nov 1, 2026
  19. moved this from 📋 Sentenced Issues to 👀 In Review in LinuxGSM Backlogon Nov 1, 2026
  20. moved this from 👀 In Review to ✅ Done in LinuxGSM Backlogon Nov 4, 2026
  21. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    Released in v26.5.0 (#5152).

  22. removed
    status: fixed in develop
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

command: backupdistro: CentOSengine: unity3dgame: Valheimoutcome: issue resolvedtype: bug

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions