Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: install cd fails to boot on root-on-RAID systems



On Mon Jun 01 2009 at 22:29:14 +0200, Jukka Salmi wrote:
> Hello,
> 
> while fixing a problem (bootloader unable to read root file system due
> to having installed FFSv1 primary bootstrap to read a FFSv2 root file
> system... :-P) on a 5.99.11 i386 system I booted a (5.99.11 i386)
> installation CD to get a shell and manually correct things, but booting
> failed: 
> 
>       [...]
>       raid0: RAID Level 1
>       raid0: Components: /dev/wd0a /dev/wd1a
>       raid0: Total Sectors: 16777216 (8192 MB)
>       raid1: RAID Level 1
>       raid1: Components: /dev/wd0f /dev/wd1f
>       raid1: Total Sectors: 404510080 (197514 MB)
>       boot device: raid0
>       root on raid0a dumps on raid0b
>       no file system for raid0 (dev 0x1200)
>       cannot mount root, error = 79
>       root device (default raid0a):
> 
> While that installation CD (created by running `build.sh iso-image')
> successfully boots to sysinst on most machines, it seems to fail if the
> machine already has NetBSD installed and has an auto-configurable RAID
> set containing the root file system.  (But why?  The CD does contain the
> ffs kmod...  However, `root' should have been on `cd0a' anyway, so...)
> 
> Are such systems considered "unsupported" (i.e. the user is expected to
> turn off RAID set auto-configuration before e.g. upgrading using
> sysinst), or should this be fixed (removing `options RAID_AUTOCONFIG'
> from the install kernel would probably do the trick, but that kernel is
> GENERIC which should definitely contain that option...)?

I had a similar problem last year.  I found the raid autoconfig to be
very difficult to disable, as setting the raidautoconfig variable to
0 from ddb (boot -d) was not enough.  Instead, IIRC, I had to place a
breakpoint into the code, run, put another breakpoint, and only then I
could disable autoconfig.  I had a little discussion with Greg and came
up with the attached patch.  Unfortunately, at that point my system was
already up and running and I didn't want to take it down to test the
patch, so the patch never got committed.

But, looking at the code now, it seems like boot -a could help there.

I guess what we essentially need for the install media is a way to say
"autoconfig the raids but don't try to make raid the root".
Index: rf_netbsdkintf.c
===================================================================
RCS file: /cvsroot/src/sys/dev/raidframe/rf_netbsdkintf.c,v
retrieving revision 1.248
diff -p -u -r1.248 rf_netbsdkintf.c
--- rf_netbsdkintf.c    16 Jun 2008 16:58:26 -0000      1.248
+++ rf_netbsdkintf.c    28 Aug 2008 15:07:22 -0000
@@ -316,11 +316,17 @@ void rf_cleanup_config_set(RF_ConfigSet_
 int rf_have_enough_components(RF_ConfigSet_t *);
 int rf_auto_config_set(RF_ConfigSet_t *, int *);
 
-static int raidautoconfig = 0; /* Debugging, mostly.  Set to 0 to not
-                                 allow autoconfig to take place.
-                                 Note that this is overridden by having
-                                 RAID_AUTOCONFIG as an option in the
-                                 kernel config file.  */
+/*
+ * Debugging, mostly.  Set to 0 to not allow autoconfig to take place.
+ * Note that this is overridden by having RAID_AUTOCONFIG as an option
+ * in the kernel config file.
+ */
+#ifdef RAID_AUTOCONFIG
+static int raidautoconfig = 1;
+#else
+static int raidautoconfig = 0;
+#endif
+static bool raidautoconfdone = false;
 
 struct RF_Pools_s rf_pools;
 
@@ -392,9 +398,7 @@ raidattach(int num)
                aprint_error("raidattach: config_cfattach_attach failed?\n");
        }
 
-#ifdef RAID_AUTOCONFIG
-       raidautoconfig = 1;
-#endif
+       raidautoconfigdone = false;
 
        /*
         * Register a finalizer which will be used to auto-config RAID
@@ -410,11 +414,11 @@ rf_autoconfig(struct device *self)
        RF_AutoConfig_t *ac_list;
        RF_ConfigSet_t *config_sets;
 
-       if (raidautoconfig == 0)
+       if (!raidautoconfig || raidautoconfigdone == true)
                return (0);
 
-       /* XXX This code can only be run once. */
-       raidautoconfig = 0;
+       /* XXX This code can only be run once. XXX: races? */
+       raidautoconfigdone = true;
 
        /* 1. locate all RAID components on the system */
 #ifdef DEBUG


Home | Main Index | Thread Index | Old Index