MiniDLNA - Erro ao Iniciar o serviço no Arch Linux: Permissão negada

Publicado por Clodoaldo Silva em 23/09/2015

[ Hits: 5.591 ]

 


MiniDLNA - Erro ao Iniciar o serviço no Arch Linux: Permissão negada



Aqui vai mais uma contribuição minha para o VOL.

Bom, instalando o servidor de mídia MiniDLNA no Arch Linux me deparei com o seguinte erro:

sudo systemctl status minidlna.service -l

● minidlna.service - minidlna server
   Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; vendor preset: disabled)
   Active: active (running) since Dom 2015-09-06 11:27:36 BRT; 5s ago
Main PID: 3259 (minidlnad)
   CGroup: /system.slice/minidlna.service
           └─5568 /usr/bin/minidlnad -S

Set 06 11:27:35 hArcHer minidlnad[4964]: inotify.c:92: error: inotify_add_watch(/home/usuario/video/aulas) [Permissão negada]
Set 06 11:27:35 hArcHer minidlnad[4964]: inotify.c:92: error: inotify_add_watch(/home/usuario/music/SelecaoRock) [Permissão negada]
Set 06 11:27:35 hArcHer minidlnad[4964]: inotify.c:92: error: inotify_add_watch(/home/usuario/video/filmes) [Permissão negada]
Set 06 11:27:35 hArcHer minidlnad[4964]: inotify.c:92: error: inotify_add_watch(/home/usuario/images/fotos) [Permissão negada]
Set 06 11:27:36 hArcHer systemd[1]: Started minidlna server.


O serviço inicia porém o programa não lê as mídias dentro das pastas configuradas. Tentei ajustar permissões das pastas compartilhadas pelo MiniDLNA no arquivo /etc/minidlna.conf mas não resolveu.

Resolvi parando o serviço com o comando:

sudo systemctl stop minidlna.service

Depois editando (como root) os arquivos de configuração do MiniDLNA como segue abaixo:

Alterar a linha "user=minidlna" padrão de instalação para "user=root":

sudo vi /etc/minidlna.conf

# specify the user account name or uid to run as
user=root

Alterar também o "User=minidlna e Group:minidlna" para "User=root e Group:wheel":

sudo vi /usr/lib/systemd/system/minidlna.service

[Service]
Type=simple
User=root
Group=wheel
ExecStart=/usr/bin/minidlnad -S
ProtectSystem=full
ProtectHome=off
PrivateDevices=on
NoNewPrivileges=off

Após alterar os arquivos executar os seguintes comandos:

Iniciando o MiniDLNA (caso você receba uma mensagem de Warning conforme abaixo, faça um daemon-reload):

sudo systemctl start minidlna.service
Warning: minidlna.service changed on disk. Run 'systemctl daemon-reload' to reload units.

sudo systemctl daemon-reload
sudo systemctl start minidlna.service
sudo systemctl status minidlna.service -l

• minidlna.service - minidlna server
   Loaded: loaded (/usr/lib/systemd/system/minidlna.service; enabled; vendor preset: disabled)
   Active: active (running) since Dom 2015-09-06 11:36:27 BRT; 12s ago
Main PID: 3939 (minidlnad)
   CGroup: /system.slice/minidlna.service
           ├─3939 /usr/bin/minidlnad -S
           └─3941 /usr/bin/minidlnad -S

Set 06 11:36:27 hArcHer systemd[1]: Started minidlna server.
Set 06 11:36:28 hArcHer minidlnad[3939]: minidlna.c:1026: warn: Starting MiniDLNA version 1.1.4.
Set 06 11:36:28 hArcHer minidlnad[3939]: minidlna.c:355: warn: Creating new database at /var/cache/minidlna/files.db
Set 06 11:36:28 hArcHer minidlnad[3939]: minidlna.c:1065: warn: HTTP listening on port 8200


Para maiores informações de como instalar o MiniDLNA segue abaixo o link do nosso amigo tsuriu do VOL:
Outras dicas deste autor
Nenhuma dica encontrada.
Leitura recomendada

LaTeX: Cabeçalho com numeração de páginas

i3-gaps no Funtoo

Linux Mint atualizando versões 17 e 17.1 para 17.2 Rafaela

Como proteger servidores que rodam SSH

Instalação do driver da nVidia no sidux

  

Comentários
[1] Comentário enviado por M_Miranda em 24/09/2015 - 22:47h

Olá Clodoaldo.

Vou dar uma dica com base na minha experiência de mais de 2 anos de uso do meu servidor miniDLNA. Porém em outra distribuição, no caso o openSUSE.

Pra começo tive alguns problemas com o pacote da distribuição, então decidi baixo o binário estático: http://sourceforge.net/projects/minidlna/?source=typ_redirect
Feito isso descompactei e copiei os arquivos para os seus respectivos diretórios, no caso são o /etc /usr/sbin /usr/share. O diretório database por comodidade preferi usa-lo do diretório /opt, e na hora de editar o arquivo /etc/minidlna.conf eu linkei a base de dados para o diretório que eu criei (/opt/MiniDLNA/database).

Sem esquecer que com o pacote nativo também tive problema na hora de iniciar o serviço, até descobrir que era por causa de algum erro no script para iniciar o serviço no systemd. E como eu já não estava usando mesmo o pacote da distro, tive que me virar em criar outro script. Não sei se está nos padrões mas funcionou (e funciona) muito bem. Veja como ficou:


[Unit]
Description=UPNP Server MiniDLNA
After=var-run.mount nss-lookup.target network.target remote-fs.target

[Service]
Type=forking
ExecStart=/usr/sbin/minidlnad -f
ExecStop=/bin/kill -TERM $MAINPID

[Install]
WantedBy=multi-user.target


Além da alteração do diretório database, fiz outras alterações também no arquivo minidlna.conf.
Veja como ficou:


# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200

# network interfaces to serve, comma delimited
#network_interface=eth0

# set this to the directory you want scanned.
# * if have multiple directories, you can have multiple media_dir= lines
# * if you want to restrict a media_dir to a specific content type, you
# can prepend the type, followed by a comma, to the directory:
# + "A" for audio (eg. media_dir=A,/home/jmaggard/Music)
# + "V" for video (eg. media_dir=V,/home/jmaggard/Videos)
# + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
#
media_dir=/home/Marcio/Share

# set this if you want to customize the name that shows up on your clients
friendly_name=Tobby Media Center

# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
db_dir=/var/cache/minidlna
db_dir=/opt/MiniDLNA/database

# set this if you would like to specify the directory where you want MiniDLNA to store its log file
#log_dir=/var/log
log_dir=/var/log

# set this to change the verbosity of the information that is logged
# each section can use a different level: off, fatal, error, warn, info, or debug
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn

# this should be a list of file names to check for when searching for album art
# note: names should be delimited with a forward slash ("/")
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

# set this to no to disable inotify monitoring to automatically discover new files
# note: the default is yes
inotify=yes

# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO
enable_tivo=yes

# set this to strictly adhere to DLNA standards.
# * This will allow server-side downscaling of very large JPEG images,
# which may hurt JPEG serving performance on (at least) Sony DLNA products.
strict_dlna=yes

# default presentation url is http address on port 80
presentation_url=http://192.168.1.134/index.php

# notify interval in seconds. default is 895 seconds.
notify_interval=0

# serial and model number the daemon will report to clients
# in its XML description
serial=12345678
model_number=1

# specify the path to the MiniSSDPd socket
#minissdpdsocket=/var/run/minissdpd.sock

# use different container as root of the tree
# possible values:
# + "." - use standard container (this is the default)
# + "B" - "Browse Directory"
# + "M" - "Music"
# + "V" - "Video"
# + "P" - "Pictures"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
root_container=B


E é assim, e desde então uso a mais de 2 anos o "Tobby Media Center" com 6.883 arquivos divido entre filmes, musicas, desenhos animados, vídeos de família, etc rodando na minha Panasonic Viera numa boa.
Já fiz testes de acesso simultâneo e consegui assistir o mesmo filme na TV (40 pol), e em mais 4 Smartphone sem gargalo nenhum. E o hardware é quase nada, um Atom D525, 2 GB de RAM, e HD de 1 TB e isso montado num gabinete de plástico DELL antigo de um Pentium 3 que com a ajuda da minha mini-retifica consegui alocar o novo hardware nele. :D

Me perdoa erros na formatação do texto, é meu primeiro texto aqui no VOL. Espero ter sido útil.

[2] Comentário enviado por cldoarclnx em 25/09/2015 - 08:54h


[1] Comentário enviado por M_Miranda em 24/09/2015 - 22:47h

Olá Clodoaldo.

Vou dar uma dica com base na minha experiência de mais de 2 anos de uso do meu servidor miniDLNA. Porém em outra distribuição, no caso o openSUSE.

Pra começo tive alguns problemas com o pacote da distribuição, então decidi baixo o binário estático: http://sourceforge.net/projects/minidlna/?source=typ_redirect
Feito isso descompactei e copiei os arquivos para os seus respectivos diretórios, no caso são o /etc /usr/sbin /usr/share. O diretório database por comodidade preferi usa-lo do diretório /opt, e na hora de editar o arquivo /etc/minidlna.conf eu linkei a base de dados para o diretório que eu criei (/opt/MiniDLNA/database).

Sem esquecer que com o pacote nativo também tive problema na hora de iniciar o serviço, até descobrir que era por causa de algum erro no script para iniciar o serviço no systemd. E como eu já não estava usando mesmo o pacote da distro, tive que me virar em criar outro script. Não sei se está nos padrões mas funcionou (e funciona) muito bem. Veja como ficou:


[Unit]
Description=UPNP Server MiniDLNA
After=var-run.mount nss-lookup.target network.target remote-fs.target

[Service]
Type=forking
ExecStart=/usr/sbin/minidlnad -f
ExecStop=/bin/kill -TERM $MAINPID

[Install]
WantedBy=multi-user.target


Além da alteração do diretório database, fiz outras alterações também no arquivo minidlna.conf.
Veja como ficou:


# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200

# network interfaces to serve, comma delimited
#network_interface=eth0

# set this to the directory you want scanned.
# * if have multiple directories, you can have multiple media_dir= lines
# * if you want to restrict a media_dir to a specific content type, you
# can prepend the type, followed by a comma, to the directory:
# + "A" for audio (eg. media_dir=A,/home/jmaggard/Music)
# + "V" for video (eg. media_dir=V,/home/jmaggard/Videos)
# + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)
#
media_dir=/home/Marcio/Share

# set this if you want to customize the name that shows up on your clients
friendly_name=Tobby Media Center

# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
db_dir=/var/cache/minidlna
db_dir=/opt/MiniDLNA/database

# set this if you would like to specify the directory where you want MiniDLNA to store its log file
#log_dir=/var/log
log_dir=/var/log

# set this to change the verbosity of the information that is logged
# each section can use a different level: off, fatal, error, warn, info, or debug
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn

# this should be a list of file names to check for when searching for album art
# note: names should be delimited with a forward slash ("/")
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

# set this to no to disable inotify monitoring to automatically discover new files
# note: the default is yes
inotify=yes

# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO
enable_tivo=yes

# set this to strictly adhere to DLNA standards.
# * This will allow server-side downscaling of very large JPEG images,
# which may hurt JPEG serving performance on (at least) Sony DLNA products.
strict_dlna=yes

# default presentation url is http address on port 80
presentation_url=http://192.168.1.134/index.php

# notify interval in seconds. default is 895 seconds.
notify_interval=0

# serial and model number the daemon will report to clients
# in its XML description
serial=12345678
model_number=1

# specify the path to the MiniSSDPd socket
#minissdpdsocket=/var/run/minissdpd.sock

# use different container as root of the tree
# possible values:
# + "." - use standard container (this is the default)
# + "B" - "Browse Directory"
# + "M" - "Music"
# + "V" - "Video"
# + "P" - "Pictures"
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root
root_container=B


E é assim, e desde então uso a mais de 2 anos o "Tobby Media Center" com 6.883 arquivos divido entre filmes, musicas, desenhos animados, vídeos de família, etc rodando na minha Panasonic Viera numa boa.
Já fiz testes de acesso simultâneo e consegui assistir o mesmo filme na TV (40 pol), e em mais 4 Smartphone sem gargalo nenhum. E o hardware é quase nada, um Atom D525, 2 GB de RAM, e HD de 1 TB e isso montado num gabinete de plástico DELL antigo de um Pentium 3 que com a ajuda da minha mini-retifica consegui alocar o novo hardware nele. :D

Me perdoa erros na formatação do texto, é meu primeiro texto aqui no VOL. Espero ter sido útil.


Obrigado M_Miranda pela dica, muito interessante e será de grande importância para os linuxusers interessados em servidor de mídia.



Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts