Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: get user cache dir: neither $XDG_CACHE_HOME nor $HOME are defined #391

Closed
Glandos opened this issue Oct 13, 2023 · 3 comments
Closed

Comments

@Glandos
Copy link

Glandos commented Oct 13, 2023

gonic version: 0.16

if from docker, docker tag:
if from source, git tag/branch: b17e76e

It seems that a669ba8 introduced os.UserCacheDir() which fails.

I expect gonic to use cache-path from the configuration.

@sentriz
Copy link
Owner

sentriz commented Oct 13, 2023

oh interesting. which OS?

@Glandos
Copy link
Author

Glandos commented Oct 13, 2023

Debian/testing, but I think that this "particular setup" comes from my systemd unit:

root@belette64/u/l/bin> systemctl cat gonic.service
# /etc/systemd/system/gonic.service
[Unit]
Description=Gonic Subsonic API server
After=network.target

[Service]
Type=simple
DynamicUser=yes
Group=nas

StateDirectory=gonic
CacheDirectory=gonic
ConfigurationDirectory=gonic

Restart=on-failure
RestartSec=10

ExecStart=/usr/local/bin/gonic -config-path /etc/gonic/config

MemoryDenyWriteExecute=true

# See https://github.com/sentriz/gonic/issues/391
Environment=XDG_CACHE_HOME=/var/cache/gonic/

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/gonic.service.d/00security.conf
[Service]
SystemCallFilter=@system-service
PrivateDevices=yes
ProtectHome=yes
ProtectSystem=strict
PrivateUsers=yes
PrivateTmp=yes
NoNewPrivileges=yes
ProtectClock=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectProc=invisible
ProcSubset=pid
CapabilityBoundingSet=
RestrictRealtime=yes
ProtectHostname=yes
RestrictNamespaces=yes
LockPersonality=yes
RestrictSUIDSGID=yes
ProtectControlGroups=yes
RemoveIPC=yes
SystemCallArchitectures=native

Adding the Environment= line makes it happy though :)

@sentriz
Copy link
Owner

sentriz commented Oct 13, 2023

hm I suppose that since you created a specific gonic user without a home dir, there was no xdg cache dir found.

yeah I think you're right in reusing the cache-path for the MPV socket is best. since it's required to be defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants