Kjetil's Information Center: A Blog About My Projects

Slackware 14.2 on a USB-stick

It's exactly 10 years since the first post on this website.

Anyway, I discovered that installing Slackware on a USB-stick wasn't as easy as it was last time in 2012, and those instructions are no longer valid for newer versions like 14.2. The main problem is that the kernel no longer contains built-in support for USB mass storage and the extended file systems.

Here are the updated steps:

1. Boot a host machine with the original Slackware DVD.

2. Insert the USB-stick into the host machine and use fdisk to create a large single Linux (0x83) partition on it.

3. Run the Slackware setup program and choose the newly created USB-stick partition as the target, with an ext4 file system.

4. Near the end of the setup process, skip the step involving installation of the LILO boot loader!

5. Unplug the USB-stick and put it into another fully functional Slackware 14.2 box.

6. Mount and chroot into the USB-stick filesystem. (In my case this was at /dev/sdc1 mounted on /mnt/sdc1):

mount /mnt/sdc1
mount -o bind /proc /mnt/sdc1/proc
mount -o bind /sys /mnt/sdc1/sys
mount -o bind /dev /mnt/sdc1/dev
chroot /mnt/sdc1
          


6. Configure and update the Linux kernel, by following these steps:

cd /usr/src/linux
make menuconfig # Do the necessary changes as described below.
make
make modules
make modules_install
make install # Will fail on LILO install, but just ignore this since kernel image is still copied to /boot.
          

In menuconfig, make sure to change these from module to built-in:
* xHCI HCD (USB 3.0) support
* EHCI HCD (USB 2.0) support
* USB Mass Storage support
* Second extended fs support
* The Extended 3 (ext3) filesystem
* The Extended 4 (ext4) filesystem

7. Modify /etc/fstab on the USB-stick and make sure that the root file system uses the correct partition device on the target machine. (e.g. /dev/sdb1)

8. Create the file /boot/extlinux.conf on the USB-stick and input contents similar to this:

default Linux
prompt 1
timeout 100
label Linux
  kernel vmlinuz
  append root=/dev/sdb1 rootwait vga=normal vt.default_utf8=0
          


8. Exit the chroot environment:

exit
umount /mnt/sdc1/proc
umount /mnt/sdc1/sys
umount /mnt/sdc1/dev
          


9. Install the boot loader on the USB-stick with the "extlinux" command like this: "extlinux -i /mnt/sdc1/boot". (Replace /mnt/sdc1 with correct mount point if necessary.)

10. Unmount the USB-stick and overwrite the master boot record on it with a command like this: "cat /usr/share/syslinux/mbr.bin > /dev/sdc". (Replace /dev/sdc with correct device if necessary.)

Topic: Configuration, by Kjetil @ 28/07-2017, Article Link