paazmaya.fi

The Website of Juga Paazmaya | Stories about web development, hardware prototyping, and education

Using Finnix Linux from USB stick in 2025 with customization

How to use the Finnix Linux distribution from a USB stick for troubleshooting and system recovery. Default settings and squashfs details included.

In 2025, using a Linux distribution from a USB stick remains one of the most effective ways to troubleshoot, recover, or repurpose a computer. This post builds on my earlier experience with live Linux environments on a USB stick, this time focusing on the Finnix distribution.

The purpose of setting certain values as defaults is to reduce boot time and improve the initial user experience. These settings typically relate to locale, keyboard layout, and timezone preferences.

Why Finnix?

Finnix is a small, self-contained live Linux distribution designed for system administrators. It boots quickly from USB, and is packed with tools for:

  • Filesystem repair
  • Partitioning
  • Data recovery
  • Network diagnostics
  • Hardware testing

Finnix is based on Debian and is well-suited for both old and new hardware. Its minimal footprint and focus on command-line tools make it ideal for advanced troubleshooting.

Flashing the USB stick

Follow these steps to write the Finnix image to a USB stick. Ensure the USB stick has at least 1 GB of free space.

The following steps focus on Linux bash usage, but it’s possible to do the writing with Rufus (Windows ISO writing tool).

  1. Download the latest Finnix ISO file from the official finnix.org site. At the time of writing, the file was finnix-250.iso
  2. Before inserting the USB stick into your computer, run lsblk to see the current block devices
  3. Insert the USB stick and run lsblk again to identify the new block device (for example “sda”)
  4. Write the ISO to the USB stick using: dd if=finnix-250.iso of=/dev/sda bs=4M status=progress. You may need to add sudo if elevated permissions are required
  5. Ensure all data is written to disk by running sync
  6. Run lsblk again to verify two new partitions appear (for example “sda1” and “sda2”). Note that they may not be mounted

The newly flashed partitions need to be mounted before they can be adjusted further.

mkdir finnix-sda1
sudo mount /dev/sda1 ./finnix-sda1

Configure the Kernel via grub

Edit the boot configuration:

sudo nano finnix-sda1/boot/grub/grub.cfg

Modify the first boot option (called a menuentry) by adding kernel parameters at the end of the line starting with linux. Add: keyboard=fi locale=fi_FI.UTF-8 timezone=Europe/Helsinki

The whole entry now looks like:

menuentry "Live system (amd64)" --hotkey=l {
  linux   /live/vmlinuz-6.12.17-amd64 quiet findiso=${iso_path} keyboard=fi locale=fi_FI.UTF-8 timezone=Europe/Helsinki
  initrd  /live/initrd.img-6.12.17-amd64
}

Unmount the partition so that the USB stick can be removed:

sudo umount finnix-sda1

For reference, the GRUB Manual: Configuration.

Booting with kernel parameters

After testing on another machine, the kernel parameters had no effect on the boot process.

How about trying to configure them in the filesystem?

Extracting files from SquashFS

The files that we need to edit are within ./finnix-sda1/live/filesystem.squashfs file, which in this version is 445 MB.

As background, Finnix uses SquashFS to compress its root filesystem, as do many live Linux distributions. SquashFS is a read-only, highly compressed filesystem that allows an entire OS to fit into a small ISO image while maintaining fast file access.

To list the files inside a SquashFS image, use: unsquashfs -l ./finnix-sda1/live/filesystem.squashfs

The squashfs-tools package is required for these operations. Install it with: sudo apt install squashfs-tools. The source code is available at GitHub: squashfs-tools.

Mount the USB stick again:

sudo mount /dev/sda1 ./finnix-sda1

Getting some statistics about the file system with unsquashfs -s ./finnix-sda1/live/filesystem.squashfs:

Found a valid SQUASHFS 4:0 superblock on ./finnix-sda1/live/filesystem.squashfs.
Creation or last append time Thu Mar 13 09:36:21 2025
Filesystem size 466355668 bytes (455425.46 Kbytes / 444.75 Mbytes)
Compression xz
        Dictionary size 131072
        Filters selected: x86
Block size 131072
Filesystem is exportable via NFS
Inodes are compressed
Data is compressed
Uids/Gids (Id table) are compressed
Fragments are compressed
Tailends are not packed into fragments
Xattrs are compressed
Duplicates are removed
Number of fragments 3342
Number of inodes 38381
Number of ids 23
Number of xattr ids 1

That revealed one important thing to remember later, the xz compression.

In order to edit the files inside the file system, they need to be extracted first:

sudo unsquashfs -d finnix-fs finnix-sda1/live/filesystem.squashfs

This creates a finnix-fs directory with all contents. Elevated privileges are needed to be able to read certain files within the file system.

The exact output was:

Parallel unsquashfs: Using 6 processors
34570 inodes (38186 blocks) to write

[==================================================================================|] 72756/72756 100%

created 31352 files
created 3837 directories
created 3183 symlinks
created 9 devices
created 0 fifos
created 0 sockets
created 26 hardlinks

Configuration for personal preferences

sudo nano finnix-fs/etc/default/keyboard

Changing XKBLAYOUT="us" to XKBLAYOUT="fi".

sudo nano finnix-fs/etc/timezone

Changing Etc/UTC to Europe/Helsinki.

sudo nano finnix-fs/etc/locale.conf

Changing LANG=en_US.UTF-8 to LANG=en_GB.UTF-8.

Then add a boot step by creating a file /etc/rc.local, which can also apply the above changes:

sudo nano finnix-fs/etc/rc.local

The contents:

#!/bin/bash
# Generate British locale
echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen

# Set keyboard layout
setupcon -k --force --save-only fi
loadkeys fi

# Set locale environment
echo "LANG=en_GB.UTF-8" > /etc/default/locale

# Set the timezone
echo "Europe/Helsinki" > /etc/timezone

Writing the files back to SquashFS

Remember the compression type from earlier? It was xz. Are there other parameters that might be needed?

Finnix build process is according to the official release procedure, using the following parameters:

sudo mksquashfs finnix-fs filesystem.squashfs -comp xz -Xdict-size 100% -e boot
  • -comp xz uses xz compression for maximum space savings.
  • -Xdict-size 100% sets the dictionary size to the maximum allowed.
  • -e boot excludes the boot directory from the image.

This created a file filesystem.squashfs with the size 452 MB.

Move it to the right place while overwriting the earlier version of it:

sudo mv filesystem.squashfs finnix-sda1/live/

The file size changed from 445 MB to 452 MB. Running unsquashfs -s ./finnix-sda1/live/filesystem.squashfs again:

Found a valid SQUASHFS 4:0 superblock on ./finnix-sda1/live/filesystem.squashfs.
Creation or last append time Fri Oct 24 17:32:35 2025
Filesystem size 473379779 bytes (462284.94 Kbytes / 451.45 Mbytes)
Compression xz
Block size 131072
Filesystem is exportable via NFS
Inodes are compressed
Data is compressed
Uids/Gids (Id table) are compressed
Fragments are compressed
Tailends are not packed into fragments
Xattrs are compressed
Duplicates are removed
Number of fragments 3337
Number of inodes 38381
Number of ids 23
Number of xattr ids 1

The number of fragments changed from 3342 to 3337, a minor difference that should not affect functionality.

Remove the USB stick after unmounting it:

sudo umount finnix-sda1

Booting with default files configured

Testing the customized USB stick on another computer showed that the configuration changes had no visible effect on the boot sequence or system behavior.

Well then, what is next? Perhaps a proper systemd service…

Using systemd for Persistent Configuration

Since kernel parameters and boot options had limited effect, a more reliable approach might be to use systemd services to apply configuration changes after the system boots.

The format of systemd-boot entry is documented here.

Mount the USB stick again:

sudo mount /dev/sda1 ./finnix-sda1

First, create a service definition file at /etc/systemd/system/finland.service:

sudo nano finnix-fs/etc/systemd/system/finland.service

The contents should become:

[Unit]
Description=Configure Finnish keyboard and locale
DefaultDependencies=no
After=systemd-remount-fs.service
Before=systemd-vconsole-setup.service getty.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/local/bin/setup-finland.sh
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=sysinit.target

Next, create the setup script at /usr/local/bin/setup-finland.sh that the service will execute:

sudo nano finnix-fs/usr/local/bin/setup-finland.sh

Use the contents:

#!/bin/bash
set -e

# Generate British locale if not present
if ! grep -q "^en_GB.UTF-8" /etc/locale.gen; then
    echo "en_GB.UTF-8 UTF-8" >> /etc/locale.gen
    locale-gen
fi

# Set keyboard layout
loadkeys fi 2>/dev/null || true
setupcon -k --force --save fi 2>/dev/null || true

# Set locale
echo "LANG=en_GB.UTF-8" > /etc/default/locale

# Set the timezone
echo "Europe/Helsinki" > /etc/timezone

exit 0

This script needs to be executable:

sudo chmod +x finnix-fs/usr/local/bin/setup-finland.sh

Finally, create a symbolic link to enable the service at boot time:

sudo ln -sf finnix-fs/etc/systemd/system/finland.service \
  finnix-fs/etc/systemd/system/sysinit.target.wants/finland.service

Unmount the partition again:

sudo umount finnix-sda1

Now testing proved that the systemd approach proved to be the working solution. Finally!

If you’ve followed along, you’ve seen the iterative approach to finding a solution. Through trial and error, systemd services proved to be the most reliable method for persistent configuration in Finnix.

Was it worth it?

That depends on how often this USB stick is used, in compariso how much work is to add files in the SquashFS that needs to be extracted and put back together again.