Bug 18026

Summary: System hangs when loading via82cxxx module
Product: [Retired] Red Hat Linux Reporter: daniel.deimert
Component: sndconfigAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: bastiaan, mike, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-02-07 00:25:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description daniel.deimert 2000-10-01 17:12:35 UTC
I have a Asus K7V motherboard with onboard PCI audio.  Audio works in
Windows so it's not broken.  The soundcard is not automatically installed
during RH7 install.  

When I run "sndconfig" as root, sndconfig detects the sound card and offers
to play a sound sample.  When OK is selected, the system freezes
completely.  Oh well, that's life.  I reboot - and find that it is
impossible to boot!  Even using "linux single" init is trying to load the
sound module and the system freezes. Selecting "interactive startup" does
not help; this startup option does not affect the loading of the sound
module.  I had to disable the sound card in BIOS in order to boot and
remove the offending lines from /etc/modules.conf.

In the BIOS, AC97 audio is enabled and "legacy audio" is disabled.

Here's the output of lspci:

[root@localhost /root]# lspci 
00:00.0 Host bridge: VIA Technologies, Inc. VT82C691 [Apollo PRO] (rev 02)
00:01.0 PCI bridge: VIA Technologies, Inc. VT82C598 [Apollo MVP3 AGP]
00:04.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super] (rev 21)
00:04.1 IDE interface: VIA Technologies, Inc. VT82C586 IDE [Apollo] (rev
10)
00:04.2 USB Controller: VIA Technologies, Inc. VT82C586B USB (rev 10)
00:04.3 USB Controller: VIA Technologies, Inc. VT82C586B USB (rev 10)
00:04.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI]
(rev 30)
00:04.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686
[Apollo Super AC97/Audio] (rev 20)
00:0a.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100]
(rev 08)00:0b.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR)
53c875 (rev 03)
00:0d.0 Multimedia controller: Sigma Designs, Inc. REALmagic Hollywood Plus
DVD Decoder (rev 02)
01:00.0 VGA compatible controller: nVidia Corporation NV15 (Geforce2 GTS)
(rev a3)

Comment 1 Alan Cox 2000-10-01 21:54:35 UTC
Jeff Garzik's native mode driver is in the newest mainstream kernels and that
should fix these problems.

If you ever do get that stuck again and don't have a bios option you can use
both the rescue disk technique or

linux init=/bin/sh

# mount -n -o remount,rw /
# vi file
# mount -n -o remount,ro /

reboot

(booting Linux to a shell with nothing else run)


Comment 2 Alan Cox 2000-10-01 21:54:58 UTC
PS: Bill - you might want to reassign this to kernel ?


Comment 3 Seth Vidal 2000-10-03 03:33:14 UTC
if you turn on sound blaster emulation mode in the bios of this machine the
sound card will miraculously work and not lock the machine. The abit version of
this same board allows you to do this to the mobo and it will make the soundcard
not lock but work VERY poorly.

the new drivers in the main-line kernel fix this - but I've also had luck with
the drivers from 2.2.16-21 (from pinstripe)



Comment 4 Duncan Rubinger 2000-11-07 12:56:23 UTC
Hi,
I've the same problem and I found no way to solve it. Hopefully this will be
fixed with the new version of sndconfig :-)

Bye, Duncan

Comment 5 mike 2000-11-17 10:48:11 UTC
I have the same problem on an Asus CUV-4X.  An easy solution is to install ALSA.

http://www.linuxnewbie.org/nhf/intel/hardware/southbridge_alsa.html


Comment 6 Gerald Teschl 2000-11-23 13:40:22 UTC
I feel that the fact that sndconfig writes /etc/modules.config before it has
ensured that
everything workes fine is a bug!

This should be changed. In addition, there is no reason why the sound stuff has
the
be loaded in level 1. The sound stuff should be removed from rc.sysinit and
moved
to /etc/init.d/sound.

Comment 7 Need Real Name 2000-11-25 12:41:08 UTC
# mount -n -o remount,rw /

mount: no such partition found

Ideas?

Comment 8 Denice 2001-01-21 16:27:17 UTC
I've been bit by this problem twice recently; it would be rather awful for a
newbie.  Here is a patch
for sndconfig.c that does not rename /etc/modules.conf until all is hunky-dory. 
Thus I added a
few args to modprobe in TestSndCard() to use the '-C /path/to/file' arguments. 
I also copied the
config file instead of renaming it, so that there is no window-of-opportunity
for the file to 'disappear'.
I also check the return code of WriteConfModules() and added a bit of logic for
that. (and I'm not
sure why the sync() call was there - ? because of the rename() call?)  Email me
if you want the
patch via email..
I tested it on a system that succeeds, and a system that hangs hard and requires
a power reset.
The 2nd system came back okay with its original /etc/modules.conf file in place.
--
denice.deatrich @ epfl.ch, ADM/SIC, E.P.F.L.   PH: +41 (21) 693 22 53
<*> This moment's fortune cookie:
Man is the best computer we can put aboard a spacecraft ... and the
only one that can be mass produced with unskilled labor.
                -- Wernher von Braun


--- sndconfig-0.58/sndconfig.c.orig     Tue Dec 12 01:23:31 2000
+++ sndconfig-0.58/sndconfig.c  Sun Jan 21 15:57:14 2001
@@ -1013,11 +1013,10 @@
     return rc;
 }

-int WriteConfModules(struct settings *set, int quiet, struct device **devs)
+int WriteConfModules(char tmpfile[], struct settings *set, int quiet, struct
device **devs)
 {
     char tmpstr[200], modulename[200];
-    char tmpfile[] = "/etc/sndconfig-XXXXXX";
-    FILE *f, *t;
+    FILE *f, *w, *t;
     struct stat memstat;
     static int madebackup = 0;
     int tfilefd;
@@ -1058,7 +1057,20 @@
                            " The existing file will be renamed "
                            "/etc/modules.conf.bak and a new file will be "
                            "written."));
-       rename("/etc/modules.conf", "/etc/modules.conf.bak");
+        /* lets copy the file instead of renaming it. */
+        if ((f = fopen("/etc/modules.conf", "r")) != NULL &&
+         (w = fopen("/etc/modules.conf.bak", "w")) != NULL) {
+           while (1) {
+               if (!fgets(tmpstr, sizeof(tmpstr), f))
+                   break;
+               fputs(tmpstr, w);
+           }
+           fclose(f);
+           fclose(w);
+        }
+        else {
+           return -1;
+        }
        madebackup = 1;
     }

@@ -1203,15 +1215,14 @@

     fclose(t);
     chmod(tmpfile, 0644);
-    rename(tmpfile, "/etc/modules.conf");
     return 0;
 }

-static int TestSndCard(int dopnp, struct settings *set)
+static int TestSndCard(char tmpfile[], int dopnp, struct settings *set)
 {
     char *args[] =
        { "/sbin/isapnp", "/etc/isapnp.conf", NULL, NULL, NULL };
-    char *modargs[] = { "/sbin/modprobe", "sound-slot-0", NULL, NULL, NULL };
+    char *modargs[] = { "/sbin/modprobe", "-C", NULL, "sound-slot-0", NULL,
NULL, NULL };
     char *playargs[] =
        { "/usr/bin/play", "/usr/share/sndconfig/sample.au", NULL, NULL,
            NULL };
@@ -1224,6 +1235,7 @@
     int fd, od;
     int rc;

+    modargs[2] = tmpfile;
     if (set->type != ADLIB) {

        newtWinMessage(_("Sound Card Test"), _("Ok"),
@@ -1325,9 +1337,9 @@
        if (                    /* (set->type == GUS) || (set->type==GUSMAX) ||
*/
               /* (set->type==GUSPNP) || */ (set->type == SOUNDSCAPE) ||
               (set->type == ADLIB))
-           modargs[1] = "sound-slot-0";
+           modargs[3] = "sound-slot-0";
        else
-           modargs[1] = "midi";
+           modargs[3] = "midi";
        rc = RunCmd("/sbin/modprobe", modargs, &out, &err);
        if (rc) {
            newtResume();
@@ -1374,6 +1386,7 @@

 int main(int argc, char **argv)
 {
+    char tmpfile[] = "/etc/sndconfig-XXXXXX";
     int pnpprobe;
     int rc;
     int success = 0;
@@ -1758,39 +1771,53 @@
                    newtResume();
            }
 #endif
-           WriteConfModules(&tmpset, quiet, devs);
-           sync();
-
-           if (quiet)
-               return 0;
-
-           rc = TestSndCard(pnpprobe && !noprobe, &tmpset);
-           if (rc < 0) {
-               /* If we're in autoconfig, we'll get stuck in a loop if
-                * the sound test fails...
-                */
-               if (autoconfig && pnpprobe) {
-                   rc =
-                       newtWinChoice(_("Autoconfiguration failed!"),
+           if( WriteConfModules(tmpfile, &tmpset, quiet, devs) != 0 ) {
+               if (!quiet) {
+                   newtWinMessage(_("Error while writing config file"),
+                    _("Ok"), _("Sorry."));
+                    break;
+               }
+                else {
+                   return 0;
+               }
+            }
+            else {
+                if (quiet) {
+                   rename(tmpfile, "/etc/modules.conf");
+                    sync();
+                   return 0;
+                }
+                else {
+                   rc = TestSndCard(tmpfile, pnpprobe && !noprobe, &tmpset);
+                   if (rc < 0) {
+                       /* If we're in autoconfig, we'll get stuck in a loop if
+                        * the sound test fails...
+                        */
+                       if (autoconfig && pnpprobe) {
+                           rc =
+                           newtWinChoice(_("Autoconfiguration failed!"),
                                      _("Ok"), _("Cancel"),
                                      _
                                      ("Autoconfiguration of your sound card "
                                       "failed. Now proceeding with manual "
                                       "configuration."));
-                   autoconfig = 0;
-                   if (rc == 2)
-                       break;
-                   continue;
-               }
-               cleanupmods(&tmpset);
-               continue;
-           } else {
-               success = 1;
-               break;
-           }
+                           autoconfig = 0;
+                           if (rc == 2)
+                               break;
+                           continue;
+                       }
+                       cleanupmods(&tmpset);
+                       continue;
+                   } else {
+                       rename(tmpfile, "/etc/modules.conf");
+                        sync();
+                       success = 1;
+                       break;
+                   }
+                }
+            }
        }
     }
-
     newtFinished();

     cleanupmods(&tmpset);


Comment 9 Daniel Gatti 2001-02-01 05:04:42 UTC
Same problem with an ABIT VA6. Nothing in the BIOS helped me.

The linux /bin/sh solution from alan worked with the following
modification:

mount -n -t ext2 /dev/hda7 -o remount,rw /

I'm not sure how many of those options were required, but it found the
partition. Whereas the command that he gave didn't find it on my system. But I'm
back up & running & I'm glad this bug database is here. 

I would *STRONGLY* vote for fixing sndconfig so that it does not overwrite
/etc/modules.conf until everything is OK.

Comment 10 Bill Nottingham 2001-02-07 00:25:07 UTC
patch added (more or less) in sndconfig-0.60-1; thanks!

Comment 11 Bill Nottingham 2001-03-22 20:15:01 UTC
*** Bug 32728 has been marked as a duplicate of this bug. ***

Comment 12 Need Real Name 2001-04-26 17:46:47 UTC
[root@devel /root]# insmod /lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o
/lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o: unresolved symbol 
unregister_sound_mixer_R7afc9d8a
/lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o: unresolved symbol 
register_sound_mixer_R4befdb20
/lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o: unresolved symbol 
register_sound_dsp_R9956a9d2
/lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o: unresolved symbol 
unregister_sound_dsp_Rcd083b10
/lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o: unresolved symbol 
ac97_probe_codec_R563f6eac


Comment 13 Bill Nottingham 2001-04-26 19:13:27 UTC
Don't use insmod. Always use 'modprobe'.


Comment 14 Need Real Name 2001-05-02 15:13:13 UTC
[root@devel /root]# modprobe -k /lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o
modprobe: Can't locate module /lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o
[root@devel /root]# modprobe /lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o
modprobe: Can't locate module /lib/modules/2.2.19-7.0.1/misc/via82cxxx_audio.o

Comment 15 Bill Nottingham 2001-05-02 15:19:05 UTC
*sigh*

modprobe via82cxxx_audio

In any case, please see the resloution.