Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1PXSmK-0007kc-4x for mharc-grub-devel@gnu.org; Tue, 28 Dec 2010 01:11:24 -0500 Received: from [140.186.70.92] (port=42994 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXSmH-0007kH-2A for grub-devel@gnu.org; Tue, 28 Dec 2010 01:11:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXSmF-0004UM-CP for grub-devel@gnu.org; Tue, 28 Dec 2010 01:11:20 -0500 Received: from rcsinet10.oracle.com ([148.87.113.121]:59710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXSmF-0004U6-68 for grub-devel@gnu.org; Tue, 28 Dec 2010 01:11:19 -0500 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id oBS6BE6A013365 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Dec 2010 06:11:15 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id oBS5VeZg026012 for ; Tue, 28 Dec 2010 06:11:14 GMT Received: from abhmt008.oracle.com by acsmt353.oracle.com with ESMTP id 909799851293516576; Mon, 27 Dec 2010 22:09:36 -0800 Received: from rebs (/10.142.243.74) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Dec 2010 22:09:36 -0800 Date: Mon, 27 Dec 2010 22:08:12 -0800 (PST) From: Seth Goldberg X-X-Sender: sethg@bergsoft To: The development of GNU GRUB In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (GSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: Re: `"prefix" is not set` error message in early GRUB startup X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Dec 2010 06:11:22 -0000 Hi, Following up on this, I tried moving the calls to grub_machine_set_prefix() and grub_set_root_dev() before the call to grub_load_modules(), and while it does result in the prefix and root variables getting set earlier, it's still possible to have error messages emitted, depending on the module load order. If the driver for the device referenced by $prefix or $root is loaded before others that make use of these variables, then everything will work fine. However, if modules are loaded before the driver for the type of "disk" device referenced in $prefix and/or $root and those modules attempt to open a file using the values of $prefix or $root, an error message like "no such disk" will be displayed. Ideally, it would be nice if "driver" modules had an identifying attribute that the dynamic linker could use to load them first, then load all other modules (the assumption being that "driver" modules wouldn't try to access anything using $prefix or $root explicitly). However, as a workaround, the order in which the modules are listed on the mkconfig command line should provide a means to avoid these error messages, however there's a problem -- if gzio does exist on the tftp server and it's loaded, when we hit gzio during the grub_load_modules() iteration, a fatal error occurs (we should be able to detect this and just ignore the fact that the module as already been loaded). --S Quoting Seth Goldberg, who wrote the following on Sat, 25 Dec 2010: > Hi, > > Recently, I've been seeing the error message in the subject line while > GRUB2 is starting. I've tracked it down to code in normal.mod (specifically, > the code in GRUB_MOD_INIT(normal) that tries to grub_dl_load the gzio module. > Since normal.mod is loaded by the call to grub_load_modules() in main() and > that call is BEFORE the call to grub_machine_set_prefix(), the prefix is not > used to find gzio (another interesting thing to note is that even if gzio is > embedded in the core image, if it is present AFTER normal.mod, the loader > does not realize this and tries to load it from the prefix directory -- that > should probably be fixed also). Another interesting thing to note is that > normal's init function, by virtue of calling grub_context_init(), calls > grub_env_export for both prefix and root (which has the side effect of > setting them to the empty string if they don't exist at the time). This can > also cause subtle problems if other modules access root or prefix during the > course of grub_load_modules(). > > My suggested fix is to move the calls to grub_machine_set_prefix() and > grub_set_root_dev before grub_load_modules(). A cursory examination of these > functions doesn't reveal any dependence on any loadable modules, but I'm not > 100% sure about that. Were these two functions put after grub_load_modules() > before they might require modules loaded there? > > --S > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel >