I currently have Kubuntu w/ KDE 3.5 on sda1, and openSUSE 11.1 w/ KDE 4 on sda6. sda5 (swap) and sda6 seem to be logical partitions inside sda2, an extended partition set at 18 GB. I wanted to move everything over to openSUSE (sda6), but I couldn’t make sda6 large enough as it was inside sda2, an extended which can’t be resized. Apparently gparted can move partitions, but it seems Expert Partitioner can’t. After resizing sda1 down to 40 GB (150 GB HDD), I restarted, only to see “No operating system found”. What to do…? I can’t make a GParted LiveCD or any other LiveCD, as my openSUSE LiveCD is the only thing I can boot into. What can I do? This is quite a dilemma…
Is there any way of installing gparted while I’m using the openSUSE LiveCD? I apparently can’t install it through YaST…
Does the Live Cd have repair options when you boot from it? I know the full installation DVD does, you might try that, or get your hands on the full DVD somehow.
Where would I be looking for repair options? I don’t see it, but maybe it’s someplace I’m not looking?
Did you resize the partition by shrinking it from the front or the back? Both are possible using Gparted. GRUB is installed in the first sector, so if you shrank the partition from the front, the physical address of GRUB stage1.5 will have changed. You can reinstall GRUB to its original location by booting a live CD, e.g., KNOPPIX, and using
/usr/sbin/grub-install /dev/sda*
where * is your original location.
That’s probably what I need to do. Original location? I’m not sure where it might have been originally…
I’ve got a GParted LiveCD right now. It’s making some changes at the moment. It’ll be a couple hours probably. Does that have GRUB on it? (It does have a terminal…)
By original location I mean was GRUB originally on /dev/sda2 or the MBR before you got the error?
Gparted does not have GRUB. It is just a resizer.
The GRUB system comes in many pieces. /usr/sbin/grub-install is the installer. The stages1.5 and 2 files are in /boot/grub. The configuration file is /boot/grub/menu.lst and is a simple text file.
GRUB is still on the partition where you originally put SUSE. But since your system cannot boot from the hard drive, you need to boot another Linux system from a CD. Knoppix live CD/DVD is useful for fixing various problems. After booting Knoppix, mount the partition that you had installed SUSE on, e.g., /dev/sda2, by opening a root console and the following:
- mkdir -p /mnt/sysinage/mylinux
- mount /dev/sda2 /mnt/sysimage/mylinux
- chroot /mnt/sysimage/mylinux
- /usr/sbin/grub-install /dev/sda
This will install GRUB on the MBR. After rebooting you should see a boot menu.
Just to add a couple thoughts . . .
The “no operating system found” is thrown by the bios when it cannot find executable boot code in the MBR (in contrast to the similarly words “missing operating system” thrown by the Windows MBR code). The fix just above should work, if done from a bootable CD/DVD like Knoppix - except for openSUSE’s, which does not use the same script. In openSUSE it is named “grub-install.unsupported”. Or just use the grub shell; it is more dependable.
Hm, I don’t know. I had installed Kubuntu first, which installed GRUB, I don’t know where. It was automatic. I have since moved things around, and now openSUSE is on sda1 and Kubuntu is on sda2.
Okay, I’m in Knoppix now. I’ll try that.
Huh, though openSUSE is on /dev/sda1, I can’t install GRUB there, I get an error:
Error 21: Selected disk does not exist
Even though it shows sda1 right there on the desktop. It also throws that error for sda2.
@plasmonics recommended installing grub to the MBR, that is, sda. You are using sda1, which puts grub in the boot sector of the first partition. As I posted above, you have no executable code for the bios to find in the MBR - therefore having grub in any partition boot sector will still not work.
Try this from the Knoppix DVD, in a terminal window as root:
grub
find /boot/grub/stage2
root (hd0,0)
setup (hd0) (hd0,0)
quit
The find command should return (hd0,0) - that is, sda1. The root command should confirm grub can find itself on the sda1 partition. The setup will install grub stage1 to the MBR with a pointer to find its stage2 loader on the sda1 partition.
grub> root (h0,0)
Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0) (hd0,0)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage2" exists... no
Error 2: Bad file or directory type
It shouldn’t matter I’m using the CD and not the DVD, right?
Oddly enough, it might matter that you are using the CD and not the DVD. Knoppix has grown enormously so that it no longer fits on a CD. So a CD suggests an older version.
Second, if the Knoppix you are using has a kernel older than 2.6.20, there could be problems. When you open your root console in Knoppix, type “uname -r”. Following kernel 2.6.20, Linux treats all drives as SCSI-like, meaning that only 15 partitions are possible (3 primary and 12 logical).
Third, based on my own experience of Knoppix, there has to be kernel compatibility, at least up to the patch number for things to work smoothly. For example, if your installed kernel is 2.6.27.x, your Knoppix should also be 2.6.27.x, where the two “x’s” can be different. In my experience also, if the installed Linux is 64-bit, the rescue CD/DVD has to be 64 bit. But it sounds as if you are using 32 bit. But I think that if your Knoppix kernel > 2.6.20, the process described by myself and mingus725 should work.
Finally, there was a typo in my original posting. I meant to write “sysimage” not “sysinage”, but i think you picked up on that.
Actually it is even easier than I thought. You don’t even need Knoppix. I tried this from the full opensuse 11.1 DVD. (I have never used the opensuse live CD).
- Boot the full opensuse 11.1 dvd and select rescue from the screen.
- It will drop to a text console with a prompt.
- Login as root. You don’t need a password.
- mkdir -p /mnt/sysimage/mylinux
- mount /dev/sda5 /mnt/sysimage/mylinux
(Replace 5 by your number.) - mount -t proc none /mnt/sysimage/mylinux/proc
- mount -o bind /dev /mnt/sysimage/mylinux/dev
- chroot /mnt/sysimage/mylinux
- fdisk -l
(This should list your partitions in the chrooted environment) - /usr/sbin/grub-install /dev/sda
(Install GRUB in the MBR) - exit
(i.e., leave the chrooted environment) - umount /mnt/sysimage/mylinux/dev
- umount /mnt/sysimage/mylinux/proc
- umount /mnt/sysimage/mylinux
- reboot
I tried the above on my own laptop and it worked. With regard to item 10, mingus725 may be right in that /usr/sbin/grub-install.unsupported may be the SUSE way. But I tried the standard way and didn’t have problems. Try both forms.
I tried the above with KNOPPIX v 5.3.1. It didn’t work because of kernel incompatibility. The advantage of using the opensuse DVD is that you are guaranteed kernel compatibility.
Agreed, should work at long as the script executes successfully. fwiw, I’ve installed grub many times from the shell running the LiveCD or the DVD in Rescue, without needing to mount the root and chroot to it. Grub can read a filesystem without it being mounted. The shell can even do so running standalone without the OS (e.g., from boot floppy, in which case it reads the bios map for the disks).
I can confirm there can be issues with kernel compatibility. For example, the libata change to scsi emulation you refer to. Not only with the kernel, but the grub code, too.
In ref to the script, just cat the openSUSE grub-install, it explains itself. The familiar vanilla script is grub-install.unsupported in the same directory.
It took a while to download the openSUSE DVD image, but it finally finished and I made the disc. Time to go try it out.
Well, I made it to step 10:
Rescue:/ # /usr/sbin/grub-install /dev/sda
GNU GRUB version 0.97 (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 possible
completions of a device/filename. ]
grub> setup --stage2=/boot/grub/stage2 --force-lba (hd0,1) (hd0,5)
Error 22: No such partition
grub> quit
I also tried:
Rescue:/ # /usr/sbin/grub-install.unsupported /dev/sda
/dev/sda does not have any corresponding BIOS drive.
Boot the DVD into Rescue System (easier to do this from a LiveCD or LiveDVD in a terminal window), login as root, and post back the output of:
fdisk -lu
Also, do this:
grub
find /boot/grub/stage2
quit
What does the “find” command return?
Rescue:~ # fdisk -lu
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x0009106b
Devide Boot Start End Blocks ID System
/dev/sda1 63 222387794 111193866 83 Linux
/dev/sda2 228685275 312576704 41945715 83 Linux
/dev/sda3 222387795 228685274 3148740 82 Linux swap / Solaris
Partition table entries are not in disk order
...]
grub> find /boot/grub/stage2
find /boot/grub/stage2
(hd0,0)
(hd0,1)
First, try this: Boot the DVD into Rescue, login as root, and do:
grub
root (hd0,0)
setup --stage2=/boot/grub/stage2 --force-lba (hd0) (hd0,0)
exit
What does the grub report? Reboot.
If not working, then try . . .
grub
root (hd0,0)
setup --stage2=/boot/grub/stage2 (hd0) (hd0,0)
exit
Earlier you posted that “I have since moved things around, and now openSUSE is on sda1 and Kubuntu is on sda2.” Exactly how did you move things around?
And you did not create a /home partition in either install, correct? That is, the entire Kubuntu and entire openSUSE are each on a single partition?
Then we need to look at the code that is in the MBR and the partition table itself. In a terminal as root please post back the output of this (be very careful to type the dd command precisely):
dd if=/dev/sda of=sdambr bs=512 count=1
xxd sdambr
Looks like you just have three partitions. Linux should either be on /dev/sda1 or /dev/sda2 or both. So the above should read
grub> setup (hd0) (hd0,0)
or
grub> setup (hd0) (hd0,1)
depending on which one is openSUSE and Ubuntu. I would try both.
It is also possible that your partition table might have been corrupted when you resized. It might just be more effective to reinstall suse 11.1 from the livecd or full dvd to one of the two partitions, unless you want to learn the nuts and bolts of the partition table using a hex editor.
Of note is that the openSUSE installer added the “–force-lba” grub argument, which is used when it is detected that the bios map has incorrectly calculated the LBA. When OP first attempted using grub with this argument, openSUSE was on sda6 and grub stage1 was being installed to the sda2 boot sector. So I’ve suggested repeating use of that argument but this time with putting stage1 in the MBR with its stage2 pointer directed to sda1 where openSUSE supposedly now is.
In the previous grub shell attempt installing to the MBR stage2 returned “bad file or directory”, yet the find command subsequently found stage2 so the filesystem can be read. Therefore . . .
@YAOMTC -
You also need to post back here the contents of the openSUSE /boot/grub/menu.lst file. If you “moved things around” but did not change menu.lst accordingly, then stage2 will not be able to find menu.lst, a possible reason for the “bad file or directory” error above.
In summary, it’s very possible that you have had incorrect grub installation syntax and incorrect control files. Please do all steps in post #18, plus do this from DVD or LiveCD command line:
mount -t ext3 /dev/sda1 /mnt
cat /mnt/boot/grub/menu.lst
Or do a clean install of openSUSE to sda1 (you’ll need to go into the Partitioning setup dialog and instruct openSUSE to reformat sda1 and use it for root).