mpd start on boot on raspberrypi

Ask questions about Arch Linux ARM. Please search before making a new topic.

mpd start on boot on raspberrypi

Postby chittu » Tue May 03, 2016 1:46 am

I can't start mpd on boot with (on my raspberrypi, ARM)
$this->bbcode_second_pass_code('', 'sudo systemctl enable mpd')
because, mpd is running under some user (may be mpd itself a user? I don't know)
How to start mpd on boot under my user "username1" that has mpd database, playlists, etc.
chittu
 
Posts: 3
Joined: Tue May 03, 2016 1:45 am

Re: mpd start on boot on raspberrypi

Postby andiling » Tue May 03, 2016 6:42 am

In the service file you can set under [Service] with User= the account you want to start it with.
andiling
 
Posts: 69
Joined: Sun Mar 06, 2016 8:34 pm

Re: mpd start on boot on raspberrypi

Postby chittu » Tue May 03, 2016 7:01 am

@andiling could you please feed me more detail, as a noob it is hard for me edit service file, thank you
chittu
 
Posts: 3
Joined: Tue May 03, 2016 1:45 am

Re: mpd start on boot on raspberrypi

Postby andiling » Tue May 03, 2016 7:06 am

Edit /usr/lib/systemd/system/mpd.service and replace User=mpd with the account you want to use. Once done run systemctl daemon-reload that changes are loaded.
andiling
 
Posts: 69
Joined: Sun Mar 06, 2016 8:34 pm

Re: mpd start on boot on raspberrypi

Postby WarheadsSE » Tue May 03, 2016 2:18 pm

NO. Do not edit the distro files.

Use either a copy to /etc/systemd/system or a proper drop-in via /etc/systemd/system/mpd.service.d/myuser.conf
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: mpd start on boot on raspberrypi

Postby chittu » Wed May 04, 2016 2:14 am

@andiling thank you

the only method I got it working is to edit
$this->bbcode_second_pass_code('', '/usr/lib/systemd/system/mpd.service')
by replacing User=mpd to User=desiredusername

None of the other methods work, A copy of this file (/usr/lib/systemd/system/mpd.service) to
$this->bbcode_second_pass_code('', 'copy to /etc/systemd/system') or dropping the same file as $this->bbcode_second_pass_code('', '/etc/systemd/system/mpd.service.d/myuser.conf')

$this->bbcode_second_pass_code('', 'sudo systemctl enable mpd
results
Created symlink from /etc/systemd/system/default.target.wants/mpd.service to /usr/lib/systemd/system/mpd.service')

but I am surprised to note that if I manually create a file (/etc/systemd/system/default.target.wants/mpd.service) with User=desiredusername and leaving the original (/usr/lib/systemd/system/mpd.service) with User=mpd doesn't work. Both the file (/etc/systemd/system/default.target.wants/mpd.service) and (/usr/lib/systemd/system/mpd.service) should have User=desiredusername
chittu
 
Posts: 3
Joined: Tue May 03, 2016 1:45 am

Re: mpd start on boot on raspberrypi

Postby andiling » Wed May 04, 2016 6:48 am

The comment of @WarheadsSE is a valid one I suggested an easy but a bit dirty way.

However, you can copy the file e.g. by $this->bbcode_second_pass_code('', 'cp /usr/lib/systemd/system/mpd.service /usr/lib/systemd/system/mpduser.service') and do your modifications in the mpduser.service file. Accordingly then you should $this->bbcode_second_pass_code('', 'systemctl disable mpd.service
systemctl enable mpduser.service') (if mpd is running just reboot or stop mpd.service and start mpduser.service).
andiling
 
Posts: 69
Joined: Sun Mar 06, 2016 8:34 pm

Re: mpd start on boot on raspberrypi

Postby pepedog » Wed May 04, 2016 9:57 am

pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK


Return to User Questions

Who is online

Users browsing this forum: No registered users and 8 guests

cron