LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware and the grub boot loader. (https://www.linuxquestions.org/questions/slackware-14/slackware-and-the-grub-boot-loader-4175677924/)

stf92 06-30-2020 06:19 PM

Slackware and the grub boot loader.
 
Hi: Two questions:
(a) Do you know anybody using slackware with grub? I mean grub loads the Slackware operating system.

(b) Does grub come with the Slackware installation disks?

colorpurple21859 06-30-2020 06:53 PM

Yes and yes. Grub isn't used as the bootloader by default. You can install grub manually by chroot into your system.
at the elilo/lilo prompt open another console
chroot /mnt
then run grub-install and grub-mkconfig

Richard Cranium 06-30-2020 07:00 PM

Everything that @colorpurple21859 wrote.

I think that I don't have any physical machines left that use lilo/elilo.

In fact, I just installed grub 2.04 on my Slackware64 14.2 machine so I could easily boot into windows 10 on that particular machine. 2 of the other machines don't have to deal with windows, so I don't need to upgrade grub on them. The last machine is running -current, so grub 2.04 is already there.

stf92 06-30-2020 07:22 PM

Thanks. Is there a detailed procedure, assuming I already have the grub boot loader in the MBR, to make the boot loader to load Slackware? I think the procedure is quite simple, only involving at most two steps. Perhaps in the Slackware documentation there are precise instructions to follow?

I have already tried using grub with Slackware in the past but the result has been complete failure and it is already three years that I lack Slackware in my machine.

colorpurple21859 06-30-2020 07:26 PM

after installing bootloader to mbr run
Code:

grub-mkconfig -o /boot/grub/grub.cfg
That will give you a grub menu. Slackware doesn't auto-run that command with kernel updates to update the grub menu for kernel changes.

upnort 06-30-2020 07:32 PM

I use GRUB.

I've been using GRUB since before I started using Slackware, when GRUB was version 0.9x. Back in those days I was multi-booting a lot. I found GRUB more suited to that environment. Just edit menu.lst and not worry about forgetting to run lilo.

I don't think GRUB was included in Slackware until around 10.1 and was in the /extra branch.

I use lilo in throwaway Slackware VMs.

stf92 06-30-2020 08:21 PM

Quote:

Originally Posted by colorpurple21859 (Post 6139922)
after installing bootloader to mbr run
Code:

grub-mkconfig -o /boot/grub/grub.cfg
That will give you a grub menu. Slackware doesn't auto-run that command with kernel updates to update the grub menu for kernel changes.

I have debian 10 in another partition. Shall I still be able to boot debian after running that command?

upnort 06-30-2020 09:18 PM

Quote:

I have debian 10 in another partition. Shall I still be able to boot debian after running that command?
One of the systems needs to be the primary GRUB source. On one system or the other, enable /etc/grub.d/30_os-prober (chmod +x). Then run grub-mkconfig on that system. Debian systems support a grub-mkconfig script wrapper named update-grub.

colorpurple21859 06-30-2020 09:21 PM

Quote:

I have debian 10 in another partition
If you only have one drive, whichever distro was last to run
Code:

grub-install /dev/sda
assuming your one drive is sda, will display the boot menu of /boot/grub/grub.cfg of that distro.
Yes you should be able to boot debian after running that command, but there maybe other issues that we aren't aware of at this time.

stf92 07-01-2020 10:41 PM

This is the grub.cfg I got:
Code:

bill@darkstar:/boot/grub$ cat grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
  set default="${next_entry}"
  set next_entry=
  save_env next_entry
  set boot_once=true
else
  set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
  font=unicode
else
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
else
  search --no-floppy --fs-uuid --set=root 3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=5
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root  3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
else
  search --no-floppy --fs-uuid --set=root 3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
fi
insmod png
if background_image /usr/share/desktop-base/futureprototype-theme/grub/grub-4x3.png; then
  set color_normal=white/black
  set color_highlight=black/white
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
        set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3b7be193-a2fd-4b48-8d07-bd2311b0f5ba' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_msdos
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
        else
          search --no-floppy --fs-uuid --set=root 3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
        fi
        echo        'Loading Linux 4.19.0-8-amd64 ...'
        linux        /boot/vmlinuz-4.19.0-8-amd64 root=UUID=3b7be193-a2fd-4b48-8d07-bd2311b0f5ba ro edd=off noapic i8042.nopnp quiet
        echo        'Loading initial ramdisk ...'
        initrd        /boot/initrd.img-4.19.0-8-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-3b7be193-a2fd-4b48-8d07-bd2311b0f5ba' {
        menuentry 'Debian GNU/Linux, with Linux 4.19.0-8-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-8-amd64-advanced-3b7be193-a2fd-4b48-8d07-bd2311b0f5ba' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
                else
                  search --no-floppy --fs-uuid --set=root 3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
                fi
                echo        'Loading Linux 4.19.0-8-amd64 ...'
                linux        /boot/vmlinuz-4.19.0-8-amd64 root=UUID=3b7be193-a2fd-4b48-8d07-bd2311b0f5ba ro edd=off noapic i8042.nopnp quiet
                echo        'Loading initial ramdisk ...'
                initrd        /boot/initrd.img-4.19.0-8-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 4.19.0-8-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.19.0-8-amd64-recovery-3b7be193-a2fd-4b48-8d07-bd2311b0f5ba' {
                load_video
                insmod gzio
                if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
                else
                  search --no-floppy --fs-uuid --set=root 3b7be193-a2fd-4b48-8d07-bd2311b0f5ba
                fi
                echo        'Loading Linux 4.19.0-8-amd64 ...'
                linux        /boot/vmlinuz-4.19.0-8-amd64 root=UUID=3b7be193-a2fd-4b48-8d07-bd2311b0f5ba ro single edd=off noapic i8042.nopnp
                echo        'Loading initial ramdisk ...'
                initrd        /boot/initrd.img-4.19.0-8-amd64
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class slackware --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
        insmod part_msdos
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
        else
          search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
        fi
        linux /boot/vmlinuz root=/dev/mmcblk0p2 edd=off noapic
}
submenu 'Advanced options for Slackware 14.2 (on /dev/mmcblk0p2)' $menuentry_id_option 'osprober-gnulinux-advanced-2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-generic--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-generic root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-generic-4.4.14--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-generic-4.4.14 root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-generic-smp--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-generic-smp root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-generic-smp-4.4.14-smp--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-generic-smp-4.4.14-smp root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-huge root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge-4.4.14--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-huge-4.4.14 root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge-smp--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-huge-smp root=/dev/mmcblk0p2
        }
        menuentry 'Slackware 14.2 (on /dev/mmcblk0p2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-huge-smp-4.4.14-smp--2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
                insmod part_msdos
                insmod ext2
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                else
                  search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
                fi
                linux /boot/vmlinuz-huge-smp-4.4.14-smp root=/dev/mmcblk0p2
        }
}

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

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### 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.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
bill@darkstar:/boot/grub$

But there is no line for initrd. Should I add one? And how should it read?

Richard Cranium 07-01-2020 10:44 PM

Quote:

Originally Posted by stf92 (Post 6139920)
Thanks. Is there a detailed procedure, assuming I already have the grub boot loader in the MBR, to make the boot loader to load Slackware? I think the procedure is quite simple, only involving at most two steps. Perhaps in the Slackware documentation there are precise instructions to follow?

I have already tried using grub with Slackware in the past but the result has been complete failure and it is already three years that I lack Slackware in my machine.

Well, there's https://github.com/Richard-Cranium/SlackwareGrub2

colorpurple21859 07-02-2020 01:52 AM

Do you have an initrd.gz?
If you only use the first slackware entry to boot and it works without the initrd.gz line, I wouldn't worrry about it.

Otherwise grub is versatile so there is several ways of doing this.
1. As per Richard Cranium post 11

2. Copy the slackware menu entries that you want to use to /etc/grub.d/40_custom and insert the initrd=/boot/initrd.gz between the vmlinuz line and the } line and run update-grub. Be aware that is file is static and won't change with a kernel version change.

3.Chainload slackware grub.cfg with this entry
Code:

menuentry 'Slackware chainload (on /dev/mmcblk0p2)' --class slackware --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-2d63e598-b1b4-4e32-a781-9fe9ceae2c11' {
        insmod part_msdos
        insmod ext2
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root  2d63e598-b1b4-4e32-a781-9fe9ceae2c11
        else
          search --no-floppy --fs-uuid --set=root 2d63e598-b1b4-4e32-a781-9fe9ceae2c11
        fi
        configfile /boot/grub/grub.cfg
}


captain_sensible 07-02-2020 04:09 AM

I would like to ask how the approach to installing grub2 if you have uefi differs

Quote:

I already have the grub boot loader in the MBR, to m

the above implies bios ?

Previously I had a pc using bios; i booted up in lilo , removed it ,installed grub2 ran command

grub-mkconfig -o /boot/grub/grub.cfg from memory and everything worked. Then if i understand it grub stage 1 was on mbr and that pointed to grub stage2.

For myself and probably many others having a /dev/sda with a gpt label, a 100MB of EFI and presently using elilo ,how would the approach to installing grub2 differ than if you have say a bios pc and lilo?


I see in boot there is a grub folder. Would installing grub2 put files there are creates another directory called grub2 ?

enorbet 07-02-2020 06:50 AM

@captain_sensible - you can preview what grub will see and how it will function if you have rEFInd installed for EFI booting. Just load your Slackware install media and select it with rEFInd and the grub bootloader for UEFI media boot will appear and display all the kernels it finds (even some you may have no intention of using excepting recovery) and you can test each and every one.

Didier Spaier 07-02-2020 07:32 AM

1 Attachment(s)
Quote:

Originally Posted by enorbet (Post 6140508)
@captain_sensible - you can preview what grub will see and how it will function if you have rEFInd installed for EFI booting. Just load your Slackware install media and select it with rEFInd and the grub bootloader for UEFI media boot will appear and display all the kernels it finds (even some you may have no intention of using excepting recovery) and you can test each and every one.

You can do that from a running Slint typing grub-emu in a terminal. Users will be proposed to run it at end of Slint installation in next Slint installer, which will help blind users to know the layout of the GRUB menu after reboot, otherwise not accessible to them.


All times are GMT -5. The time now is 09:15 PM.