Slackware install optimization

Last modified: 2022-07-09 13:35

This page is about modifying some files in the Slackware distribution in order to install Slackware with fewer keystrokes.  There is Slackware documentation available in various places that purports to explain this, but I was confused anyway until I used the source.

Install modes

The relevant install modes are full, newbie, menu, and expert.  In full mode, every *.txz file is installed and tagfiles are redundant.  The other three modes follow a two-step process:

  1. Generate a tagfile.
  2. Use the tagfile.

Generate a tagfile

A Slackware package directory contains the following special files.

They are used in the different modes as follows.

modemaketagmaketag.eztagfile
newbieUnusedUnusedThis tagfile is used as-is
menuUnusedThis script is used to generate a tagfileUnused
expertThis script is used to generate a tagfileUnusedUnused

Use the tagfile

The tagfile specifies one of the following four options for each package:

To avoid redundant prompting, the scripts maketag and maketag.ez produce tagfiles containing only ADD and SKP commands.

Deleting packages

The slackinstall script works by iterating over *.txz files and looking up the tagfile response for each one.  Thus there is no harm in having taglines for packages that no longer exist.  However, it is an annoyance to get prompted in menu and expert mode for responses that will have no effect.  To fix this, the offending menu options must be removed from the maketag.ez and maketag scripts.

Deleting entire package serieses

To remove an entire package series from consideration, you must edit isolinux/setpkg in a manner analogous to maketag or maketag.ez to remove the offending menu option.

Using the source

The setpkg script is easy to access in the isolinux subdirectory of the Slackware distribution.  However, the other scripts are buried in the initramfs.  To get to them, you need to unpack the misleadingly named initrd.img file using gzip (Slackware 12 through 14.2) or xz (Slackware 15.0 or later) and cpio:

bash-3.1# mkdir cpiowork
bash-3.1# cd cpiowork
bash-3.1# gzip -dc ../initrd.img | cpio -i -d -H newc
43980 blocks
bash-3.1# cd usr/lib/setup
bash-3.1# ls
FDhelp  INSdir      SeTfdHELP   SeTnet         migrate.sh    unmigrate.sh
INCISO  INShd       SeTfull     SeTnopart      nopartHELP
INSCD   PROMPThelp  SeTkernel   SeTpartitions  pkgtool
INSNFS  SeTDOS      SeTkeymap   SeTpasswd      removepkg
INSSMB  SeTPKG      SeTmaketag  SeTswap        setup
INSURL  SeTconfig   SeTmedia    installpkg     slackinstall

The scripts of interest here are setup and slackinstall.

After making any necessary modifications to your working copy, you need to reverse the gzip/cpio steps to rebuild initrd.img:

bash-3.1# cd ../../..
bash-3.1# find | cpio -o -H newc | gzip -9 > ../initrd.img
23919 blocks

Changing the kernel that runs during the install

  1. Build the kernel that you want.  It is simpler to not use modules.
  2. Create a new directory under the kernels subdirectory of the Slackware distribution and populate it with System.map.gz, bzImage and config, following the examples already there.
  3. Add your new kernel to isolinux/isolinux.cfg following the examples already there.  If desired, make it the default kernel by changing the default line.

Changing the kernel that gets installed

The "a" series has a bunch of packages like this:

kernel-firmware-2.6.29.6-noarch-2.txt
kernel-firmware-2.6.29.6-noarch-2.txz
kernel-firmware-2.6.29.6-noarch-2.txz.asc
kernel-generic-2.6.29.6-i486-2.txt
kernel-generic-2.6.29.6-i486-2.txz
kernel-generic-2.6.29.6-i486-2.txz.asc
kernel-generic-smp-2.6.29.6_smp-i686-2.txt
kernel-generic-smp-2.6.29.6_smp-i686-2.txz
kernel-generic-smp-2.6.29.6_smp-i686-2.txz.asc
kernel-huge-2.6.29.6-i486-2.txt
kernel-huge-2.6.29.6-i486-2.txz
kernel-huge-2.6.29.6-i486-2.txz.asc
kernel-huge-smp-2.6.29.6_smp-i686-2.txt
kernel-huge-smp-2.6.29.6_smp-i686-2.txz
kernel-huge-smp-2.6.29.6_smp-i686-2.txz.asc
kernel-modules-2.6.29.6-i486-2.txt
kernel-modules-2.6.29.6-i486-2.txz
kernel-modules-2.6.29.6-i486-2.txz.asc
kernel-modules-smp-2.6.29.6_smp-i686-2.txt
kernel-modules-smp-2.6.29.6_smp-i686-2.txz
kernel-modules-smp-2.6.29.6_smp-i686-2.txz.asc

And there is a copy of the matching kernel sources in the "k" series.  You can replace all those with a single package that installs your kernel, modules and kernel source together.  You can follow the examples and combine the install/doinst.sh scripts, but you can also simplify it like this:

  1. Create a working directory /tmp/slack.
  2. Put System.map, config, and vmlinuz under /tmp/slack/boot.
  3. If you are making a 64-bit distribution on a 32-bit machine or vice-versa, do export ARCH=x86_64 or export ARCH=i386 before attempting the next step.
  4. INSTALL_MOD_PATH=/tmp/slack make modules_install
  5. Move the kernel sources into /tmp/slack/usr/src/linux-(version) and add a symlink from linux to linux-(version).
  6. Ensure that the build and source links in /tmp/slack/lib/modules/(version) point to /usr/src/linux-(version).
  7. Create /tmp/slack/etc/rc.d/rc.modules based on examples and make it load whatever modules you need.
  8. Optionally put whatever verbiage you like in /tmp/slack/install/slack-desc (following examples).
  9. Tar it up and drop it into the "a" series along with a .txt file that matches slack-desc.
  10. To prevent the installer from replacing the kernel installed thusly with the one that was used to run the install, replace the SeTkernel script in the initrd image with an empty file.  See using the source for instructions on modifying the initrd image.

Note that liloconfig looks for /boot/vmlinuz but not /boot/bzImage.

Other things to mess with

While dinking with initrd.img uncompressed in cpiowork as above, patch lvm.conf to fix stupid problems creating LVM volumes:

cd /tmp/slack/isolinux/cpiowork/etc/lvm
cp lvm.conf /tmp/temp
sed s/sysfs_scan\ =\ 1/sysfs_scan\ =\ 0/ /tmp/temp > lvm.conf
rm /tmp/temp

Other patches that are too messy to include here:

Extra steps for USB install media

If you use the script usbimg2disk.sh to create a bootable USB stick, it overrides some of the changes described above.  There is actually a second copy of the stock initrd.img under EFI/BOOT that it uses.

./usbimg2disk.sh -f -s /tmp/slack -L slack -o /dev/sdj

echo ""
echo "Undoing damage..."
mount -t vfat -o shortname=mixed /dev/sdj1 /mnt
rm /mnt/*.s
cp -a /tmp/slack/isolinux/message.txt \
      /tmp/slack/isolinux/setpkg \
      /mnt/slack/kernels/CD/bzImage \
      /tmp/slack/isolinux/initrd.img \
      /mnt
cat > /mnt/syslinux.cfg <<EOF
default CD
prompt 1
timeout 0
display message.txt
label CD
  kernel bzImage
  append initrd=initrd.img load_ramdisk=1 prompt_ramdisk=0 rw
EOF
umount /mnt

Notes from versions

Slack 15

initrd.img is now packed with xz not gzip.

compact is now on by default in liloconfig.

Had to remove the cpio option --no-absolute-filenames from the initrd.img unpacking commands because it now makes the initrd unbootable.

Slack 13

First official release with a 64-bit spin.

Slack 12

Prior to Slackware 13, all packages were gzipped tar files with the extension .tgz.  Now they are xz-compressed tar files with the extension .txz.

Slack 11

Prior to Slackware 12, initrd.img was a gzipped ext2 image instead of a gzipped cpio archive.  This was the old initrd system as opposed to the new initramfs system.

bash-3.00# gzip -dc slackware-10.2/isolinux/initrd.img > temp.img
bash-3.00# mount -o ro,loop temp.img /mnt
bash-3.00# cd /mnt/usr/lib/setup/
bash-3.00# ls
FDhelp  INShd       SeTfdHELP   SeTmedia       installpkg  setup
INSCD   PROMPThelp  SeTfull     SeTnopart      migrate.sh  slackinstall
INSNFS  SeTDOS      SeTkernel   SeTpartitions  nopartHELP  unmigrate.sh
INSdir  SeTPKG      SeTkeymap   SeTpasswd      pkgtool
INSfd   SeTconfig   SeTmaketag  SeTswap        removepkg


KB
Home