LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   GRUB config on Slackware 13.37 (https://www.linuxquestions.org/questions/slackware-14/grub-config-on-slackware-13-37-a-4175411322/)

funboy 06-13-2012 08:49 PM

GRUB config on Slackware 13.37
 
Hi all,
Can anyone give me advice regarding my grub config ?
I want to install grub on to /boot - /dev/sda5.
Here is my configs:

root@slackwarebox:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 9.7G 8.3G 930M 91% /
tmpfs 1004M 0 1004M 0% /dev/shm
/dev/sda5 183M 5.9M 168M 4% /boot
/dev/sda7 9.4G 922M 8.1G 11% /opt
root@slackwarebox:~#


root@slackwarebox:~# fdisk -l

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
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4e841002

Device Boot Start End Blocks Id System
/dev/sda1 206848 291665919 145729536 5 Extended
/dev/sda2 63285248 63490047 102400 7 HPFS/NTFS/exFAT
/dev/sda3 * 63490048 126404607 31457280 7 HPFS/NTFS/exFAT
/dev/sda4 291665920 312180924 10257502+ 83 Linux
/dev/sda5 206911 592407 192748+ 83 Linux
/dev/sda6 592471 2584467 995998+ 83 Linux
/dev/sda7 2584531 22585392 10000431 83 Linux
/dev/sda8 32577886 63285247 15353681 83 Linux
/dev/sda9 126406656 291665919 82629632 7 HPFS/NTFS/exFAT
root@slackwarebox:~#

What should be my configuration to have grub with Slackware and Win7.

I've tried many times, but I received a lot of errors, such as: partition is mounted as read-only. (But it is not) and so on. I read that I have to make mapping because windows is not the first partition. I made it but I doesn't work. When I boot I received BOOT MGR NOT FOUND. So can someone give me the configuration and I will try with it?

Thank you in advance.

Richard Cranium 06-13-2012 10:37 PM

Which version of grub?

funboy 06-14-2012 11:52 AM

root@slackwarebox:~# grub --version
grub (GNU GRUB 0.97)

slackass 06-14-2012 04:46 PM

I put Windows on the 1st partition and install grub to a separate but very small boot partition.
It looks to me like your extended partition is listed wrong. Normally sda4 would be the extended partition with logical partitions starting at sda5.
Also, I'm not sure if Windows will work from a logical partition. Perhaps someone with more knowledge can address this.
I use a setup like this on my main box.

bash-4.2# fdisk -l

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000afda7

Device Boot Start End Blocks Id System
/dev/sda1 * 63 125837144 62918541 7 HPFS/NTFS/exFAT
/dev/sda2 125837145 650118419 262140637+ 7 HPFS/NTFS/exFAT
/dev/sda3 650118420 1174399694 262140637+ 83 Linux
/dev/sda4 1174399695 1465147391 145373848+ 5 Extended
/dev/sda5 1174399758 1175443919 522081 83 Linux <----------- this is where I installed grub
/dev/sda6 1175443983 1183829849 4192933+ 82 Linux swap
/dev/sda7 1183829913 1236266009 26218048+ 83 Linux
/dev/sda8 1236266073 1288702169 26218048+ 83 Linux
/dev/sda9 1288702233 1341138329 26218048+ 83 Linux
/dev/sda10 1341138393 1393574489 26218048+ 83 Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000aefdb

Device Boot Start End Blocks Id System
/dev/sdb1 63 488375999 244187968+ 83 Linux
/dev/sdb2 488376000 976768064 244196032+ 83 Linux
bash-4.2#



Here's my menu.lst
# GRUB configuration file '/boot/grub/menu.lst'.
# generated by 'grubconfig'. Wed Apr 13 23:12:33 2011
#
# The backup copy of the MBR for drive '/dev/sda' is
# here '/boot/grub/mbr.sda.3228'. You can restore it like this.
# dd if=mbr.sda.3228 of=/dev/sda bs=512 count=1
#
# Start GRUB global section
timeout 10
default 1
color light-blue/black light-cyan/blue
# End GRUB global section


# Other bootable partition config begins
title Windows 7 Pro 64 (/dev/sda1)
rootnoverify (hd0,0)
makeactive
chainloader +1
# Other bootable partition config ends

# Linux bootable partition config begins
title Slackware64-Current Multi-Lib (/dev/sda7)
root (hd0,6)
kernel /boot/vmlinuz root=/dev/sda7 ro vga=normal
# Linux bootable partition config ends

# Linux bootable partition config begins
title Slackware64-Current Multi-Lib (/dev/sda8)
root (hd0,7)
kernel /boot/vmlinuz root=/dev/sda8 ro vga=normal
# Linux bootable partition config ends

# Linux bootable partition config begins
title Slackware64-13.37 Multi-Lib (/dev/sda9)
root (hd0,8)
kernel /boot/vmlinuz root=/dev/sda9 ro vga=normal
# Linux bootable partition config ends


title --- For help press 'c', type: 'help'
root (hd0)
title --- For usage examples, type: 'cat /boot/grub/grub.txt'
root (hd0)


Here's a handy tool:
http://download.berlios.de/supergrub...isk_0.9799.iso

funboy 06-14-2012 05:49 PM

Mhmmmm : ) So I must to put the windows partition to the firs partition, and I want /dev/sda4 to be the extended partition.
It seems there is a little mess, I've done it with Acronis disk director :(. I will try to fix it.
Thank you.

slackass 06-14-2012 06:15 PM

Parted Magic is another great little tool to have around. It does all sorts of stuff including partitioning with a gui.
http://partedmagic.com/doku.php?id=downloads

Erik_FL 06-14-2012 10:49 PM

Unfortunately you can't simply move the Windows system partition (that has BOOTMGR) or even create a partition in front of it. The Windows boot configuration database (BCD) stores information about the partition where BOOTMGR is located. You have to use the Windows boot CD and repair the Windows boot information to allow Windows to boot again. You can also use the BCDEDIT command to repair Windows boot information. You have to have some working Windows system or the Windows boot CD to use that command. I suggest that you read about BCDEDIT if you are going to try manual repair of Windows.

Here are the commands you would need. In most cases it's easier to let Windows automatically repair boot information.

Code:

bcdedit /set {bootmgr} device partition=c:
bcdedit /set {current} device partition=c:
bcdedit /set {current} osdevice partition=c:

The commands tell Windows to look for files on the partition that Windows sees as drive "c:". Since BCDEDIT does not save the drive letter, it may be called something besides "C" later. It actually saves the partition number and drive ID or UUID. If you change the partition location or drive Master Boot Record then Windows no longer boots. The partition letter should be what is seen by the Windows repair CD or currently booted OS, and NOT the Windows you are going to boot later. You might have to use a different letter than "C" if your current booted OS sees a different letter. You want to use the drive letter where "bootmgr" is located and the "bcd" folder is located.

The other problem is that any boot loader (BOOTMGR or GRUB) should usually be located in a Primary partition. You have GRUB located in an extended partition. GRUB will work if you have it in a logical drive in the extended partition, but only if you install GRUB to the Master Boot Record (partition table sector). A logical drive partition does not have a boot sector, so you can't install GRUB to that partition's boot sector.

Now we get to some confusing terminology. Installing the GRUB boot sector, and installing the GRUB files are two different things. GRUB expects the partition containing GRUB files to have a folder named "/grub" or "/boot/grub" relative to the root OF THAT PARTITION (not the Linux system root). Those are the ONLY two places where GRUB installation will look for the GRUB files.

For example, assume that the GRUB files will be on "/dev/sda5" that is mounted on "/bootldrs":

Code:

mkdir /bootldrs/grub
cp /usr/lib/grub/i386-pc/* /bootldrs/grub
grub
root (hd0,4)
setup (hd0)
quit

The GRUB program files "stage1", "stage2" and so forth are on device "/dev/sda5" so the "root (hd0,4)" command is used. Since the boot sector should be written to the master boot record of the first disk, the "setup (hd0)" command is used. The actual GRUB files are in a directory called "/grub" on "/dev/sda5".

The "/bootldrs/grub/menu.lst" file must have something similar to this.

Code:

default 0

timeout 5

title Slackware Linux
root (hd0,4)
kernel /boot/vmlinuz root=/dev/sda1 vga=773 ro
boot

This will also work.

Code:

mkdir /bootldrs/boot
mkdir /bootldrs/boot/grub
cp /usr/lib/grub/i386-pc/* /bootldrs/boot/grub
grub
root (hd0,4)
setup (hd0)
quit

The "menu.lst" file would then be "/bootldrs/boot/grub/menu.lst".

You can't mount the GRUB partition as "/boot" because that would hide the "/boot" directories of your Linux partitions. You can't mount the GRUB partition as "/boot/grub" because it would put the "stage1" file in the "/" folder of the GRUB partition. GRUB installation would fail. You can use names like "/boot/bootldrs/grub" or "/boot/bootldrs/boot/grub" In either case you would have to mount the GRUB partition to "/boot/bootldrs".

What I suggest if you have a separate GRUB partition is to use a mount point like "/bootldrs" and keep it totally separate from the "/boot" directory that will have your Linux kernel files. Otherwise it gets quite confusing.

You may have noticed that I avoided using "grub-install". I've had problems with "grub-install" not working correctly. In theory you should be able to use a command like this.

Code:

grub-install --root-directory=/bootldrs /dev/sda
That is assuming "/dev/sda5" is mounted on "/bootldrs". It will create a folder called "/bootldrs/boot/grub".

The last bit of advice is that on some hardware, the Linux GRUB program does not guess devices correctly. On some systems (RAID for example) you may have to create a GRUB boot floppy or boot CD and install GRUB using "native" mode. In other words, boot into GRUB but not Linux. Press "c" to get the GRUB command prompt. Then type in the commands to install GRUB.

Code:

root (hd0,4)
setup (hd0)

That uses the computer's BIOS to write the boot sector and locate the GRUB files.

Erik_FL 06-14-2012 11:02 PM

I noticed that you have two NTFS partitions. It may be that "bootmgr" and Windows are installed on different partitions. In that case you have to provide both partition letters correctly to "bcdedit".

Code:

bcdedit /set {bootmgr} device partition=c:
bcdedit /set {current} device partition=d:
bcdedit /set {current} osdevice partition=d:

Look at the contents of the drives to determine which drive letter has the "bootmgr" file and which has the WINDOWS folder. I believe the installation of Windows 7 tries to create a 200MB "bootmgr" partition first, then a second partition for Windows. That's only true if you do an installation to an empty hard disk.

gabytf 06-15-2012 04:16 AM

For your reference, here is my disk partition with GRUB in sda3 where i only use 100MB for it. Every time i boot from sda3 and set chainlink to windows XP in sda1. GRUb in sda3 and LILO in slackware in sda6.

i followed this guide previously when i with ubuntu, i got no problem with the boot after i install my slackware till now.
http://ubuntuguide.org/wiki/Multiple_OS_Installation

[QUOTE]bash-4.1# fdisk -l

Disk /dev/sda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders, total 117210240 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a99a2

Device Boot Start End Blocks Id System
/dev/sda1 * 2048 31414271 15706112 7 HPFS/NTFS/exFAT
/dev/sda2 31414272 72425471 20505600 7 HPFS/NTFS/exFAT
/dev/sda3 72425472 72630271 102400 83 Linux
/dev/sda4 72632318 117209087 22288385 5 Extended
/dev/sda5 72632320 74680319 1024000 82 Linux swap
/dev/sda6 74682368 117209087 21263360 83 Linux
bash-4.1#


Hope this can help.

funboy 06-19-2012 02:47 AM

Thank you to all for your help, especially to Erik_FL. I've did it now it is fine and works. :)


All times are GMT -5. The time now is 05:42 PM.