raphael / linux-samus

Linux 4.16 on Chromebook Pixel 2015
GNU General Public License v2.0
181 stars 36 forks source link

sound.sh fails and enabling sound step by step fails at pulsaudio restart #136

Closed pierater closed 8 years ago

pierater commented 8 years ago

I am currently on kernel version 4.4.2-6 and have had zero luck with sound. When I run sound.sh everything executes fine with no error messages, yet no sound comes from speakers or headphones. So next I tried the step by step and pulseaudio fails to restart giving me this output,

W: [pulseaudio] sink.c: Default and alternate sample rates are the same.

W: [pulseaudio] source.c: Default and alternate sample rates are the same.

W: [pulseaudio] alsa-ucm.c: UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'for device Mic, assuming stereo duplex.

W: [pulseaudio] alsa-ucm.c: UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'for device Headphone, assuming stereo duplex.

E: [pulseaudio] alsa-ucm.c: No sink and source at HiFi: Mic

E: [pulseaudio] alsa-ucm.c: No sink and source at HiFi: Headphone

E: [pulseaudio] socket-server.c: bind(): Address already in use

E: [pulseaudio] module.c: Failed to load module "module-native-protocol-unix" (argument: ""): initialization failed.

E: [pulseaudio] main.c: Module load failed.

E: [pulseaudio] main.c: Failed to initialize daemon.

Any ideas? Anyone have sound working for them? Debugging pulseaudio and alsa-ucm is difficult as there isn't much out there. alsaucm is able to find the soundcard bdw-rt5677, and also contains the verb HiFi, so I am not sure where to go from here. Thanks.

nskaggs commented 8 years ago

It might be useful to remove pulseaudio and alsa completely (and purge them and there config files!), then re-install. Once they are re-installed in a clean state, re-run the script. I know this sounds weird, but I had a problem with my microphone I was attempting to solve using the sound script (I think I manually set things up way back when), and it gave me similar errors to what you are seeing. I purged all configs, removed the packages and installed them again. Re-running the script after that completed successfully.

gwillem commented 8 years ago
E: [pulseaudio] socket-server.c: bind(): Address already in use

Sounds like another instance was still running. Verify what/where is bound by running strace? And check ports or sockets with netstat or lsof -p

pierater commented 8 years ago

@nskaggs purging all of alsa and pulseaudio allowed the sound.sh to run successfully. Although now sound is completely gone... The result of pacmd set-default-sink 1 returns a Sink 1 does not exist checking pacmd confirms that there are no other sinks. Any ideas?

nskaggs commented 8 years ago

@pierater You did re-install alsa and pulseaudio and reboot after before running sound.sh right? :-) The sinks should exist once the driver is loaded.

pierater commented 8 years ago

@nskaggs Thanks for the heads up, turns out I didn't reboot...But after redoing everything again, I get more errors when trying to start up pulseaudio. W: [pulseaudio] source.c: Default and alternate sample rates are the same. W: [pulseaudio] alsa-ucm.c: UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'for W: [pulseaudio] alsa-ucm.c: UCM file does not specify 'PlaybackChannels' or 'CaptureChannels'for E: [pulseaudio] alsa-ucm.c: No sink and source at HiFi: Mic E: [pulseaudio] alsa-ucm.c: No sink and source at HiFi: Headphone E: [pulseaudio] socket-server.c: bind(): Address already in use E: [pulseaudio] module.c: Failed to load module "module-native-protocol-unix" (argument: ""): in E: [pulseaudio] main.c: Module load failed. E: [pulseaudio] main.c: Failed to initialize daemon.

raphael commented 8 years ago

Have you tried @gwillem's suggestions? https://github.com/raphael/linux-samus/issues/136#issuecomment-223147041

pierater commented 8 years ago

strace.txt lsof.txt

@raphael @gwillem I just tried your suggestion and I don't quite understand what I am supposed to be looking for. Could you help?

ehegnes commented 8 years ago

@pierater, that strace log seems rather sparse (and all on one line). Can you you post an strace obtained by running strace -o pa-strace.log [pulseaudio command]? A log from pulseaudio -vvv might also be helpful.

That EsounD protocol socket (/tmp/.esd-1000/socket) listed in lsof.txt might have been handled ungracefully and could be causing E: [pulseaudio] socket-server.c: bind(): Address already in use. I can't tell without an strace, but try removing it manually.

I suspect the additional issues are config problems. sound.sh may have finished without error, but what are the contents of /etc/pulse/default.pa?

pierater commented 8 years ago

@ehegnes Thanks for the response. I think I fixed my E: [pulseaudio] socket-server.c: bind(): Address already in use issue by running pulseaudio -k until I got Failed to kill deamon: No such process. Here are my new logs using strace properly, and my default.pa. (files are .txt because github doesn't allow a .log to be uploaded) pa-vvv.txt pa-strace.txt default.txt

ehegnes commented 8 years ago

For some awful (understandable) reason, strace only prints the first 32 bytes of strings that aren't filenames, so the error messages are truncated too much. @pierater, sorry for the trouble, but can you redo the strace using strace -s 256 -o [log file] [pulseaudio command]? Also, can you upload the output from pulseaudio -vvv without stracing it?

For what it's worth, your default.pa file seems fine.

pierater commented 8 years ago

Here are the files, and this is no trouble, I'm glad to be helped!

256strace.txt vvv.txt

ehegnes commented 8 years ago
W: [pulseaudio] sink.c: Default and alternate sample rates are the same.

This may be fixed by setting the following lines in /etc/pulse/daemon.conf:

default-sample-rate = 44100
alternate-sample-rate = 48000

Alternatively, comment each line by prepending a semicolon to the line, allowing PA to use default values.

@pierater, after running a diff on your output from pulseaudio -vvv against mine, I realized that your setup was successfully loading the UCM configuration from /usr/share/alsa/ucm/bdw-rt5677, but mine was not. Strange, right? I didn't have the bdw-rt5677 direcotry present, and looking at sound.sh, it seems that there is nothing that actually copies linux-samus/scripts/setup/sound/ucm to /usr/share/alsa/ucm. When I copied the files manually, my sound stopped working!

Did you manually copy those files? Try removing the bdw-rt5677 directory from your ALSA UCM directory and see if your sound works after a PA restart.

If this is indeed the culprit, then I must ask why these UCM files are being maintained...

pierater commented 8 years ago

So I removed the bdw-rt5677 directory, and commented out all the lines in my daemon.conf and still nothing :-( When running pulseaudio -D I get no output and seems to run successfully. Afterwards when I run pulseaudio I get these errors Daemon already running. and pa_pid_file_create() failed. If I kill pulseaudio with pulseaudio -k and run pulseaudio I get errors Default and alternate sample rates are the same at sink.c and source.c. Same error for when I comment out everything and set the default/alternate sample rates.

ehegnes commented 8 years ago

pulseaudio -D will daemonize the process, so you won't actually see any output and you won't be able to see if it loaded properly, because the process is forked. Running pulseaudio after that will fail, because the daemon is already running. So this behavior is expected, at least.

After some reading, I'm not worried about the sample rate messages — they're just warnings. This also applies to the UCM warnings, since stereo duplexing has been the fallback for years.

@pierater, is E: [pulseaudio] module.c: Failed to load module "module-native-protocol-unix" (argument: ""): initialization failed. no longer an issue for you?

Since properly installing the UCM files, I am being plagued by the same errors:

E: [pulseaudio] alsa-ucm.c: No sink and source at HiFi: Mic
E: [pulseaudio] alsa-ucm.c: No sink and source at HiFi: Headphone

I'm currently compiling pulseaudio with debugging symbols so I can understand where it is failing, and I will update with any results.

pierater commented 8 years ago

The E: [pulseaudio] module.c: Failed to load module "module-native-protocol-unix" (argument: ""): initialization failed. error has gone away for now, probably from deleting the bdw directory.

gwillem commented 8 years ago

FWIW, thinking they must belong there, I too copied the UCM files to /usr/share/alsa/ucm/bdw-rt5677 and it broke my audio. I purged those files, rebooted, reran the sound.sh script and I fiddled a bit with pavucontrol (changing output device and volume) before it started working again. Sorry, only did it once so can't tell which steps were crucial.

pierater commented 8 years ago

Woo! @gwillem suggestion to re-run sound.sh and mess with pavucontrol worked perfectly. I have headphones and speakers working. I just need to manually switch between the two with pavucontrol.

ehegnes commented 8 years ago

@pierater that is a relief, because, after quite a bit of fiddling in gdb, I tracked the biggest issue (...No sink and source at HiFi...) to a bug in snd_soc_sst_bdw_rt5677_mach, and I had no clue where to go from there.

Has anybody had success with UCM? Did it work in a previous kernel version?

If nobody has been able to use UCM after copying the appropriate files (which sound.sh does not do), it seems to me as though the UCM portions of sound.sh, along with the UCM files in this repo, should be removed to protect against this kind of confusion.

gwillem commented 8 years ago

I did have to issue ALSA_CONFIG_UCM=<linux-samus-repo>/scripts/setup/sound/ucm/ alsaucm -c bdw-rt5677 set _verb HiFi once to get anything out of my speakers (I didn't run sound.sh directly as it wasn't compatible with Ubuntu then).

raphael commented 8 years ago

closing this as it doesn't apply to the latest release.