Howto install Slackware-15.0 using Grub

Introduction

Don't be a Pink, get Slack! Become an ordained bhyve-Minister today by installing the oldest Linux distribution there was, is and ever will be – Slackware Linux.

Ok, now seriously: Slackware 15.0 is out since some time after a really long period of no releases (the last version, 14.2, was released in 2016), I was eager to try it out.

The installation is not straightforward, though. Slackware Linux uses a rather uncommon bootloader, elilo, which does not work with bhyve-UEFI.

In this tutorial, I will show how to use Grub instead.

Creating the virtual machine

I am using sysutils/vm-bhyve to manage my virtual machine. For Slackware-Linux, I chose the following template, which I stored in /vm/.templates/slack.conf:
Code:
loader="uefi"
cpu=4
graphics="yes"
memory=8192M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
The only important things here are that we are going to use “uefi” as the loader and an EFI-frambuffer (graphics="yes").

Let's create the VM and start the installation process:
Code:
# vm create -t slack -s 128G slackguest
# vm install slackguest slackware64-15.0-install-dvd.iso

On another console, start the VNC-client (e.g. net/vncviewer)
Code:
# vncviewer 0.0.0.0:5900

Disk partitioning and running the installer

The installer will ask you to choose a keyboard map, after that, it will drop you into a shell, where you need to partition the harddrive:
Code:
# fdisk /dev/vda

Here is the setup I am using for this tutorial:
  • Use a GPT partition (not DOS).
  • First partition (/dev/vda1) is the EFI partition; 256MB should be enough.
  • Second partition (/dev/vda2) is the Linux root partition; I chose 120G to leave some space for swap.
  • Third partition (/dev/vda3) is the swap partition.
After partitioning, we are ready to enter the setup:
Code:
# setup

The installer is ok-ish from an experienced user perspective. Just keep the following in mind for continuing the tutorial:
  • Activate /dev/vda3 as swap.
  • When asked, coose ext4 as filesystem for the main partition /dev/vda2.
  • When asked whether setup shall format the EFI parition, answer “Yes”.
  • When asked whether to skip LILO installation and proceed to ELILO installation, confirm.
  • When asked whether to ceate an UEFI boot entry, simply say “Yes”.
When the installation is finished, you can exit the installer, but do not reboot the machine yet. Instead, select “Shell” as the exit-option.

Post-installation steps

In the shell, you will be inside the minimal installation environment again. The actual system is mounted under /mnt. Let's chroot into that and continue our work:
Code:
# chroot /mnt /bin/bash
# source /etc/profile

Mount the EFI partition:
Code:
# mkdir /mnt/efi
# mount /dev/vda1 /mnt/efi

Install Grub: This will create an additional directory in the EFI partition, but will also install the necessary Grub-modules in /boot/grub.
Code:
grub-install --target=x86_64-efi --efi-directory=/mnt/efi

For some reason, grub-install does not install a font, which is needed when booting into an EFI-framebuffer console:
Code:
cp /usr/share/grub/dejavusansmono.pf2 /boot/grub/fonts/

Furthermore, the Grub-bootloader in the EFI-partition – as installed in the previous step – does not work. We will replace it with a custom one:

First, remove all stuff from the EFI-partition:
Code:
rm -r /mnt/efi/EFI/*

Next, create a configuration file for Grub, which configures the location where Grub can find its modules and the actual configuration file: Put the following content into the file /boot/grub/grub-embedded.cfg:
Code:
set root=hd0,gpt2
set prefix=($root)/boot/grub
Here, two variables are set, root and prefix. The first one tells Grub where to find the Linux kernel(s), but in Grub's own notation: “hd0” means “first hard drive in the system” and “gpt2” means second (GPT-)partition. So, hd0,gtp2 amounts to /dev/vda2, which is exactly what we want. The second variable (prefix) tell Grub where to find its modules and the main configuration file –

Using this configuration, we create the Grub bootloader image:
Code:
# grub-mkimage --format=x86_64-efi --output=/mnt/efi/EFI/BOOT/BOOTX64.EFI --config=grub-embedded.cfg --compression=xz --preifx=/boot/grub part_gpt ext2
The result will be the file EFI/BOOT/BOOTX64.EFI inside the EFI-partition.

Finally, we create the actual Grub-configuration containing our kernels, etc.:
Code:
# grub-mkconfig -o /boot/grub/grub.cfg

That should be it:
Code:
# umount /mnt/efi

Since we are in a chroot-environment, the poweroff does not work. But it is o.k. to do it from the host using the following command:
Code:
# vm poweroff slackguest

Final touch

The initial ramdisk (/boot/initrd.gz) is too big for the huge-kernel we are using, leading to annoying “duplicate kernel symbols” warning messages on boot up. Once you have started your VM, create a new one by using the following command:
Code:
mkinitrd -c -k 5.15.19 -f ext4 -r /dev/vda2 -u -o /boot/initrd.gz
 
First and foremost:
the oldest Linux distribution there was, is and ever will be – Slackware Linux
And the only linux distro that is worth to use it (not counting meta-distros like Gentoo).

Introduction

Don't be a Pink, get Slack! Become an ordained bhyve-Minister today by installing the oldest Linux distribution there was, is and ever will be – Slackware Linux.

Ok, now seriously: Slackware 15.0 is out since some time after a really long period of no releases (the last version, 14.2, was released in 2016), I was eager to try it out.

The installation is not straightforward, though. Slackware Linux uses a rather uncommon bootloader, elilo, which does not work with bhyve-UEFI.

In this tutorial, I will show how to use Grub instead.

Creating the virtual machine

I am using sysutils/vm-bhyve to manage my virtual machine. For Slackware-Linux, I chose the following template, which I stored in /vm/.templates/slack.conf:
Code:
loader="uefi"
cpu=4
graphics="yes"
memory=8192M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
The only important things here are that we are going to use “uefi” as the loader and an EFI-frambuffer (graphics="yes").

Let's create the VM and start the installation process:
Code:
# vm create -t slack -s 128G slackguest
# vm install slackguest slackware64-15.0-install-dvd.iso

On another console, start the VNC-client (e.g. net/vncviewer)
Code:
# vncviewer 0.0.0.0:5900

Disk partitioning and running the installer

The installer will ask you to choose a keyboard map, after that, it will drop you into a shell, where you need to partition the harddrive:
Code:
# fdisk /dev/vda

Here is the setup I am using for this tutorial:
  • Use a GPT partition (not DOS).
  • First partition (/dev/vda1) is the EFI partition; 256MB should be enough.
  • Second partition (/dev/vda2) is the Linux root partition; I chose 120G to leave some space for swap.
  • Third partition (/dev/vda3) is the swap partition.
After partitioning, we are ready to enter the setup:
Code:
# setup

The installer is ok-ish from an experienced user perspective. Just keep the following in mind for continuing the tutorial:
  • Activate /dev/vda3 as swap.
  • When asked, coose ext4 as filesystem for the main partition /dev/vda2.
  • When asked whether setup shall format the EFI parition, answer “Yes”.
  • When asked whether to skip LILO installation and proceed to ELILO installation, confirm.
  • When asked whether to ceate an UEFI boot entry, simply say “Yes”.
When the installation is finished, you can exit the installer, but do not reboot the machine yet. Instead, select “Shell” as the exit-option.

Post-installation steps

In the shell, you will be inside the minimal installation environment again. The actual system is mounted under /mnt. Let's chroot into that and continue our work:
Code:
# chroot /mnt /bin/bash
# source /etc/profile

Mount the EFI partition:
Code:
# mkdir /mnt/efi
# mount /dev/vda1 /mnt/efi

Install Grub: This will create an additional directory in the EFI partition, but will also install the necessary Grub-modules in /boot/grub.
Code:
grub-install --target=x86_64-efi --efi-directory=/mnt/efi

For some reason, grub-install does not install a font, which is needed when booting into an EFI-framebuffer console:
Code:
cp /usr/share/grub/dejavusansmono.pf2 /boot/grub/fonts/

Furthermore, the Grub-bootloader in the EFI-partition – as installed in the previous step – does not work. We will replace it with a custom one:

First, remove all stuff from the EFI-partition:
Code:
rm -r /mnt/efi/EFI/*

Next, create a configuration file for Grub, which configures the location where Grub can find its modules and the actual configuration file: Put the following content into the file /boot/grub/grub-embedded.cfg:
Code:
set root=hd0,gpt2
set prefix=($root)/boot/grub
Here, two variables are set, root and prefix. The first one tells Grub where to find the Linux kernel(s), but in Grub's own notation: “hd0” means “first hard drive in the system” and “gpt2” means second (GPT-)partition. So, hd0,gtp2 amounts to /dev/vda2, which is exactly what we want. The second variable (prefix) tell Grub where to find its modules and the main configuration file –

Using this configuration, we create the Grub bootloader image:
Code:
# grub-mkimage --format=x86_64-efi --output=/mnt/efi/EFI/BOOT/BOOTX64.EFI --config=grub-embedded.cfg --compression=xz --preifx=/boot/grub part_gpt ext2
The result will be the file EFI/BOOT/BOOTX64.EFI inside the EFI-partition.

Finally, we create the actual Grub-configuration containing our kernels, etc.:
Code:
# grub-mkconfig -o /boot/grub/grub.cfg

That should be it:
Code:
# umount /mnt/efi

Since we are in a chroot-environment, the poweroff does not work. But it is o.k. to do it from the host using the following command:
Code:
# vm poweroff slackguest

Final touch

The initial ramdisk (/boot/initrd.gz) is too big for the huge-kernel we are using, leading to annoying “duplicate kernel symbols” warning messages on boot up. Once you have started your VM, create a new one by using the following command:
Code:
mkinitrd -c -k 5.15.19 -f ext4 -r /dev/vda2 -u -o /boot/initrd.gz

Thank you so much for that and long live Slackware.
 
Dear Moderator, this thread was meant to go to the “Howtos and FAQs” section. Could you please move it there?
 
I don't do VM but I have Slack current, and 15 ( UEFI Installs) on my laptop along with BLah Ubunutu, and MX linux and FreeBSD 13.1 and use slacks grub to boot them all or grub in general controlled by a Linux system, and I was surprided to see Slackware mentioned in A FreeBSD forum. so I read it. 😁
 
I don't do VM but I have Slack current, and 15 ( UEFI Installs) on my laptop along with BLah Ubunutu, and MX linux and FreeBSD 13.1 and use slacks grub to boot them all or grub in general controlled by a Linux system, and I was surprided to see Slackware mentioned in A FreeBSD forum. so I read it. 😁
Thanks! I am planning to use Slackware as a lighter alternative to CentOS and Ubuntu for my Linuxulator stuff.
 
Could one also use Bhyve to run Slackware one already has on a partition (non-UEFI FreeBSD & Slackware of course)?
 
Dear Moderator, this thread was meant to go to the “Howtos and FAQs” section. Could you please move it there?
Click on the report button to get our attention, completely missed this post.
 
Could one also use Bhyve to run Slackware one already has on a partition (non-UEFI FreeBSD & Slackware of course)?
Do you mean you already have a Slackware partition on your physical hard-drive and would like to migrate it into Bhyve-VM?
 
My original post becomes completely obsolete when you add uefi_vars="yes" to the VM-config /vm/.templates/slack.conf:
Code:
loader="uefi"
uefi_vars="yes"
cpu=4
graphics="yes"
memory=8192M
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"

With this config, elilo works fine!
 
Do you mean you already have a Slackware partition on your physical hard-drive and would like to migrate it into Bhyve-VM?
Sort of: I already have other OS partitions on SSD/M2/NVME, most-used which is Slackware, but want to also keep them as partitions, which I've read can be done with Bhyve and Xen, though I haven't used either. Some the others include Tribblix and/or OmniOS CE OpenSolaris/Illumos UNIXes, which I don't know it's possible to move the partitions (GParted won't do it, but I don't know about other tools)... if possible, I'd run those later too, which is why maybe I can't 'migrate', but those should be asked in a separate thread.
 
Back
Top