On Tue, Sep 30, 2008 at 6:03 PM, Marius Hooge <[EMAIL PROTECTED]> wrote: > Nick Guenther wrote: >> >> Aaah, I didn't realize how the user's homedir interacted with this >> all. What must have been happening is that when I clicked 'play' in >> soundtracker (which was running as myself) it looked for ~/.esd_auth, >> didn't find it, so tried to spawn an esd, which promptly failed >> because the other esd already had the soundcard. >> All it took was: >> ln -sf /var/empty/.esd_auth ~/.esd_auth >> and now both mpd and soundtracker can play at once. There's some lag >> when I first hit play but that's probably because right now it's >> running with tcp and autospawning which probably are eating at it >> quite a bit. >> >> I am going to play around some more and see if I can get esd running >> as a system-wide daemon. >> >> Weird, I just tried to run esd with "-noterminate" but it said >> "unrecognized option: -noterminate". The esd that packages installed >> for me is "Esound version 0.2.34", what are you running? >> > > I'm running 0.2.38v0, but I'm pretty shure, that this worked before. Try > 'man esd'
USAGE esd [options] -d DEVICE force esd to use sound device DEVICE -b run server in 8 bit sound mode -r RATE run server at sample rate of RATE -as SECS free audio device after SECS of inactivity -unix use unix domain sockets instead of tcp/ip -tcp use tcp/ip sockets instead of unix domain -public make tcp/ip access public (other than localhost) -promiscuous start unlocked and owned (disable authenticaton) NOT RECOMMENDED -terminate terminate esd daemon after last client exits -nobeeps disable startup beeps -trust start esd even if use of /tmp/.esd can be insecure -port PORT listen for connections at PORT (only for tcp/ip) -bind ADDRESS binds to ADDRESS (only for tcp/ip) -v --version print version information I can get -noterminate by omitting -terminate, it's not a big deal, I was just curious. >> >> >> If I don't tell mplayer "ao=esd" then it grabs /dev/audio directly >> (and works fine). >> Do you know how to debug this? >> > > Well, if I leave 'ao=esd' out, mplayer / libao tries to open /dev/audio > (which is busy) and falls back to esd. > Esd should be listed if you type 'mplayer -ao help'. > Did you link ~/.esd/socket to /var/empty/.esd/socket? It turns out I hadn't actually installed mplayer-esd, I forgot FLAVOR=esd when I did 'make install' (I had it when I did `make`). Oops. Egg on face &c. >> Thank you for all the help so far, I had given up on esd. >> -Nick > > I was pretty lost at first, too. You can still try running everything as > yourself, as a last resort. > > I wish installation of sound mixers would be a bit more straight forward, > like replacing or redirecting /dev/audio, > but I'm afraid we're out of luck with that.. > I've figured it out! I'd gotten as far as getting everything -except- mpd to play nicely. First I moved mpd's homedir to /var/mpd instead of /var/empty. I created /var/esd for esd to live in and decided that /var/esd/esd_auth would hold the "real" auth file and everyone else would get `ln -s /var/esd/esd_auth ~/.esd_auth`. Then I made a .esd_auth created somehow (esdplay in any user's account that doesn't have the symlink created will do it) and copy it in. Testing with mplayer and soundtracker showed that they worked fine, whether running as myself, another user, or _mpd, but mpd itself would constantly complain "/var/mpd/.esd_auth: File exists" which is a frustratingly-zen sort of message. Just now though as I was googling I came across my first post to this thread and noticed "it seems that mpd chroots itself" and the lightbulb went off. When I log in as _mpd I can follow symlinks out fine, but mpd can't. So now I've just changed it around so that /var/mpd/.esd_auth is the real file and everything else is a symlink to it, and it seems to be working. It's a bit flakey though, for example I need to chgrp _esd /var/mpd/.esd_auth && chmod g+r /var/mpd/.esd_auth in order for non-mpd users to use esd. Also, because of the chroot and how esd puts its socket in whatever homedir it was run from it is more reliable to use -tcp ((if not -tcp, then must not use -terminate and must make sure _mpd is the user to spawn esd)). This isn't a very nice solution. The other thing I was thinking was to run a script that copies out .esd_auth files to a bunch of users. I think a way better way would be to change esd itself to create its auth files when it starts, instead of having the client do it. That way if you start esd with the system you could handle fanning out, but autospawning could still be made to work. esd is so old though, it's probably not worth fighting that out. This whole "auth with a cookie" scheme seems weird when it's the client supplying the server with the cookie. So, for reference, here's my working configuration: $ ls -la /var/mpd/ total 24 drwxr-xr-x 5 _mpd _mpd 512 Sep 30 23:56 . drwxr-xr-x 27 root wheel 512 Sep 30 14:49 .. -rw-r----- 1 _mpd _esd 16 Sep 30 23:56 .esd_auth $ ls -la /var/esd/ total 8 drwxrwxr-x 2 root _esd 512 Sep 30 23:42 . drwxr-xr-x 27 root wheel 512 Sep 30 14:49 .. lrwxr-xr-x 1 root _esd 18 Sep 30 23:42 esd_auth -> /var/mpd/.esd_auth $ ls -la /home/kerry/.esd* lrwxr-xr-x 1 kerry kerry 17 Sep 30 16:54 .esd_auth -> /var/esd/esd_auth $ ls -la /home/kousu/.esd* lrwxr-xr-x 1 kousu kousu 17 Sep 30 23:43 /home/kousu/.esd_auth -> /var/esd/esd_auth $ group info _mpd name _mpd passwd * gid 560 members $ group info _esd name _esd passwd * gid 1006 members _mpd kousu kerry $ cat /etc/esd.conf [esd] auto_spawn=1 spawn_options=-tcp -terminate -nobeeps -as 2 spawn_wait_ms=100 $ cat /etc/libao.conf default_driver=esd $ cat /etc/mpd.conf [i am currently using the stock mpd.conf (except for changing the music_dir, of course)] Here's what has to happen whenever /var/mpd/.esd_auth gets deleted: $ mpc play #make mpd play something in order to recreate .esd_auth $ sudo chgrp _esd /var/mpd/.esd_auth && sudo chmod g+r /var/mpd/.esd_auth Here's what has to happen to add a new user: $ sudo usermod -G _esd ${USER} $ sudo ln -sf /var/esd/esd_auth ${HOME}/.esd_auth I am curious to try setting up esd running under its own user, but I'm really glad to have got it working now and I don't want to break it (at least not tonight). -Nick