[Permission denied] on btrfs subvolume folder

Help
2014-07-28
2014-08-01
  • Randall Flagg
    Randall Flagg
    2014-07-28

    Hello,

    I have my files in a subvolume on a btrfs filesystem.
    When I configure a media folder in a subvolume, I receive:

    service minidlna restart
    [....] Restarting DLNA/UPnP-AV media server: minidlna[2014/07/20 13:11:46] >minidlna.c:474: error: Media directory "/<btrfs>/<subvolume>/mediatest/" not accessible! [Permission denied]

    When doing the same on "/<btrfs>/mediatest/", it works.
    For testing, I changed permissions to 777 and chown'd to my user, minidlna, root, no help.
    (Soft-)Linking the folder inside the subvolume elsewhere, and using that link on miniupnp doesn't work neither.

    All active lines in my conf:

    media_dir=/media/<btrfs>/mediatest/
    media_dir=/media/<btrfs>/<subvolume>/mediatest/
    log_level=warn
    network_interface=eth0
    port=8200
    friendly_name=minidlna
    serial=12345678
    model_number=1
    inotify=yes
    album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg
    notify_interval=60

    I'm starting to wonder if miniupnpd is incompatible with btrfs subvolumes? That doesn't make any sense, does it?

    Grateful for any hints and help!

    -Randall

     
  • Justin Maggard
    Justin Maggard
    2014-07-29

    Doesn't make any sense to me. We use btrfs subvolumes extensively on ReadyNAS, and we don't see this. Does anything change if you start the daemon from the command line with the -d option?

     
  • Randall Flagg
    Randall Flagg
    2014-07-30

    Weird, in daemon -d mode it actually works.
    With sudo only, for rw access to pid and the database itself, but with sudo it works with no errors whatsoever. A full rescan with -d -R works as well.

    Closing the -d instance, and trying to start the regular daemon fails. I didn't touch anything in between.

    sudo service minidlna restart
    [....] Restarting DLNA/UPnP-AV media server: minidlna[2014/07/30 22:36:56] >minidlna.c:474: error: Media directory "###" not accessible! [Permission denied]

     
  • Justin Maggard
    Justin Maggard
    2014-07-31

    Which distro? Perhaps the startup script changes UID.

     
  • Randall Flagg
    Randall Flagg
    2014-07-31

    I agree, it must be something with the startup script.
    I'm on Debian Wheezy, kernel 3.14-0.bpo.1-amd64.

    I read that minidlna runs as "nobody" by default.

    How can I set the user in Debian?
    In /etc/minidlna.conf is no option to define the user, and a simple "USER=123" is not recognized.

     
  • Randall Flagg
    Randall Flagg
    2014-07-31

    I finally figured it out!
    I can define the username in the startup script (but not in the config?). To run as a user, it also needs permissions for the PID file, logfile and media cache. I set this in the script as well, as some of those folders vanish after a reboot on my system (because they are on a ram tmpfs).

    This means my problem had nothing to do with the filesystem, it was a permission problem of folders and subfolders, where it's somewhat unclear what user minidlna runs as.

    sudo nano /etc/minidlna.conf
    uncomment:

    db_dir=/var/lib/minidlna
    log_dir=/var/log/minidlna

    sudo nano /etc/init.d/minidlna
    add:

    USER=randall
    mkdir /var/log/minidlna/ &> /dev/null
    chown -R randall:randall /var/log/minidlna/
    chown -R randall:randall /run/minidlna/
    chown -R randall:randall /var/lib/minidlna/

    Hope that helps others with the same problem!

    And thank you for your help, Justin!
    (I couldn't figure out how to set my initial post to "solved". Can you do that for me?)

    -Randall

     
    Last edit: Randall Flagg 2014-07-31
  • Justin Maggard
    Justin Maggard
    2014-08-01

    The wheezy version didn't have a user option in minidlna.conf, but the jessie package does.

    I don't believe the topic text is modifiable.