How to fix GRUB

A rogue program filled my root directory with cache files, causing a nasty crash of my 64bit openSUSE 11.4 system. From the Rescue System on the openSUSE install DVD, I deleted the 12GB of cache files from the root directory. But GRUB was unable to boot Linux - although it could still boot Windows 7. I tried and tried to repair GRUB until eventually I could no longer even boot Windows!

So I used “Repair” from the Windows 7 install DVD to reinstall Windows BOOTMGR. Then I tried installing openSUSE over itself several times, hoping it would fix GRUB. But each time GRUB can only boot Linux to a command prompt in a tiny shell window located in the upper left corner of the screen. Also noteworthy: this shell has a history that survives the reinstalls and formatting of the root directory!

Here is the layout of my hard drive:

sda1 NTFS 100MB system reserved
sda2 NTFS 278GB Windows 7
sda3 extended
sda5 swap 2GG swap
sda6 ext4 20GB /
sda7 ext4 200GB /home

How to fix GRUB so it boots Linux and Windows on this system again?

sda1    NTFS    100MB   system reserved
sda2    NTFS    278GB   Windows 7
sda3                          extended
sda5    swap    2GG      swap
sda6    ext4    20GB      /
sda7    ext4    200GB    /home

This setup can only “boot” openSUSE IF grub is loaded into the MBR (Master Boot Record). The reason is that when the MBR is loaded with generic booting code, that could load Windows directly, then openSUSE, located in the Logical partition sda6 can’t be used to boot openSUSE as only partitions 1, 2, 3 or 4 can do this. However, if you load Grub into the MBR, openSUSE can be loaded from any partition. Here is a link on reloading Grub you should look at:

Re-Install Grub Quickly with Parted Magic

Thank You,

The GRUB boot code is located in sda3, the extended partition, which is where openSUSE originaly put it. GRUB boots Windows 7 fine and still boots Linux. But instead of the KDE desktop, it leaves me at a command prompt in a tiny shell window located in the upper left corner of the screen.

All attempts to fix GRUB so it boots to the KDE desktop (as it did before the crash caused by the root file system becoming full) have failed. These include reinstalling GRUB, reinstalling openSUSE 11.4, the procedure given here:

http://forums.opensuse.org/english/information-new-users/unreviewed-how-faq/429971-re-install-grub-quickly-parted-magic.html

and the procedures given here:

http://en.opensuse.org/All_About_Grub

Is this situation familiar to anyone?

When you run openSUSE from the Grub menu are you are left at the terminal prompt and KDE or what ever desktop you have selected does not load, but you can still run terminal commands, then Grub is working OK? Your problem is that the X Window system is not running. Most often that is from some sort of Graphic or BIOS power settings issue. Can you be more specific has to what your system does after you select the openSUSE OS from Grub? Have you tried the Failsafe entry to see what it does?

Thank You,

It looks like X without window manager (no title bar or buttons) but just an xterm terminal in the corner. This is how X starts when it doesn’t have any other choice.

Grub has nothing to do with the KDE desktop or vice-versa. So an attempt to fix the problem by reinstalling Grub won’t help. You might be mounting the wrong partition or the root partition is full or KDE is missing something or itself.

Yes - GRUB is working. The GRUB Failsafe entry gives exactly the same result. After selecting openSUSE OS from the Grub menu, I get the normal splash sceen/progress meter. But suddenly I am at a small shell window with prompt. This system was booting to the KDE desktop fine since I first installed openSUSE 11.3 back in February. This change came about as a result of the root directory becoming full.

Y

es - GRUB is working. The GRUB Failsafe entry gives exactly the same result. After selecting openSUSE OS from the Grub menu, I get the normal splash sceen/progress meter. But suddenly I am at a small shell window with prompt. This system was booting to the KDE desktop fine since I first installed openSUSE 11.3 back in February. This change came about as a result of the root directory becoming full.
OK then, a full disk is bad. Sounds like you need to remove some files. You could start with the /tmp folder but I am thinking it might be time to reload and repartition your disk. I try at the moment to give 40 GB to the root / partition and the rest of the disk to /home. What size partition did you fill up?

Thank You,

Good to know! This must be what is happening.

The root filesystem is on /dev/sda6. It became full, causing a nasty crash. After booting with the openSUSE install DVD into the Rescue System, I investigated - found ‘/’ was full - and deleted 12GB of cache files. This partition is now 18% full. But this is beside the point, as I re-installed openSUSE 11.4 several times since, using (and formatting) sda6 as ‘/’ each time. So I don’t know how anything could be missing.

But I must be overlooking something. Please give me things to check.

20GB is starting to sound like the minimum nowadays. But if you reinstalled openSUSE on sda6 and reformated it, it should be OK … except that I would first login as root in the console and rename your user .kde4 directory to make sure that you start a clean KDE. So, after login as root in runlevel3 and assuming your login name is pitfall,
type the following:

mv /home/pitfall/.kde4{,.old}

Then reboot normally and login as user in KDE.

I did this but it still boots to the shell prompt. I do think you’re on the right track though. Because following the crash - before attempting the Grub repairs or re-installing openSUSE - Grub was giving error messages about KDE. Wish I had written them down.

That might be a different problem. I don’t know which graphics card you have … but blind guess, add “nomodeset” to the boot options.

If you’re getting into TWM with an xterm I bet that KDE isn’t being called. From the xterm type “exit” and then you’ll be dropped to a plain prompt and type “kdestart” or “startkde” I’m not quite sure on the combination. If that works then stuff needs to get added to start up.

Eureka - ‘startkde’ did it! I had tried the old ‘startx’ but have never heard of ‘startkde’, so I learned something new. Now what do I need to add to the startup to get this fixed?

First off grub has nothing to do with loading the GUI it does one of 2 things it either starts the kernel with options or it chains to some further boot process like starting windows. During the kernel initialization init scripts are run and start the processes for the default run level. In most cases for desktops it would be run level 5. For terminal mode run level 3. So grub itself is long gone by time the selected GUI desktop is started.

You can also start the GUI with init 5 from a root terminal. Also in 11.4 there is a change to some ownershipa and startx no longer works (without a tweak) from a normal user login.

Hi,

what seems to be happening is that you are booted immediately into the other display manager, not KDE…

This would mean that you have autologin enabled and for some reason it doesn’t get to a KDE session.

here’s what I’d do:

Boot into KDE as you just did, with the startkde command, so that you are in an environment that you are familiar with.
Now you should turn autologin off :

Start Yast (input the root password) and goto “security and users” and th euser and group management.
Highlight your (normal, not root) user and click on the expert parameters in the lower right corner. Select the login parameters and unselect Auto Login.

save everything and reboot.

Normally you should now arrive at the screen where you can login as user with the normal user’s password.

Choose your session type (KDE) and you should get into KDE normally.

Now reboot and then do the same thing again and reset the autologin to selected if you want.

Hopefully you’ll now boot straight into KDE.

HTH

Lenwolf

If lenwolf’s suggestions don’t work,

sudo nano ~/.xinitrc

and place startkde there.

It won’t work on 11.4 unless you set Xorg SUID.

That worked - thanks Lenwolf! Ever since early morning I have been at the long, tedious job of restoring programs and settings to where they were a few days ago.

Thanks everyone for seeing me through this!

pitfall

My pleasure!

Lenwolf