GRUB2 for LinuxMint KDE and Win XP on different harddisk

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
zlix

GRUB2 for LinuxMint KDE and Win XP on different harddisk

Post by zlix »

Hi, im a newbie in Linux
I have 2 hard drive, I install linux to my first hard drive and second hard drive I installed XP.

I have tried to install the GRUB2 to second hard drive, but the error message

Code: Select all

grub-probe: error: cannot find a device for /boot/grub

and I also have tried to install GRUB to first hard drive by adding a boot menu for xp

Code: Select all

/etc/grub.d/40_custom

with
echo "Adding Windows OS to Grub 2 menu"
cat << EOF
menuentry "Microsoft Windows XP Professional" {
set root=(hd1,5)
makeactive
chainloader +1
}
EOF
but the error message is

Code: Select all

error: unknown command 'makeactive'
where should I install grub2, first or second hard drive?
and how to edit boot menu for Linux and XP?
thanx
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Leppie

Re: GRUB2 for LinuxMint KDE and Win XP on different harddisk

Post by Leppie »

as linux is installed on the first drive and windows on the second, i would recommend to install grub to the mbr of the first drive.
did you do an upgrade, or was this a clean install of Mint Helena?
could you download and run the boot info script and post the generated RESULTS.txt?
zlix

Re: GRUB2 for LinuxMint KDE and Win XP on different harddisk

Post by zlix »

Leppie wrote: did you do an upgrade, or was this a clean install of Mint Helena?
this a clean install of Mint Helena
Leppie wrote: could you download and run the boot info script and post the generated RESULTS.txt?
this is the RESULT.txt

Code: Select all

                Boot Info Script 0.55    dated February 15th, 2010                    

============================= Boot Info Summary: ==============================

 => Windows is installed in the MBR of /dev/sda
 => Windows is installed in the MBR of /dev/sdb

sda1: _________________________________________________________________________

    File system:       
    Boot sector type:  Fat16
    Boot sector info:  
    Mounting failed:
mount: unknown filesystem type ''

sda2: _________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  -
    Boot sector info:  

sda5: _________________________________________________________________________

    File system:       vfat
    Boot sector type:  Vista: Fat 32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files/dirs:   

sda6: _________________________________________________________________________

    File system:       vfat
    Boot sector type:  Vista: Fat 32
    Boot sector info:  According to the info in the boot sector, sda6 starts 
                       at sector 63.
    Operating System:  
    Boot files/dirs:   

sda7: _________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info:  
    Operating System:  Linux Mint 8 Helena - KDE 
                       Community Edition
    Boot files/dirs:   /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sdb1: _________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  Unknown
    Boot sector info:  

sdb5: _________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:  According to the info in the boot sector, sdb5 starts 
                       at sector 63.
    Operating System:  Windows XP
    Boot files/dirs:   

sdb2: _________________________________________________________________________

    File system:       vfat
    Boot sector type:  Vista: Fat 32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files/dirs:   

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 41.1 GB, 41110142976 bytes
255 heads, 63 sectors/track, 4998 cylinders, total 80293248 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x43ca43c9

Partition  Boot         Start           End          Size  Id System

/dev/sda1    *             63     3,903,794     3,903,732  82 Linux swap / Solaris
/dev/sda2           3,903,795    80,276,804    76,373,010   f W95 Ext d (LBA)
/dev/sda5          33,126,093    59,793,929    26,667,837   b W95 FAT32
/dev/sda6          59,793,993    80,276,804    20,482,812   b W95 FAT32
/dev/sda7    *      3,903,921    33,126,029    29,222,109  83 Linux


Drive: sdb ___________________ _____________________________________________________

Disk /dev/sdb: 20.8 GB, 20847697920 bytes
255 heads, 63 sectors/track, 2534 cylinders, total 40718160 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0x25c68385

Partition  Boot         Start           End          Size  Id System

/dev/sdb1              16,065    16,386,299    16,370,235   5 Extended
/dev/sdb5              16,128    16,386,299    16,370,172   7 HPFS/NTFS
/dev/sdb2          16,386,363    40,708,709    24,322,347   b W95 FAT32


blkid -c /dev/null: ____________________________________________________________

Device           UUID                                   TYPE       LABEL                         

/dev/loop0                                              squashfs                                 
/dev/sda1: ambivalent result (probably more filesystems on the device)
/dev/sda5        8811-7DD2                              vfat       DATA                          
/dev/sda6        CC1A-3CC1                              vfat       GALLERY                       
/dev/sda7        ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0   ext4                                     
/dev/sdb2        44F7-3EB1                              vfat       DATA_MASJID                   
/dev/sdb5        46A00E73A00E6A2F                       ntfs                                     

============================ "mount | grep ^/dev  output: ===========================

Device           Mount_Point              Type       Options

aufs             /                        aufs       (rw)
/dev/sr0         /cdrom                   iso9660    (rw)
/dev/loop0       /rofs                    squashfs   (rw)


=========================== sda7/boot/grub/grub.cfg: ===========================

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,7)
search --no-floppy --fs-uuid --set ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/07_mintkde_theme ###
insmod ext2
set root=(hd0,7)
search --no-floppy --fs-uuid --set ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0
insmod png
if background_image /boot/grub/linuxmintkde.png ; then
  set color_normal=white/black
  set color_highlight=white/light-gray
else
  set menu_color_normal=white/black
  set menu_color_highlight=white/light-gray
fi
### END /etc/grub.d/07_mintkde_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Linux Mint 8 Helena - KDE CE, linux 2.6.31-16-generic (/dev/sda7)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	set quiet=1
	insmod ext2
	set root=(hd0,7)
	search --no-floppy --fs-uuid --set ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0
	linux	/boot/vmlinuz-2.6.31-16-generic root=UUID=ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0 ro   quiet splash
	initrd	/boot/initrd.img-2.6.31-16-generic
}
menuentry "Linux Mint 8 Helena - KDE CE, linux 2.6.31-16-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	insmod ext2
	set root=(hd0,7)
	search --no-floppy --fs-uuid --set ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0
	linux	/boot/vmlinuz-2.6.31-16-generic root=UUID=ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0 ro single 
	initrd	/boot/initrd.img-2.6.31-16-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
echo "Adding Windows OS to Grub 2 menu"
       cat << EOF
       menuentry "Microsoft Windows XP Professional" {
       set root=(hd1,5)
       map (hd1,5) (hd0,7)
       map (hd0,7) (hd1,5)
       makeactive
       chainloader +1
       }
       EOF

### END /etc/grub.d/40_custom ###

=============================== sda7/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda7 during installation
UUID=ae1c3313-ad4c-4a40-8cb4-6e2b9c506fc0 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda1 during installation
UUID=23615bc9-9515-4484-9b32-1256453c0c70 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

=================== sda7: Location of files loaded by Grub: ===================


   6.5GB: boot/grub/core.img
   6.5GB: boot/grub/grub.cfg
   5.6GB: boot/initrd.img-2.6.31-16-generic
   5.7GB: boot/vmlinuz-2.6.31-16-generic
   5.6GB: initrd.img
   5.7GB: vmlinuz
=========================== Unknown MBRs/Boot Sectors/etc =======================

Unknown BootLoader  on sdb1

00000000  ff a1 00 00 44 00 00 00  69 fd 29 4b 69 fd 29 4b  |....D...i.)Ki.)K|
00000010  69 fd 29 4b 00 00 00 00  00 00 01 00 08 00 00 00  |i.)K............|
00000020  00 00 08 00 01 00 00 00  0a f3 01 00 04 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  01 00 00 00 c1 2e 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000060  00 00 00 00 56 66 42 62  00 00 00 00 00 00 00 00  |....VfBb........|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000080  1c 00 00 00 14 45 91 21  14 45 91 21 14 45 91 21  |.....E.!.E.!.E.!|
00000090  69 fd 29 4b 14 45 91 21  00 00 00 00 00 00 00 00  |i.)K.E.!........|
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000100  a4 81 00 00 98 10 00 00  34 13 ef 4a 69 fd 29 4b  |........4..Ji.)K|
00000110  34 13 ef 4a 00 00 00 00  00 00 01 00 10 00 00 00  |4..J............|
00000120  00 00 08 00 01 00 00 00  0a f3 01 00 04 00 00 00  |................|
00000130  00 00 00 00 00 00 00 00  02 00 00 00 6b 2a 05 00  |............k*..|
00000140  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000160  00 00 00 00 57 66 42 62  00 00 00 00 00 00 00 00  |....WfBb........|
00000170  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000180  1c 00 00 00 14 45 91 21  00 00 00 00 00 00 00 00  |.....E.!........|
00000190  69 fd 29 4b 14 45 91 21  00 00 00 00 00 00 00 00  |i.)K.E.!........|
000001a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
000001c0  01 01 07 fe ff fb 3f 00  00 00 fc c9 f9 00 00 00  |......?.........|
000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200
Leppie

Re: GRUB2 for LinuxMint KDE and Win XP on different harddisk

Post by Leppie »

there are 2 problems here:
1. grub2 has not been installed to any mbr. install grub2 to the mbr of sda, leaving the windows drive as is (which will save you problems when removing a drive from your system). booting off the mint livecd, issue these commands to install grub2 to the mbr of your linux drive:

Code: Select all

sudo mount /dev/sda7 /mnt
sudo grub-install --recheck --root-directory=/mnt /dev/sda
NOTE: /dev/sda is not a typo, this indicates the drives mbr rather than any partition

2. your 40_custom script has a syntax error, please note the ">&2" part at the end of the first iine of your actual menu entry:

Code: Select all

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
echo "Adding Windows OS to Grub 2 menu" >&2
       cat << EOF
       menuentry "Microsoft Windows XP Professional" {
       set root=(hd1,5)
       map (hd1,5) (hd0,7)
       map (hd0,7) (hd1,5)
       makeactive
       chainloader +1
       }
EOF
also not that the 2nd line should not be commented out:

Code: Select all

exec tail -n +3 $0
after this, run update-grub:

Code: Select all

sudo update-grub
zlix

Re: GRUB2 for LinuxMint KDE and Win XP on different harddisk

Post by zlix »

thank you for your advice,
but after carrying out your second suggestion I still find error messages:
error: unknown command `makeactive'
where the cause?
and how Ican fix it?

thanx.
Locked

Return to “Installation & Boot”