Hello. im new on this forum. My name is Mirko and i
m from Argentina.
Y installed DietPi (i`m very satisfied whit this OS performance on my raspberry Pi B+ model) whit no video interface (headless). I acces it, by ssh.
I can start and stop vlc web server via terminal commands.
uname -a returns:
dietpi@xxx:~$ uname -a
Linux DietPiServer 4.14.49+ #1120 Wed Jun 13 16:51:11 BST 2018 armv6l GNU/Linux
All is perfect until I disconnect the ssh terminal. The service stop inmediately.
I need a service that start on boot and remains active.
Searching with my friend google, i found systemd process to create custom services. I`m trying to learn this method, because rc.local in this version is deprecated (or not recommenden at least).
I created the following files:
/etc/vlc/start.sh
(script to run VLC as non root user(VLC requirement), with the desired host, port and password, this last mandatory).
#!/bin/sh
echo "Starting WEB Interface for VLC...."
sudo -u dietpi vlc -I http --http-password 123
May be I will use cvlc (command line without interface )
This file have execution privileges.
/etc/systemd/system/vlc.service
(Systemd service file) with 755 and X privileges.
[Unit]
Description=VLC WEB Interface Service
After=network.target
[Service]
Type=forking
ExecStart=/etc/vlc/start.sh
Restart=on-abort
[Install]
WantedBy=multi-user.target
Running de .sh script directly returns:
dietpi@xxx:/etc/systemd/system$ sudo /etc/vlc/start.sh
Starting WEB Interface for VLC....
VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
[00616e68] pulse audio output error: PulseAudio server connection failure: Connection refused
[00636c48] core interface error: no suitable interface module
[0057a918] core libvlc error: interface "globalhotkeys,none" initialization failed
[00636cb0] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00636cb0] core interface error: no suitable interface module
[0057a918] core libvlc error: interface "dbus,none" initialization failed
[00636cb0] [http] lua interface: Lua HTTP interface
The WEB Interface is up, and I can explore my dietpi User_data folder with some mp3, ogg, etc songs. Sounds very good with de jack output (remember, no HDMI output).
The terminal is locked until I press Ctrl+C. At this point the Interface gets down.
Now, when I execute:
sudo systemd start vlc.service
the Web Interface is Up again… but the service locks the terminal for around one minute and after this time, I got this message:
dietpi@xxx:/etc/systemd/system$ sudo systemctl start vlc.service
Job for vlc.service failed because a timeout was exceeded.
See "systemctl status vlc.service" and "journalctl -xe" for details.
Asking for a service status ends in this:
dietpi@xxx:/etc/systemd/system$ sudo systemctl status vlc.service
● vlc.service - VLC WEB Interface Service
Loaded: loaded (/etc/systemd/system/vlc.service; disabled; vendor preset: enabled)
Active: failed (Result: timeout) since Mon 2018-06-18 21:40:35 -03; 1min 34s ago
Process: 2980 ExecStart=/etc/vlc/start.sh (code=killed, signal=TERM)
CGroup: /system.slice/vlc.service
jun 18 21:39:06 xxx start.sh[2980]: [00e15918] core libvlc error: interface "globalhotkeys,none" initia
lization failed
jun 18 21:39:06 xxx start.sh[2980]: [00ed1cb0] dbus interface error: Failed to connect to the D-Bus ses
sion daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
jun 18 21:39:06 xxx start.sh[2980]: [00ed1cb0] core interface error: no suitable interface module
jun 18 21:39:06 xxx start.sh[2980]: [00e15918] core libvlc error: interface "dbus,none" initialization
failed
jun 18 21:39:06 xxx start.sh[2980]: [00ed1cb0] [http] lua interface: Lua HTTP interface
jun 18 21:40:35 xxx systemd[1]: vlc.service: Start operation timed out. Terminating.
jun 18 21:40:35 xxx systemd[1]: [color=#FF0080]Failed to start VLC WEB Interface Service.[/color]
jun 18 21:40:35 xxx systemd[1]: vlc.service: Unit entered failed state.
jun 18 21:40:35 xxx systemd[1]: vlc.service: Failed with result 'timeout'.
jun 18 21:40:36 xxx sudo[2981]: pam_unix(sudo:session): session closed for user dietpi
dietpi@xxx :/etc/systemd/system$
I know that I`m doing something in the wrong way. Can Someone guide me to fix this problem? May be, whit some help on this issue, I can will put all together and build a pretty tutorial.
Thankyou in advance.
Mirko