Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Possible Alsa-Kernel bug "Segmentation fault" (Read 1337 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[SOLVED] Possible Alsa-Kernel bug "Segmentation fault"

Hello I tried to be as most descriptive as I can, feel free to change the subject or move anywhere. The thing is I have a problem with my soundcard that does not recognize the headset mic properly. Then I started "hdajackretask" to fix it and I found that I got a "segmentation fault".

Then I went to scripts located in /tmp and ran it manually. The problematic command is this:

Code: [Select]
#echo 1 | tee /sys/class/sound/hwC0D0/reconfig

You should get a "segmentation fault" and the machine became unresponsive, that's mean "poweroff" and "reboot" commands does not work. The only way to back is keep pushing the power button until the computer poweroff and reboot again.

Other information that could be useful:

Code: [Select]
uname -a
Linux a3seclaptop 5.7.10-artix1-1 #1 SMP PREEMPT Thu, 23 Jul 2020 15:41:52 +0000 x86_64 GNU/Linux

Code: [Select]
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC256 Analog [ALC256 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Code: [Select]
dmesg | grep snd
[    2.437774] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[    2.545113] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    2.593111] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC256: line_outs=1 (0x1b/0x0/0x0/0x0/0x0) type:speaker
[    2.593112] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    2.593113] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    2.593114] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    2.593115] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    2.593116] snd_hda_codec_realtek hdaudioC0D0:      Headset Mic=0x19
[    2.593116] snd_hda_codec_realtek hdaudioC0D0:      Internal Mic=0x1a
[    2.593117] snd_hda_codec_realtek hdaudioC0D0:      Internal Mic=0x13

I don't know if anyone else has the same problem. If so, is this the right please to report?

Best regards.
Artix Linux Colombia

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #1
Code: [Select]
# echo 1 > /sys/class/sound/hwC0D0/reconfig
bash: echo: write error: Device or resource busy
#  echo 1 | tee /sys/class/sound/hwC0D0/reconfig
1
tee: /sys/class/sound/hwC0D0/reconfig: Device or resource busy
That's what I get - why do you use tee if you are root? I thought that was a workaround to allow you to run the command with sudo. Perhaps it needs  the commands you run before then to recreate it?

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #2
what for laptop have you? There are quite a few links on the Internet where a similar problem is solved. Did you search it?  Didn't any solution they offer ?

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #3
I tried hdajackretask and got the same error in an onscreen message when I clicked apply as I did with that command in the terminal, so hdajackretask didn't work although it doesn't cause a segfault here. Also earlier I was using the linux-zen kernel while now I'm using the std one, there seems to be no difference. Presumably this affects only some hardware. I see why you use tee - because that's what hdajackretask does  ;D 
I did get further with hdajackretask after shutting down processes as detailed below: sudo fuser -v /dev/snd/*
https://askubuntu.com/questions/762957/on-reconfiguring-hdajackretask-after-a-clean-install-of-16-04-apply-now-to-tes
Then it apparently worked after apply, as I set my headphone to disconnected and it stopped working, but on closing hdajackretask I saw a segfault message on the commandline. So I tried again, and then after running it the hdajackretask window became unresponsive, and when I shut down after killing the window the shutdown process did not complete. So there are problems in general with that I guess.

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #4
@alium and @####### I'm sorry I wasn't clear at all.

I got the "Device or resource busy"  when I have pulseaudio running, I forgot to mention if someone has pulseaudio must be killed first.

As @####### hdajackretask writes a script everytime I run in /tmp, the tee command comes from those scripts. Even if I run the command without "tee":

Code: [Select]
echo 1 > /sys/class/sound/hwC0D0/reconfig

I get the "segmentation fault".

@alium I know I have to search first before posting anything in the forum but I swear I didn't find anything related to this, the most close I've seen was this I tried and did not help me. Maybe I am not searching well but I tried.

Artix Linux Colombia

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #5
Yes, I can get the segfault, errors.log was empty, and I found an alsa-firmware package but installing it has not helped:
Code: [Select]
$ sudo fuser -v /dev/snd/*
Kill anything there - I had a browser and a panel mixer
$ hdajackretask
0x0a 0x0421101f
0x0b 0x04a11221
0x0c 0x40f000f0
0x0d 0x90170110
0x0e 0x23a1902e
0x0f 0x23014250
0x14 0x40f000f0
0x18 0x90a000f0
0x19 0x40f000f0
0x1e 0x014b1180
0x1f 0x4f0000f0
0x20 0x4f00000f
0x27 0x40f000f0
1
/tmp/hda-jack-retask-V28GO0/script.sh: line 15:  2974 Done                    echo 1
      2975 Segmentation fault      | tee /sys/class/sound/hwC0D0/reconfig 2>> /tmp/hda-jack-retask-V28GO0/errors.log
And the script was:
#!/bin/sh
echo "0x0a 0x0421101f" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x0b 0x04a11221" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x0c 0x40f000f0" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x0d 0x90170110" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x0e 0x23a1902e" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x0f 0x23014250" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x14 0x40f000f0" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x18 0x90a000f0" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x19 0x40f000f0" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x1e 0x014b1180" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x1f 0x4f0000f0" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x20 0x4f00000f" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo "0x27 0x40f000f0" | tee /sys/class/sound/hwC0D0/user_pin_configs 2>>/tmp/hda-jack-retask-V28GO0/errors.log
echo 1 | tee /sys/class/sound/hwC0D0/reconfig 2>>/tmp/hda-jack-retask-V28GO0/errors.log
The link I posted earlier suggests it's the reconfig that doesn't work, if you want to make some changes then apply at boot it is OK - but make a note of where it puts the boot script so you can delete it if it doesn't work. Although things continued working in the desktop, on shutdown after this it stopped at Starting shutdown runlevel and the power button needed to be pushed.

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #6
Hello.

As @####### I am applying the overrides to boot, the bad thing is I have to reboot everytime I change something but at least I can work. This could be a "workaround" but in my opinion the "segmentation fault" should be revised.

Best regards.
Artix Linux Colombia

Re: Possible Alsa-Kernel bug "Segmentation fault"

Reply #7
Hello, sorry if I revive this topic but I wanted to say the problem with my mic was physical, so nothing is wrong with Alsa. I am going to mark this topic as solved.

Best regards.
Artix Linux Colombia