You are not logged in.

#1 2016-03-31 06:18:55

rabidfox
Member
Registered: 2016-03-31
Posts: 7

[Solved] Need advice for final beautification of soundcard workaround

So on Unstable and Stable I now have a recurring problem on my box.

It randomly changes the soundcard between sources 0 and 1 at bootup, but not every time.

When it chooses the NVidia card the sound doesn't work, but when it chooses the STX card it works (which is fine).  So I learned I can rewrite this line of code into /etc/asound.conf and it will fix it:

pcm.!default {
    type hw
    card 1
}

However, it randomly reassigns the soundcards to the identities of 1 and zero without warning.  I have been getting around this by replacing the 1 with a zero in the file or vice versa when it swaps, which is annoying.

So today I wrote a simple line that fixes it without me opening a text editor, but I still have to choose the zero if the one doesn't work, or vice versa.  "asound1.conf" is just the version with the 1 in it.

cd /etc; cat "asound1.conf" > "asound.conf"

the other line is

cd /etc; cat "asound0.conf" > "asound.conf"

I have put that into two script and can run them, but I'd like to have the computer automatically check if it is working and then make the correction.  All it has to do is choose the correct script to run and it will happily fix it.

How can I ask the OS to check for an error and then choose the right command?

For example, if I ask VLC to play a random file it will report errors.  Can I ask it to run such a program for a very short time and have it decide based on the existence of an error whether or not to rewrite the file with a 1 or a 0 using the scripts I already have?

Sample VLC error:
foo@foobar$ vlc 01\ Danger\ Zone.flac
VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
[00000000011ce618] pulse audio output error: PulseAudio server connection failure: Connection refused
[00000000010c0158] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00000000011ce618] alsa audio output error: cannot open ALSA device "default": No such file or directory
[00000000011ce618] core audio output error: module not functional
[00007f0164c03058] core decoder error: failed to create audio output


Thank you for helping me fix this major time waster!!

Last edited by rabidfox (2016-03-31 23:13:34)

Offline

#2 2016-03-31 07:07:15

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [Solved] Need advice for final beautification of soundcard workaround

Well, first I'd say, let's try to get to the root cause of the issue, and find out why it's happening before trying to cover it up by using a work around. But if you wanted to, you can put a script in your autostart file, to check, which "mode" (0 or 1) that the card booted into. This check will run on boot each time openbox is started. This can be done by a simple cat > grep type check on the asound.conf file. Then once determined which mode it's in, with an if statement, you can run either one of the commands to change it. from 0 to 1 or 1 to 0.

should be pretty simple, especially if the mode for the card, is only chosen once at boot time. You can add the check script to your autostart, or if you want to your .initrc I believe. Someone let me know if I'm wrong on that. But like I said, you probably want to try to find out the cause of why this is happening and prevent it that way first.


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#3 2016-03-31 09:30:59

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 2,755

Re: [Solved] Need advice for final beautification of soundcard workaround

You did check if
a. you can disable nvidia card in bios?
b. you can blacklist nvidia?
(in that order)

ot:
I just happen to be in good shape for this kind of things, since I've been trying to setup a somehow hardware problematic server for more than a week now (latest problem seems to be that PSU can't power 3 hds, yeah it is getting silly ...).

Last edited by brontosaurusrex (2016-03-31 09:34:48)

Offline

#4 2016-03-31 18:44:11

rabidfox
Member
Registered: 2016-03-31
Posts: 7

Re: [Solved] Need advice for final beautification of soundcard workaround

Okay, good, let's address the root issue.

I don't think I should disable it in the bios so that it can remain available to the other operating system on my machine.  However, let's blacklist nvidia.

I entered lsmod to find anything related to NVidia but didn't find anything I recognized:

Module                  Size  Used by
appletalk              36864  0
ax25                   57344  0
ipx                    28672  0
p8023                  16384  1 ipx
p8022                  16384  1 ipx
psnap                  16384  2 ipx,appletalk
llc                    16384  2 p8022,psnap
intel_rapl             20480  0
iosf_mbi               16384  1 intel_rapl
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
coretemp               16384  0
kvm_intel             163840  0
kvm                   507904  1 kvm_intel
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
snd_hda_codec_hdmi     49152  1
jitterentropy_rng      16384  0
hid_logitech           32768  0
ff_memless             16384  1 hid_logitech
sha256_ssse3           28672  1
sha256_generic         24576  1 sha256_ssse3
hmac                   16384  1
nouveau              1458176  4
drbg                   24576  1
ansi_cprng             16384  0
snd_hda_intel          36864  0
snd_virtuoso           49152  0
snd_oxygen_lib         45056  1 snd_virtuoso
snd_hda_codec         135168  2 snd_hda_codec_hdmi,snd_hda_intel
eeepc_wmi              16384  0
snd_mpu401_uart        16384  1 snd_oxygen_lib
btusb                  45056  0
ttm                    94208  1 nouveau
aesni_intel           167936  0
asus_wmi               28672  1 eeepc_wmi
btrtl                  16384  1 btusb
snd_rawmidi            32768  1 snd_mpu401_uart
snd_hda_core           65536  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
sparse_keymap          16384  1 asus_wmi
aes_x86_64             20480  1 aesni_intel
snd_hwdep              16384  1 snd_hda_codec
snd_seq_device         16384  1 snd_rawmidi
btbcm                  16384  1 btusb
iTCO_wdt               16384  0
drm_kms_helper        131072  1 nouveau
lrw                    16384  1 aesni_intel
video                  36864  2 nouveau,asus_wmi
mxm_wmi                16384  1 nouveau
btintel                16384  1 btusb
iTCO_vendor_support    16384  1 iTCO_wdt
gf128mul               16384  1 lrw
snd_pcm               102400  5 snd_hda_codec_hdmi,snd_oxygen_lib,snd_hda_codec,snd_hda_intel,snd_hda_core
glue_helper            16384  1 aesni_intel
bluetooth             512000  5 btbcm,btrtl,btusb,btintel
evdev                  20480  17
joydev                 20480  0
drm                   348160  7 ttm,drm_kms_helper,nouveau
ablk_helper            16384  1 aesni_intel
snd_timer              32768  1 snd_pcm
sb_edac                28672  0
serio_raw              16384  0
cryptd                 20480  2 aesni_intel,ablk_helper
pcspkr                 16384  0
rfkill                 24576  3 bluetooth,asus_wmi
i2c_algo_bit           16384  1 nouveau
snd                    81920  11 snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_rawmidi,snd_virtuoso,snd_oxygen_lib,snd_hda_codec,snd_hda_intel,snd_mpu401_uart,snd_seq_device
edac_core              57344  1 sb_edac
soundcore              16384  1 snd
i2c_i801               20480  0
sg                     32768  0
lpc_ich                24576  0
mei_me                 28672  0
mfd_core               16384  1 lpc_ich
shpchp                 36864  0
mei                    94208  1 mei_me
tpm_tis                20480  0
tpm                    40960  1 tpm_tis
wmi                    20480  3 mxm_wmi,nouveau,asus_wmi
processor              36864  0
button                 16384  1 nouveau
parport_pc             28672  0
ppdev                  20480  0
lp                     20480  0
parport                49152  3 lp,ppdev,parport_pc
autofs4                40960  2
ext4                  577536  3
crc16                  16384  2 ext4,bluetooth
mbcache                20480  1 ext4
jbd2                  106496  1 ext4
hid_generic            16384  0
usbhid                 49152  0
hid                   118784  4 hid_generic,hid_logitech,usbhid
sr_mod                 24576  0
cdrom                  57344  1 sr_mod
sd_mod                 40960  6
crc32c_intel           24576  0
psmouse               126976  0
ahci                   36864  4
libahci                32768  1 ahci
libata                233472  2 ahci,libahci
xhci_pci               16384  0
scsi_mod              229376  4 sg,libata,sd_mod,sr_mod
ehci_pci               16384  0
xhci_hcd              172032  1 xhci_pci
ehci_hcd               77824  1 ehci_pci
e1000e                233472  0
usbcore               233472  6 btusb,ehci_hcd,ehci_pci,usbhid,xhci_hcd,xhci_pci
ptp                    20480  1 e1000e
usb_common             16384  1 usbcore
pps_core               20480  1 ptp

I have created  /etc/modprobe.d/blacklist.conf  but don't know what module to blacklist.

I also examined the link provided by madoromi, and I think the line referred to there is this:

Now, run your favorite text editor (as root) on /etc/modprobe.d/nvidiahdmi.conf
    Add this line (replace 0xY by the Probe Mask number you saw for your device):
    options snd-hda-intel probe_mask=0xY

This tells me it could be the module snd-hda-intel, but if I just blacklist it will it kill other functions? Perhaps we should use a mask as above.  However, I'm a little confused as to how to do that, especially since the suggested file does not already exist.

Contents of /proc/asound/NVidia

codec#0  eld#0.0  eld#0.1  eld#0.2  id  pcm3p  pcm7p  pcm8p

Thanks for your kind help!  cool
I think there is just a little farther to go.

Offline

#5 2016-03-31 19:34:39

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [Solved] Need advice for final beautification of soundcard workaround

Isn't noveavu the nvidia you're looking for? Or will it show up as nvidia?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#6 2016-03-31 19:40:25

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: [Solved] Need advice for final beautification of soundcard workaround

Nvidia sound will be snd_hda_intel. I would just blacklist it.

Offline

#7 2016-03-31 19:45:29

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: [Solved] Need advice for final beautification of soundcard workaround

OP, are you using the Nvidia sound card actually for anything?  and instead of blacklisting, why not just do an rmmod to pull it out?

Last edited by Horizon_Brave (2016-03-31 19:49:40)


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#8 2016-03-31 23:06:52

rabidfox
Member
Registered: 2016-03-31
Posts: 7

Re: [Solved] Need advice for final beautification of soundcard workaround

Okay, I created /etc/modprobe.d/blacklist.conf and it says

blacklist module snd-hda-intel

Then I ran update-initramfs -u and rebooted.

Horizon_Brave, I'm not actually using it within this operating system, so I could rmmod it if it still misbehaves. I just didn't know rmmod existed until you said something.  wink

Well, I never know why it randomly reassigns the soundcard number... cat /proc/asound/cards still lists both cards and I don't have problems yet.

I'm going to mark this as solved, though I may have to reopen it if it turns out I messed up!

If that's all, though, thank you all very much.  This is one of the big reasons I love Linux.

Offline

#9 2016-03-31 23:10:20

rabidfox
Member
Registered: 2016-03-31
Posts: 7

Re: [Solved] Need advice for final beautification of soundcard workaround

Okay, so that didn't fix it.

Offline

#10 2016-03-31 23:13:16

rabidfox
Member
Registered: 2016-03-31
Posts: 7

Re: [Solved] Need advice for final beautification of soundcard workaround

Perhaps rmmod fixed it now.  I'll come back if it acts up again.

Offline

#11 2016-04-01 06:29:20

Snap
Member
Registered: 2015-10-02
Posts: 465

Re: [Solved] Need advice for final beautification of soundcard workaround

Blacklisting is fine. I still use it because I just want a single card running, but if you want to use two and the modules loading order is driving you crazy, Check this

Scroll down to 5.2 The newer "slots=" method. Though the whole page worths a good reading and bookmarking.

Last edited by Snap (2016-04-01 06:30:48)

Offline

Board footer

Powered by FluxBB