You are not logged in.

#1 2014-07-31 07:41:09

isabido
Member
Registered: 2014-07-29
Posts: 5

[SOLVED] ALSA equal "Operation not permitted"

I need to start a script at startup to run sound through a PCM type EQUAL.

I created the alsaequal package from the AUR repository.
https://aur.archlinux.org/packages/alsaequal/

I tried to try on a newly installed Arch X86, seems to be a permissions issue when trying to access the pcm from a non-interactive session.
If I run a SSH session and leave it running as a daemon, it works perfectly, but if I try to load from systemd to have it in the boot, there is no way to make it work.

For example:

/ usr/bin/aplay-D equal /root/piano2.wav

But if it is run from the "units" start as a service, displays an error that does not have permissions to access the pcm.equal.

[Unit]
Description=Aplay test

[Service]
ExecStart=/bin/bash -c '/usr/bin/aplay-D equal /root/piano2.wav'

[Install]
WantedBy=multi-user.target

Error to start unit:

[root@localhost ~]# systemctl status aplay
   aplay.service - Aplay test
   Loaded: loaded (/etc/systemd/system/aplay.service; disabled)
   Active: failed (Result: exit-code) since jue 2014-07-31 09:14:40 CEST; 22min ago
  Process: 1167 ExecStart=/sbin/bash -c /usr/bin/aplay -D equal /root/piano2.wav (code=exited, status=1/FAILURE)
Main PID: 1167 (code=exited, status=1/FAILURE)

jul 31 09:14:40 localhost bash[1167]: aplay: main:722: audio open error: Operation not permitted
jul 31 09:14:40 localhost systemd[1]: aplay.service: main process exited, code=exited, status=1/FAILURE
jul 31 09:14:40 localhost systemd[1]: Unit aplay.service entered failed state.


and this asound settings
/etc/asound.conf

ctl.equal {
type equal;
}

pcm.plugequal {
  type equal;
  slave.pcm "plug:dmix";

}
pcm.equal {
  type plug;
  slave.pcm plugequal;
}


Greetings and sorry for my bad English.

Last edited by isabido (2014-07-31 11:45:31)

Offline

#2 2014-07-31 11:44:02

isabido
Member
Registered: 2014-07-29
Posts: 5

Re: [SOLVED] ALSA equal "Operation not permitted"

This is the solution:
Add User=root under service

[Unit]
Description=Aplay test
[Service]
Add User=root
ExecStart=/bin/bash -c '/usr/bin/aplay-D equal /root/piano2.wav'
[Install]
WantedBy=multi-user.target

[root@localhost ~]# systemctl status aplay
â aplay.service - Aplay test
   Loaded: loaded (/etc/systemd/system/aplay.service; disabled)
   Active: active (running) since jue 2014-07-31 13:12:45 CEST; 4s ago
Main PID: 535 (aplay)
   CGroup: /system.slice/aplay.service
           ââ535 /usr/bin/aplay -D equal /root/piano2.wav

jul 31 13:12:45 localhost bash[535]: Playing WAVE '/root/piano2.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo


Thanks to user moonman from http://archlinuxarm.org/

Offline

#3 2014-08-01 00:06:08

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [SOLVED] ALSA equal "Operation not permitted"

ExecStart=/bin/bash -c '/usr/bin/aplay-D equal /root/piano2.wav'

Seems like there is a space missing:

ExecStart=/bin/bash -c '/usr/bin/aplay -D equal /root/piano2.wav'

Which is also unnecessary, since you already globally set equal as default. Instead of 'Add User', the directive should be 'User'. Would 'Group=audio' alone be sufficient?

Offline

Board footer

Powered by FluxBB