There are several ways to install Slackware to your computer. You have network installation options available (where the packages are on a remote NFS/FTP/HTTP/Samba server) and local options (where the packages are on a DVD/CDROM or a local directory).
In all these cases you need to boot your computer with Slackware’s installer. Traditionally you can boot from a DVD or CDROM of course, or even from a floppy if you are creative. If your computer does not have a DVD/CD drive then there is still the network boot (aka PXE boot) or using a USB thumb drive to boot from.
It is the USB thumb drive I want to talk about in this blog post.
Slackware ships with a USB image file “usbboot.img” since the 12.0 release (see http://slackware.osuosl.org/slackware-13.0/usb-and-pxe-installers/usbboot.img for instance). Using “dd” this image can be transfered to a USB thumb drive which transforms the USB drive to a bootable Slackware installer. The packages will still have to be available on a local or network medium, because the “usbboot.img” image only contains kernels and setup files… no packages.
If you do not want to “sacrifice” a USB thumb drive for this (note that dumping the image file on the USB stick will destroy all data already present on the stick), there is a solution: Slackware also ships with a script “usbimg2disk.sh” since the 13.0 release (see http://slackware.osuosl.org/slackware-13.0/usb-and-pxe-installers/usbimg2disk.sh for instance). This script extracts the content from the “usbboot.img” image file and uses this to transform a regular USB thumb drive into a bootable Slackware installer non-destructively (i.e. any existing files on the stick will not be touched), as long as there is some 30 MB of available free space on the stick.
The “usbimg2disk.sh” script is also convenient if your computer refuses to boot from a USB stick loaded with the “usbboot.img” file. The BIOS of some computers will not understand the format of the default Slackware USB image. Using the “usbimg2disk.sh” script, you create an alternative bootable USB stick that will be recognized by your computer’s BIOS.
All nice, but there is still a problem that remains to be solved.
If you have a netbook for instance.
The average netbook computer (like my own Asus EeePC 1000H) comes without DVD drive. If you are mobile and without access to wired network, it will not be easy to install Slackware packages after booting from the USB stick.
In such circumstances you need to copy the complete Slackware package tree to a disk partition of your netbook before you start the Slackware installation. This is not always efficient, or even feasible.
Now, I have been creating “multi-partition USB images” for several Slackware releases in the past (more accurately, I have written the scripts that let you create the image and then transfer it to a big enough USB stick using the ” dd” command). You can find those scripts here: http://slackware.com/~alien/tools/usbinstall/ . This is an elegant way to create a USB Slackware installer that has all packages “on board” but I wanted something that was more basic, and thus potentially easier to use for a Slackware newbie.
The “old” scripts at http://slackware.com/~alien/tools/usbinstall/ create a secoind, EXT2-formatted partition to store the Slackware packages. This makes it harder to add more files if you are on a Windows computer for instance. I wanted to have a USB stick with a single large FAT partition – and fortunately the bootloader I am using (syslinux) allows this.
So I took Slackware’s “usbimg2disk.sh” script (which I incidentally wrote too) and expanded its functionality. What is new? The script can now copy the Slackware setup files, kernels and packages all to a regular USB thumb drive, if that has a minimum of 2GB free space available.And it still retains its original functionality (to create a bootable installer as long as there is 30 MB of available free space on the stick).
The USB stick does not even have to be formatted! So, if you already have data on the stick, it will not be destroyed.
There is one advantage to formatting though: if you allow the script to format the USB stick, it will make your future Slackware installation easier. The formatting step assigns a label “USBSLACKINS” to the fat partition. This enables Slackware’s setup to recognize and mount the USB partition automatically after boot, and pre-fill the SOURCE setup dialog “Install from a pre-mounted directory” with the correct directory path. Just hit ENTER a few times to start the installation!
If you did not format the USB stick but used an existing VFAT-formatted stick, you have two options:
- either you assign the label “USBSLACKINS” to the stick’s fat partition manually,
- or else you do the following after booting from the USB stick but before running setup: mount the USB partition yourself using the following commands (for this eaxmple I am assuming that the installer recognized the drive as “/dev/sdX“):
mount -t vfat -o ro,shortname=mixed /dev/sdX /usbinstall/
And then after you’ve started “setup” and have come to the “SOURCE selection” dialog, you use the directory “/usbinstall/slackware-<version>/slackware” as the source location where setup should look for Slackware packages.
This is how the help text for the script looks:
./usbimg2disk.sh -h # # Purpose #1: to use the content of Slackware's usbboot.img and # transform a standard USB thumb drive with a single vfat partition # into a bootable medium containing the Slackware Linux installer. # # Purpose #2: to use the contents of a Slackware directory tree # and transform a standard USB thumb drive with # a single vfat partition and 2GB of free space into # a self-contained USB installation medium for Slackware Linux. # # # Your USB thumb drive may contain data! # This data will *not* be overwritten, unless you have # explicitly chosen to format the drive by using the '-f' parameter. # # usbimg2disk.sh accepts the following parameters:
# -h|--help This help # -f|--format Format the USB drive before use # -i|--infile <filename> Full path to the usbboot.img file # -l|--logfile <filename> Optional logfile to catch fdisk output # -o|--outdev <filename> The device name of your USB drive # -s|--slackdir <dir> Use 'dir' as the root of Slackware tree # -u|--unattended Do not ask any questions # # Examples: # # usbimg2disk.sh -i ~/download/usbboot.img -o /dev/sdX # usbimg2disk.sh -f -s /home/ftp/pub/slackware-13.0 -o /dev/sdX # # The second example shows how to create a fully functional Slackware # installer on a USB stick (it needs a Slackware tree as the source).
The enhanced script is here: http://connie.slackware.com/~alien/tools/usbimg2disk.sh …get itwhile it’s hot!
I hope it will get added to the Slackware tree soon. Tell me if you liked it! Any questions or remarks, you can leave them below this post.