Difference between revisions of "Custom Slax Bootable OS"
(→Procedure) |
(→Procedure) |
||
| Line 51: | Line 51: | ||
First, download Slax from their website: https://slax.org | First, download Slax from their website: https://slax.org | ||
| − | In this tutorial, I am using [http://ftp.sh.cvut.cz/slax/Slax-9.x/slax-64bit-9.11.0.iso version 9.11.0]. | + | In this tutorial, I am using [http://ftp.sh.cvut.cz/slax/Slax-9.x/slax-64bit-9.11.0.iso version 9.11.0] (64 bit). |
| + | |||
| + | I used VirtualBox to set up a VM for generating the custom Slax image: https://www.virtualbox.org/ | ||
| + | |||
| + | I didn't have any luck building the image when running without hardware virtualization (Intel VT-x or AMD-V) on a 32 bit version of Slax. | ||
| + | |||
| + | I created a new VM with 2G of RAM, an 8G virtual disk (dynamic expanding), and with a network connection of "Bridged". | ||
== Customization Script == | == Customization Script == | ||
Revision as of 16:45, 30 September 2019
Slax is an amazing Linux distro! This is the first time I've found a tolerable workflow for generating custom bootable Linux images, on the fly, for different purposes. Slax has all the features that I want as a base system for custom images, and it comes with scripts that make it easy to roll your changes into modules, which you can then incorporate into a new disk image. It's super fast and super easy.
Everything that I wanted:
- Debian based
- Minimal lightweight base OS
- Simple bootloader
- Fast and easy build process
Purpose of this example build:
- Lightweight utility OS for general IT work (including Windows systems)
Customizations I've made:
- Added Memtest86+ to the boot menu
- Made the OS boot to text mode by default
- Installed several recovery, diagnostic, and security packages
- Replaced the desktop wallpaper with a flat color
- Removed the startup/shutdown sound
File Downloads
| Filename | Description | Size | Modified | Link |
|---|---|---|---|---|
|
gen-slax-custom.sh |
My own script for generating a custom Slax image. | 4K | 9/30/2019 |
Procedure
First, download Slax from their website: https://slax.org
In this tutorial, I am using version 9.11.0 (64 bit).
I used VirtualBox to set up a VM for generating the custom Slax image: https://www.virtualbox.org/
I didn't have any luck building the image when running without hardware virtualization (Intel VT-x or AMD-V) on a 32 bit version of Slax.
I created a new VM with 2G of RAM, an 8G virtual disk (dynamic expanding), and with a network connection of "Bridged".
Customization Script
Custom script gen-slax-custom.sh (download here):
# ================================================================
#
# GENERATE CUSTOM SLAX BOOTABLE ISO
#
# This was created with Slax 9.11.0 (64 bit)
# Source: http://ftp.sh.cvut.cz/slax/Slax-9.x/slax-64bit-9.11.0.iso
#
# Boot up the live Slax image in a virtual environment, create a
# virtual disk that is at least 3G attached to the VM, copy this
# script onto that VM, then run this script (needs network
# connection).
#
# The /mnt directory is used for temporary build files.
#
# The final image will be located in:
# /mnt/slax-custom64-build<DATE>.iso
#
# When you boot the custom image, you can hit Tab at the
# bootloader, and there is several boot options. There is now an
# Entry for Memtest86+.
#
# When you boot into the OS, you will get a text terminal. Login
# as Username: root, Password: toor
#
# If you want a graphical desktop, run the command "startx".
#
# ================================================================
#
#
# Set the time zone
# ================================================================
dpkg-reconfigure tzdata
#
# Enable SSH Server
# ================================================================
systemctl enable ssh
#
# Install packages
# ================================================================
apt-get update
apt-get -y install binutils chntpw cifs-utils clamav curl dnsutils etherwake ffmpeg gddrescue gparted iftop john macchanger memtest86+ nmap ntfs-3g parted rar recordmydesktop rsync smbclient ssh sshfs steghide stress sudo tcpdump telnet testdisk tmux traceroute unrar vim wireshark
#
# Replace the desktop wallpaper with flat color
# ================================================================
apt-get -y install imagemagick
convert -size 1x1 xc:gray /usr/share/wallpapers/slax_wallpaper.jpg
apt-get -y purge imagemagick
apt-get autoremove
apt-get autoclean
#
# Remove startup/shutdown sound files
# ================================================================
rm /usr/share/sounds/*.wav
#
# Partition the disk and create a file system
# ================================================================
echo -e "n\np\n1\n\n\n\nw\n" | fdisk /dev/sda
mkfs -t ext4 /dev/sda1
tune2fs -m 0 /dev/sda1
#
# Mount the disk
# ================================================================
umount /dev/sda1
mount /dev/sda1 /mnt
#
# Delete the shell history
# ================================================================
echo > ~/.bash_history
history -c
#
# Save the custom module
# ================================================================
savechanges /mnt/custom.sb
#
# Generate the temp ISO
# ================================================================
genslaxiso /mnt/slax-temp.iso /mnt/custom.sb
#
# Create the temp folders for working with the ISO file
# ================================================================
mkdir /mnt/isomount
mkdir /mnt/isotemp
#
# Mount the ISO file and copy into the temp folder
# ================================================================
mount -t iso9660 -o loop /mnt/slax-temp.iso /mnt/isomount
cp -R /mnt/isomount/* /mnt/isotemp/
umount /mnt/slax-temp.iso
rm /mnt/slax-temp.iso
#
# Move memtest86+ to the boot folder and rename it (required)
# ================================================================
mv /boot/memtest86+.bin /mnt/isotemp/slax/boot/memtest86
rm /boot/memtest86+_multiboot.bin
#
# Set the text mode as the default boot option
# ================================================================
sed -i 's/perch,automount/&\ text/g' /mnt/isotemp/slax/boot/syslinux.cfg
#
# Add Memtest86+ to the boot menu
# ================================================================
echo -e "\nLABEL memtest86\nMENU LABEL Memtest86+ (Test RAM)\nKERNEL /slax/boot/memtest86" >>/mnt/isotemp/slax/boot/syslinux.cfg
#
# Generate the final ISO file
# ================================================================
cd /mnt/isotemp/
dt=$(date +%y%m%d%H%M%S)
genisoimage -o /mnt/slax-custom64-build$dt.iso -b slax/boot/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V Slax .