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

[Bug]: Rootless Podman Setup Throwing "attempt to write a readonly database" #2967

Open
3 tasks done
jollySleeper opened this issue Apr 22, 2024 · 4 comments
Open
3 tasks done
Labels
bug triage New bug reports that need to be evaluated

Comments

@jollySleeper
Copy link

I confirm that:

  • I have searched the existing open AND closed issues to see if an issue already exists for the bug I've encountered
  • I'm using the latest version (your issue may have been fixed already)

Version

v0.51.1

Current Behavior

Hi, I have installed NaviDrome using Podman and am trying to run rootless with non-root user using the following command:

podman run \
 --restart unless-stopped \
 --label io.containers.autoupdate=registry \
 --user $(id -u):$(id -g) \
 --env-file "$HOME/navidrome/local.env" \
 -p 127.0.0.1:4533:4533 \
 -v "$HOME/navidrome/data":/data \
 -v ${HOME}/media/music:/music \
 --name "navidrome" \
 docker.io/deluan/navidrome;

But am getting the following error.

time="2024-04-22T16:47:26Z" level=error msg="Error disabling foreign_keys" error="attempt to write a readonly database"
time="2024-04-22T16:47:26Z" level=fatal msg="Database could not be opened!" error="attempt to write a readonly database"

I have seen same issues reported by other users but did not find any solution.
Does Navidrome doesn't support running with Non-Root User??

PS:

  • Output of $(id -u) gives 1001 as my user-id is 1001 and not 1000.
  • And the data folder is owned by user.

Expected Behavior

Should Work

Steps To Reproduce

As Written Above

Environment

- OS: Ubuntu 24.04
- Browser: 
- Client: ?

How Navidrome is installed?

Docker

Configuration

No response

Relevant log output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow Navidrome's Code of Conduct
@jollySleeper jollySleeper added bug triage New bug reports that need to be evaluated labels Apr 22, 2024
@deluan
Copy link
Member

deluan commented Apr 22, 2024

Does Navidrome doesn't support running with Non-Root User??

Not completely sure about Podman, but for Docker: Yes it does. But you have to make sure that the /data volume is writable by the userid you choose.

If the path you choose to mount as /data does not exist when you first start the container, Docker will create it with its own permissions (usually root), and then mount it in the container. That causes Navidrome (running under the userid you choose) to not have write permissions on the /data folder (owned by root), leading to the errors you are seeing.

You can try doing this:

  • Stop the container
  • chown $(id -u):$(id -g) -R $HOME/navidrome/data
  • Start the container

If it is not working with Podman after this, I can't really help you as I don't use nor have an installation of Podman, and you better off reaching out to the community in Reddit, Discord or our GH Discussions

@jollySleeper
Copy link
Author

jollySleeper commented Apr 22, 2024

Yes I tried Multiple times before drafting this Issue. Even changed the ownership and gave 777 to db but just to get the same error again :(

Will try out more.

@deluan
Copy link
Member

deluan commented Apr 22, 2024

Try removing the $HOME/navidrome/data folder, and creating it with the correct permissions in the first place.

After doing this, I can get it running with my userid:

$ mkdir $HOME/data
$ docker run  --user $(id -u):$(id -g)  -p 127.0.0.1:4533:4533  -v "$HOME/data":/data  -v ${HOME}/music:/music  --name "navidrome" docker.io/deluan/navidrome
 _   _             _     _
| \ | |           (_)   | |
|  \| | __ ___   ___  __| |_ __ ___  _ __ ___   ___
| . ` |/ _` \ \ / / |/ _` | '__/ _ \| '_ ` _ \ / _ \
| |\  | (_| |\ V /| | (_| | | | (_) | | | | | |  __/
\_| \_/\__,_| \_/ |_|\__,_|_|  \___/|_| |_| |_|\___|
                          Version: 0.51.1 (6d253225)

time="2024-04-22T21:56:32Z" level=info msg="Creating DB Schema"
time="2024-04-22T21:56:33Z" level=info msg="Starting signaler"
time="2024-04-22T21:56:33Z" level=error msg="Agent not available. Check configuration" name=lastfm
time="2024-04-22T21:56:33Z" level=error msg="Agent not available. Check configuration" name=spotify
time="2024-04-22T21:56:33Z" level=info msg="Configuring Media Folder" name="Music Library" path=/music
time="2024-04-22T21:56:33Z" level=info msg="Creating Image cache" maxSize="100 MB" path=/data/cache/images
time="2024-04-22T21:56:33Z" level=info msg="Starting scheduler"
time="2024-04-22T21:56:33Z" level=info msg="Scheduling periodic scan" schedule="@every 1m"
time="2024-04-22T21:56:33Z" level=info msg="Running initial setup"
time="2024-04-22T21:56:33Z" level=info msg="Creating new JWT secret, used for encrypting UI sessions"
time="2024-04-22T21:56:33Z" level=info msg="Setting Session Timeout" value=24h
time="2024-04-22T21:56:33Z" level=info msg="Login rate limit set" requestLimit=5 windowLength=2
time="2024-04-22T21:56:33Z" level=info msg="Finished initializing cache" cache=Image elapsedTime=263.3ms maxSize=100MB
time="2024-04-22T21:56:34Z" level=info msg="Found ffmpeg" path=/usr/bin/ffmpeg
time="2024-04-22T21:56:34Z" level=info msg="Spotify integration is not enabled: missing ID/Secret"
time="2024-04-22T21:56:34Z" level=info msg="Mounting Native API routes" path=/api
time="2024-04-22T21:56:34Z" level=error msg="Agent not available. Check configuration" name=lastfm
time="2024-04-22T21:56:34Z" level=error msg="Agent not available. Check configuration" name=spotify
time="2024-04-22T21:56:34Z" level=info msg="Creating Transcoding cache" maxSize="100 MB" path=/data/cache/transcoding
time="2024-04-22T21:56:34Z" level=info msg="Finished initializing cache" cache=Transcoding elapsedTime="337.1µs" maxSize=100MB
time="2024-04-22T21:56:34Z" level=info msg="Mounting Subsonic API routes" path=/rest
time="2024-04-22T21:56:34Z" level=error msg="Agent not available. Check configuration" name=lastfm
time="2024-04-22T21:56:34Z" level=error msg="Agent not available. Check configuration" name=spotify
time="2024-04-22T21:56:34Z" level=info msg="Mounting Public Endpoints routes" path=/share
time="2024-04-22T21:56:34Z" level=info msg="Mounting LastFM Auth routes" path=/api/lastfm
time="2024-04-22T21:56:34Z" level=info msg="Mounting ListenBrainz Auth routes" path=/api/listenbrainz
time="2024-04-22T21:56:34Z" level=info msg="Mounting Background images routes" path=/backgrounds
time="2024-04-22T21:56:34Z" level=info msg="Mounting WebUI routes" path=/app
time="2024-04-22T21:56:34Z" level=info msg="----> Navidrome server is ready!" address="0.0.0.0:4533" startupTime=6.78s tlsEnabled=false

@andrewgdunn
Copy link

Have selinux on your system? your volume mounts should have :z or :Z appended to them if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage New bug reports that need to be evaluated
Projects
None yet
Development

No branches or pull requests

3 participants