-   Slackware (
-   -   Grub/ Grub2/ Lilo - canīt install any of them properly! (

spoovy 11-15-2010 09:30 AM

Grub/ Grub2/ Lilo - canīt install any of them properly!
I usually install grub straight away after an install but this time it hasnīt worked for some reason after installing 13.1 on a new lappy.

I have tried grub, grub2 (from sbo) and lilo; nothing I install into MBR will boot my slackware installation, I have to use the boot USB stick every time.

grub-legacy would be my preferred one so iīll ask for help specifically with that. This is what iīm doing so far -


root@poppy:/boot/grub# cat /etc/fstab
/dev/sda4        swap            swap        defaults        0  0
/dev/sda2        /                ext4        defaults,noatime        1  1
/dev/sda1        /boot            ext2        defaults,rw        1  2
/dev/sda3        /home            ext4        defaults,noatime        1  2
/dev/cdrom      /mnt/cdrom      auto        noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
tmpfs            /dev/shm        tmpfs      defaults        0  0
root@poppy:/boot/grub# grub-install /dev/sda
Installation finished. No error reported.
This is the contents of the device map /boot/grub/
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.

(hd0)        /dev/sda
(hd1)        /dev/sdb

This doesnīt work though, when I reboot I am looking at a grub prompt.

Checking /boot/grub, I see that no menu.lst has been created.


root@poppy:/boot/grub# ls
acpi.mod          e2fs_stage1_5                halt.mod          normal.mod          sfs.mod
affs.mod          echo.mod                    handler.lst      ntfs.mod            sh.mod
afs.mod          efiemu.mod                  handler.mod      ntfscomp.mod        sleep.mod
afs_be.mod        elf.mod                      hashsum.mod      ohci.mod            stage1
aout.mod          example_functional_test.mod  hdparm.mod        part_acorn.mod      stage2
at_keyboard.mod  ext2.mod                    hello.mod        part_amiga.mod      stage2_eltorito
ata.mod          extcmd.mod                  help.mod          part_apple.mod      tar.mod
ata_pthru.mod    fat.mod                      hexdump.mod      part_gpt.mod        terminal.lst
befs.mod          fat_stage1_5                hfs.mod          part_msdos.mod      terminal.mod
befs_be.mod      ffs_stage1_5                hfsplus.mod      part_sun.mod        terminfo.mod
biosdisk.mod      font.mod                    iso9660.mod      partmap.lst          test.mod
bitmap.mod        fs.lst                      iso9660_stage1_5  parttool.lst        tga.mod
bitmap_scale.mod  fshelp.mod                  jfs.mod          parttool.mod        trig.mod
blocklist.mod    functional_test.mod          jfs_stage1_5      password.mod        true.mod
boot.img          gcry_arcfour.mod            jpeg.mod          password_pbkdf2.mod  udf.mod
boot.mod          gcry_blowfish.mod            kernel.img        pbkdf2.mod          ufs1.mod
bsd.mod          gcry_camellia.mod            keystatus.mod    pci.mod              ufs2.mod
bufio.mod        gcry_cast5.mod              linux.mod        play.mod            ufs2_stage1_5
cat.mod          gcry_crc.mod                linux16.mod      png.mod              uhci.mod
cdboot.img        gcry_des.mod                lnxboot.img      probe.mod            usb.mod
chain.mod        gcry_md4.mod                load.cfg          pxe.mod              usb_keyboard.mod
charset.mod      gcry_md5.mod                loadenv.mod      pxeboot.img          usbms.mod
cmp.mod          gcry_rfc2268.mod            locale/          pxecmd.mod          usbtest.mod
command.lst      gcry_rijndael.mod            loopback.mod      raid.mod            vbe.mod
configfile.mod    gcry_rmd160.mod              ls.mod            raid5rec.mod        vbeinfo.mod
core.img          gcry_seed.mod                lsmmap.mod        raid6rec.mod        vbetest.mod
cpio.mod          gcry_serpent.mod            lspci.mod        read.mod            vga.mod
cpuid.mod        gcry_sha1.mod                lvm.mod          reboot.mod          vga_text.mod
crc.mod          gcry_sha256.mod              mdraid.mod        reiserfs.mod        video.lst
crypto.lst        gcry_sha512.mod              memdisk.mod      reiserfs_stage1_5    video.mod
crypto.mod        gcry_tiger.mod              memrw.mod        relocator.mod        video_fb.mod
date.mod          gcry_twofish.mod            minicmd.mod      scsi.mod            videotest.mod
datehook.mod      gcry_whirlpool.mod          minix.mod        search.mod          vstafs_stage1_5
datetime.mod      gettext.mod                  minix_stage1_5    search_fs_file.mod  xfs.mod
default          gfxmenu.mod                  mmap.mod          search_fs_uuid.mod  xfs_stage1_5        gfxterm.mod                  moddep.lst        search_label.mod    xnu.mod
diskboot.img      gptsync.mod                  msdospart.mod    serial.mod          xnu_uuid.mod
dm_nv.mod        grubenv                      multiboot.mod    setjmp.mod
drivemap.mod      gzio.mod                    multiboot2.mod    setpci.mod

So I tried


And get to write grub to MBR, but when I come to tell it where the boot partition is (ie /dev/sda1 in my case) I get an error message telling me /dev/sda1 is mounted read-only. But it isnīt, as grub-install had no problem writing to the same partition.


                              │ The partition '/dev/sda1' is mounted read-only,    │ 
                              │ either unmount it or mount it read-write.          │ 
                              │                    <  OK  >                        │ 

Any ideas??



linus72 11-15-2010 09:42 AM

Looks like your mixing grub legacy and grub2?

grub legacy uses a menu.lst while grub2 uses a grub.cfg

assuming you have grub installed, not grub2 (they will conflict)
First, make a menu.lst for /boot/grub

title Slackware
root (hd0,0)

open term, become root, do

root (hd0,0)
setup (hd0)

should report success or failure

spoovy 11-15-2010 09:48 AM

Yeah I tried grub2 first but couldnīt get it to work, so removepkg-ed it and installed grub instead. I thought it might cause problems but hoped that everything was over-writable so wouldnīt be too much of a problem.

Anyway i did as you suggest, this is the output -


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

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  19 sectors are embedded.
 Running "install /grub/stage1 (hd0) (hd0)1+19 p (hd0,0)/grub/stage2 /grub/menu.lst"... succeeded


Iīll reboot and get back.

spoovy 11-15-2010 09:58 AM

I get the grub menu, but when i select ĻSlackwareĻ I get


Error 1: Filename must be either an absolute pathname or blocklist
going into the editor I see that the grub entry is exactly as you suggested above ie


root (hd0,0)

Which is what my menu.lst contains. I assume it was supposed to update with the specific required kernel and initrd entries??

linus72 11-15-2010 10:52 AM

no, you gotta fill it in

kernel /boot/name-of-kernel ro root=/dev/sda1
initrd /boot/name-of-initrd

spoovy 11-15-2010 11:47 AM

ah i see. Problem is I don't have an initrd in my boot partition. -


spoovy@poppy:/boot$ ls
README.initrd@                      config-huge-                          config-huge-smp-          grub/  lost+found/            map    vmlinuz@
boot.0800                            vmlinuz-generic-
boot_message.txt                    vmlinuz-generic-smp-
config@                              vmlinuz-huge-
config-generic-              vmlinuz-huge-smp-

linus72 11-15-2010 11:57 AM

the dont put the initrd parameter
wait, why do you have different kernels?
you have every kernel

what is your machine 486 or 686?
smp or no?
if its new lappy either use vmlinuz-huge-smp- or vmlinuz-generic-smp-
the diff is with the generic kernel it is smaller but has less features and you need an initrd with the generic one
the huge-smp doesnt need an initrd

what does "ls -al" report about vmlinuz?
vmlinuz should be a symlink to your running kernel
if it's vmlinuz-huge-smp- then thats ok

so, it would be
title Slackware
root (hd0,0)
kernel /boot/vmlinuz ro root=/dev/sda1

spoovy 11-15-2010 01:12 PM

I tried that setup, but still no luck. I get "File not found". It's finding /boot partition ok but can't seem to find the kernel. I tried


root (hd0,0)
kernel /boot/vmlinuz ro root=/dev/sda2

as well (switching root to sda2 rather than 1) but makes no difference. Every option I could think of to edit at grub made no difference.

This is uname -a, from within the Slackware installation we are talking about -


Linux poppy #2 SMP Wed May 12 22:47:36 CDT 2010 i686 Genuine Intel(R) CPU            575  @ 2.00GHz GenuineIntel GNU/Linux
So i'm using the smp kernel. Whatever that means!

Symlink in /boot seems to be ok -


bash-4.1$ ls -lA | grep vmli
lrwxrwxrwx 1 root root      29 2010-11-13 20:35 vmlinuz -> vmlinuz-huge-smp-

linus72 11-15-2010 01:44 PM

what partition is /boot on?
and what partition is root / on?

spoovy 11-15-2010 01:55 PM

my fstab is posted in my op. /boot is sda1, / is sda2.

I have just read a little about smp. I understand that this is for symmetric processing therefore for multi-core processors. This machine is a single-core processor. Would that mean that I am running the wrong kernel? It works, once it's booted.

Erik_FL 11-15-2010 02:59 PM

I'm a bit confused because you are looking at "poppy" Linux with "uname" but apparently trying to install Slackware for booting. It is the version and kernel of the Slackware system that is important for booting Slackware, not the version of Linux you are using to install/configure GRUB.

SMP - Symetric-Multiprocessing (supports multiple CPUs in one OS)
root - Means different things in different situations.
Location of GRUB's files when installing GRUB (use "root" command)
Location of kernel and initrd files in a "menu.lst" entry (use "root" command)
Location of Linux OS files and root file system in a menu.lst entry ("root=" of "kernel" command)

I've had the least problems installing GRUB when I use a GRUB boot CD or floppy and install GRUB from the native GRUB command line. That means boot only GRUB and press C to get the GRUB command line. Then enter GRUB commands to install GRUB. You can find instructions for that in the GRUB "info" pages or I can create an ISO image for you.

If you look in the "/boot/grub" directory you should see the files required for GRUB. GRUB legacy requires these files to support all types of booting.


iso9660_stage1_5 ufs2_stage1_5
jfs_stage1_5      reiserfs_stage1_5  vstafs_stage1_5
e2fs_stage1_5  stage1            xfs_stage1_5
fat_stage1_5  menu.lst          stage2
ffs_stage1_5  minix_stage1_5    stage2_eltorito

You have to create the "menu.lst" file. For example:


title Linux
root (hd0,0)
kernel /vmlinuz vga=791 root=/dev/sda2 ro vt.default_utf8=0

The "vmlinuz" file is usually a symbolic link. You need to make sure that it links to the correct kernel file. Notice that the file system root specified by "root=" is "sda2", while the location of the kernel file directory is "sda1" specified by "root (hd0,0)". Also, since the entire partition is being mounted as "/boot", the actual file system with the kernel file has no "/boot" directory. The kernel file is located in the top-most directory of the file system.


rm vmlinuz
ln -s vmlinuz-huge-smp- vmlinuz

After you have created the "menu.lst", the "vmlinuz" link, and copied the required GRUB files into "/boot/grub" then you can install GRUB.

Boot from a grub floppy disk or CD, or make sure that the "" file has the correct information for the Linux system that you are using to install GRUB (not what you are going to boot with grub).

IMPORTANT: DO NOT change the BIOS default boot disk or device boot order after configuring and installing GRUB. The DOS drive ID's (hd0), (hd1), etc. are defined based on the BIOS configuration.

To install GRUB you specify two important locations.
  • Location of GRUB files "root"
  • GRUB boot sector code "setup"

For example, these GRUB commands will install GRUB to boot from the MBR (Master Boot Record) of the first hard disk, and load the GRUB files from the first partition on the first hard disk.


root (hd0,0)
setup (hd0)

To boot GRUB from the superblock of the first partition and load the GRUB files from the first partition you would do this.


root (hd0,0)
setup (hd0,0)

To boot GRUB from the superblock of the second partition and load the GRUB files from the third partition you would do this.


root (hd0,2)
setup (hd0,1)

Notice that "root" specifies the location of the GRUB files. The "setup" command only specifies where to write the boot sector code. If you don't write the boot sector code to the Master Boot Record then you must make sure that you set the correct partition "active" and marked for "Boot" in the partition table. You can also chain to the GRUB boot sector from some other bootloader when you boot GRUB from a partition rather than the MBR.

Here is how I usually install GRUB.
  • Plan my boot strategy. How will GRUB be started, where will files be?
  • Install Slackware grub pacakage
  • Copy grub files from "/usr/lib/grub/i386-pc" to "/boot/grub"
  • Create a GRUB boot floppy (use "info grub" for details)
  • Link "vmlinuz" to correct kernel file with "ln -s"
  • Create "menu.lst"
  • Create "" or verify that it is correct
  • Either boot grub floppy or run grub from Linux
  • Use "root" and "setup" commands to install GRUB

I use GRUB legacy because it is very simple and flexible. LILO is nearly as flexible except for the need to re-run "lilo" after configuration changes.

There is a difference between the environment when GRUB is being run from Linux versus when it is booting a system (native mode). When you type an identifier such as (hd0) GRUB has to convert that into a device identifier. On Linux that is done using "" or by looking at information about devices in the kernel. From native booting mode, the BIOS is given a device ID and that is mapped to a disk by the BIOS.

(hd0) BIOS device ID 80 (hex)
(hd1) BIOS device ID 81 (hex)
(hd2) BIOS device ID 82 (hex)
(hd3) BIOS device ID 83 (hex)

In some cases GRUB running on Linux cannot correctly determine the correct drive mapping or cannot access the boot sectors for installing GRUB. In that case you have to install GRUB from native mode by booting a GRUB floppy or CD to enter commands. Press "C" during the grub boot menu in order to enter GRUB commands.

If you change BIOS settings after you install GRUB then the BIOS device ID's may change. Even when the assignment for the first BIOS device ID (80) does not change, a BIOS may change assignments of IDs to other disks.

Many people are confused about boot sectors. There are basically 5 boot sectors on the first hard disk.
  • Master Boot Record / Partition Table "setup (hd0)"
  • First Primary Partition boot sector "setup (hd0,0)"
  • Second Primary Partition boot sector "setup (hd0,1)"
  • Third Primary Partition boot sector "setup (hd0,2)"
  • Fourth Primary Partition boot sector "setup (hd0,3)"

The BIOS only knows about hard disks (drive ID 80..83), not partitions. The BIOS always loads and runs the Master Boot Record sector of the first hard disk (80 hex).

The standard boot sector software in the Master Boot Record looks for the Primary Partition marked as "active" (the "boot" partition). It loads and runs the boot sector for the "active" boot partition.

The boot sector software in each Primary partition usually loads and starts the boot loader who's files are in that same Primary partition.

If you "setup" GRUB to start from the Master Boot Record then the only way to start other boot loaders is by chaining to them. The "active" partition is ignored since the GRUB boot sector replaces the standard MBR software. There is very little advantage to installing GRUB to the MBR and it can cause problems for other operating systems.

If you "setup" GRUB to start from a partition boot sector then you can use the "active" boot flag in the partition table to choose which boot loader starts up first. That can be GRUB if you want. Usually you "setup" GRUB to start from the partition that contains GRUB's files.

The only time that you really must install grub to the Master Boot Record is when you need five different boot loaders and the other four are installed to the Primary partition boot sectors. Some people feel that installing GRUB to the MBR is easier than installing GRUB to the Linux partition's boot sector. I have found the reverse to be true as modifying the MBR has a tendency to break Windows booting and un-installing GRUB from the MBR prevents booting other operating systems.

My suggestion is to install GRUB to a Linux partition's boot sector and then mark that partition as "active" for boot if you want GRUB to start first. If you have no other operating systems then you may have to format the disk or write the standard boot code into the MBR first.

You should at least be able to get GRUB to start up and press "C" for command mode. At that point you can manually enter commands to boot the kernel even when "menu.lst" is incorrect.

When you boot a kernel (and associated initrd) the kernel file and initrd file do not have to be in the same place as the root file system used by Linux. You specify the location of the root file system in the kernel parameters using "root=". You can put all your kernel and initrd files in the same place if you want. I find it less confusing to put the kernel and initrd files for each Linux system in that Linux system's root partition.

You only need one working copy of GRUB and there is no reason to have GRUB chain to a different version of GRUB. It's less confusing if you don't install a GRUB for each Linux OS. In fact you can even create a separate, small Primary partition just for GRUB. Depending on your needs, you can also put all the kernel and initrd files in the same small partition with GRUB. That may be helpful for encrypted file systems, for example.

To install GRUB successfully you need to know where you will put the GRUB files "/boot/grub" and also how you will start GRUB. Your choices for starting GRUB are basically the MBR versus a Linux Primary partition's boot sector.

To boot Linux successfully you need to know where the kernel/initrd files are located "/boot". You will also need to know the root device where that kernel's Linux OS is installed. The disk containing the kernel/initrd files is specified by the "root" command of the "menu.lst" entry. Both the kernel and initrd must be in the same partition. The root device for the OS files is specified by the "root=" kernel parameter in the "kernel" command for the menu.lst entry.

If you use a name such as "vmlinuz" or "initrd" that may be a symbolic link, make sure that the link goes to the correct files. If you build your own kernel you can also remove the symbolic links and create actual files called "vmlinuz" and "initrd". Each Linux OS can have its own "vmlinux" symbolic link located in its "/boot" directory of its root partition. The "root" menu option specifies the partition for those two files.

spoovy 11-15-2010 03:12 PM


Originally Posted by Erik_FL (Post 4159819)
I'm a bit confused because you are looking at "poppy" Linux with "uname" but apparently trying to install Slackware for booting. It is the version and kernel of the Slackware system that is important for booting Slackware, not the version of Linux you are using to install/configure GRUB.

FYI its the same installation. I am currently booting into it using the boot usb stick I created at install time. I am trying to set up grub so I don't need the usb stick.

I will read through the rest of your post in a bit = thanks!

Erik_FL 11-15-2010 03:28 PM

I believe that the problem booting is due to specifying a "boot"
directory name when in fact, the directory name should not be specified.


title Linux
root (hd0,0)
kernel /vmlinuz ro root=/dev/sda2

Because "/boot" is a mount point, the file system for that partition as seen by GRUB has no "boot" directory. At the time GRUB accesses the "vmlinuz" file, the file system is not mounted to a mount point and the "/boot" directory does not exist.

You could also solve the problem by creating an extra symbolic link.


cd /boot
ln -s ./ boot

That will give you a symbolic link of "/boot/boot" that points to "/boot" and will be seen in GRUB as "/boot" pointing to "/" of the same file system.

Then you can use either "kernel /vmlinuz" or "kernel /boot/vmlinuz" in "menu.lst".

Rambo_Tribble 11-15-2010 03:39 PM

You might try one or more of the utilities found here:

They can often be helpful in rescuing a GRUB installation.

linus72 11-15-2010 03:46 PM

EricFl is right
I never use a /boot partition...never really understood why anyone does..
but I think thats the issue

All times are GMT -5. The time now is 04:27 PM.