Pulse Audio not working if terminal logged out
I hope some experts can assist with solving my problem
My application runs on a stand-alone embedded system and doesn't require to be logged on to operate. My application starts at boot time and is a standalone app running on an isolated embedded system. It monitors data on a COM port and needs to play a wav file under certain circumstances, triggered by data from the COM port. I am running Crunchbang O/S 1 - When the system boots my application starts under root, but there is no audio 2 - If I login to a terminal session there is still no audio 3 - If I restart the application under my logged-in account there is audio 4 - If I log out, there is no audio again 5 - If I log in to the terminal again, audio works again My app runs as UID of root This is the error message produced when my app calls aplay when I am logged out: "sending: /usr/bin/aplay" Code:
Invalid MIT-MAGIC-COOKIE-1 keyxcb_connection_has_error() returned true "sending: /usr/bin/aplay" Code:
Playing WAVE '/usr/mms/cfg/audio_files/12-1-10-1' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Code:
1000 4441 1 0 11:04 ? 00:00:00 pnmixer I think I need pulse audio (and maybe other sound related programs) to start as root when the system is booted, rather than when a user logs in. I read articles advising against this, but my app is a standalone app running on an isolated embedded system, so I have weighed up the risks. Does this sound feasible, and can anybody advise how I get pulseaudio (and other required audio processes) to start at boot-time on Crunchbang? I am very new to Linux. Thank you all VideoTrack |
As an easy fix you could install screen. That's a small command line application that allows you to "disconnect" from a terminal session without actually logging out. All process you started in the screen session will just continue running as if you were still logged in.
So you could Code:
apt-get install screen Code:
screen Then logout and enjoy. Oh, and if you want to reattach type Code:
screen -r |
Thanks Joe for the idea, appreciated.
My application runs remotely, if there is a power outage, it needs to automatically start and work when the power is restored. That's why the app is started automatically from /etc/rcx.d/ folders. Because the app is remote in the field, it's not possible to travel to it if there was a power outage, or even to know if there had been a power outage in the first place. Regards VideoTrack |
Hmm, to tell the truth I am not very experienced with pulse audio, but after a bit of searching I came across this guide here:
http://rudd-o.com/linux-and-free-sof...all-your-users To me this looks like it is what you are looking for... |
Joe Thank you for your support, it is really appreciated
My system doesn't have the file: /etc/event.d/pulseaudio I did find a file: /etc/init.d/pulseaudio The file seems to be the correct one, but I haven't a clue where to insert the additional text. Is anybody able to review the content below and suggest where the insertion should occur? Many thanks VideoTrack Code:
#!/bin/sh -e Code:
start on runlevel [2345] |
Hmm, I think you have identified the right files. I do not know enough about the Fedora init system to give you a reliable answer.
But e.g. this part Code:
start on runlevel [2345] But what becomes clear from the site is that pulse audio by default requires a user to be logged in, which is in line with your findings. Unless someone else here steps in I can see two possible options for you 1) use your favorite search engine to find a similar guide that works for the debian init system 2) read up on how to write init scripts under debian and translate yourself. You may find the following resources useful for the second option https://www.debian-administration.org/articles/28 https://wiki.debian.org/LSBInitScripts |
All times are GMT -5. The time now is 01:53 PM. |