[Top][All Lists]

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

Double sync required on ext3, Linux 2.4.x

From: Pavel Roskin
Subject: Double sync required on ext3, Linux 2.4.x
Date: Fri, 8 Feb 2002 18:58:46 -0500 (EST)


I have had weird problems with GRUB several times, and now it seems that I
have found the solution.  Maybe it's not complete, but worth applying

Once I installed GRUB 0.91 over GRUB 0.90 with grub-install.  The system
wouldn't boot.  I booted from a floppy and bound that /boot/grub/stage2
has "0.90" in it.  In other words, the old stage2 was overwritten by the
script, but the grub shell resurrected the old file!

Then I removed all files except device.map and menu.lst from /boot/grub/
and ran grub-install.  It reported that it cannot find stage1.  However,
the file was present when the script finished.

The following procedure reproduces the problem reliably:

# mv /boot/grub /boot/grub.save
# cp -a /boot/grub.save /boot/grub
# rm -f /boot/grub/stage*
# grub-install '(hd0)'    

    GRUB  version 0.91  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the 
   completions of a device/filename. ]

grub> root (hd0,5)
 Filesystem type is ext2fs, partition type 0x83

grub> setup  --stage2=/boot/grub/stage2 --prefix=/boot/grub (hd0)
 Checking if "/boot/grub/stage1" exists... no

Error 15: File not found

grub> quit

However, adding one more sync() to grub/main.c fixes the problem.  Here's 
the patch.

--- ChangeLog
+++ ChangeLog
@@ -1 +1,6 @@
+2002-02-08  Pavel Roskin  <address@hidden>
+       * grub/main.c (main): Call sync() twice - it's required on ext3
+       with Linux-2.4.18-pre9.
 2002-02-08  Yoshinori K. Okuji  <address@hidden>
--- grub/main.c
+++ grub/main.c
@@ -135,6 +135,7 @@ main (int argc, char **argv)
      actually written to disks. This is very important because GRUB does
      not use ordinary stdio interface but raw devices.  */
   sync ();
+  sync ();
   program_name = argv[0];
   default_boot_drive = boot_drive;

As the ChangeLog says, I'm using the latest and greatest
Linux-2.4.18-pre9, but it's the problem most likely exists for other
kernels and maybe even filesystems.

The best solution would be perhaps adding --stage1 option for the "setup"  
command and avoiding any direct access to files, even read-only access.

Pavel Roskin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]