Software & AppsOperating SystemLinux

How To Create a Bootable System with Squashfs Root and Fix User Account Login Issue

Ubuntu 4

In this article, we will guide you through the process of creating a bootable system with Squashfs root and how to resolve a common user account login issue. This tutorial is aimed at system administrators and individuals with a good understanding of Linux systems.

Quick Answer

How to Create a Bootable System with Squashfs Root and Fix User Account Login Issue

To create a bootable system with Squashfs root, you need to install necessary packages, create a Squashfs file, format the target drive, create folder layout and install extlinux, and create an extlinux configuration file. To fix user account login issues, you may need to check the casper scripts, initrd, /usr/share, and libs for any changes or issues. However, it is not possible to provide a quick answer for this complex topic.

Introduction

Squashfs is a compressed read-only filesystem for Linux. It is used to compress and bundle software packages for Linux distributions. A bootable system with a Squashfs root allows you to boot into a Linux system with a compressed filesystem, which can be beneficial for systems with limited disk space.

Prerequisites

Before we start, make sure you have the following:

  • A running Ubuntu system
  • A target drive for the bootable system
  • Basic knowledge of Linux command line

Step 1: Install Necessary Packages

Firstly, we need to install the necessary packages. Open your terminal and run the following commands:

sudo apt-get install live-boot live-boot-initramfs-tools extlinux
sudo update-initramfs -u

The apt-get install command installs the listed packages. live-boot and live-boot-initramfs-tools are necessary for creating a bootable system, while extlinux is a modern, simple boot loader.

The update-initramfs -u command updates the initial ram filesystem. The -u flag stands for update.

Step 2: Create a Squashfs File

Next, we need to create a Squashfs file from a bootstrapped or running Ubuntu filesystem with the desired packages. You can refer to the instructions provided in the link: LiveCDCustomizationFromScratch.

Step 3: Format the Target Drive

Now, format the target drive with ext2/3/4 and enable the bootable flag. This can be done using a tool like gparted.

Step 4: Create Folder Layout and Install Extlinux

After the drive is formatted, we need to create the necessary folder layout on the target drive and install extlinux:

mkdir -p ${TARGET}/boot/extlinux ${TARGET}/live
extlinux -i ${TARGET}/boot/extlinux
dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdX # Replace X with the drive letter
cp /boot/vmlinuz-$(uname -r) ${TARGET}/boot/vmlinuz
cp /boot/initrd.img-$(uname -r) ${TARGET}/boot/initrd
cp filesystem.squashfs ${TARGET}/live

The mkdir -p command creates the necessary directories. The -p flag creates parent directories as needed.

The extlinux -i command installs the extlinux bootloader to the specified directory.

The dd command copies the master boot record (MBR) to the target drive.

The cp commands copy the necessary files to the target drive. The vmlinuz and initrd.img files are the compressed Linux kernel and the initial ramdisk, respectively.

Step 5: Create Extlinux Configuration File

Finally, we need to create the extlinux configuration file ${TARGET}/boot/extlinux/extlinux.conf with the following contents:

DEFAULT Live
LABEL Live
 KERNEL /boot/vmlinuz
 APPEND initrd=/boot/initrd boot=live toram=filesystem.squashfs
TIMEOUT 10
PROMPT 0

This configuration file sets the default boot option, specifies the kernel and initial ramdisk, and sets boot parameters.

Fixing User Account Login Issue

In case you encounter issues with user accounts not working after the second boot, it is suggested to check the casper scripts, initrd, /usr/share, and libs for any changes or issues. However, in the given context, the user mentioned that they were able to resolve the issue by using the live-boot and live-boot-initramfs-tools packages to generate an initrd and extlinux for the bootloader.

By following these steps, you should be able to create a bootable system with a Squashfs root and resolve any user account login issues. If you have any questions or run into any issues, feel free to leave a comment below.

What is a Squashfs root?

A Squashfs root is a compressed read-only filesystem for Linux that allows you to boot into a Linux system with a compressed filesystem, which can be beneficial for systems with limited disk space.

What are the prerequisites for creating a bootable system with Squashfs root?

The prerequisites for creating a bootable system with Squashfs root are a running Ubuntu system, a target drive for the bootable system, and basic knowledge of Linux command line.

How do I install the necessary packages for creating a bootable system?

You can install the necessary packages by running the following commands in the terminal:

sudo apt-get install live-boot live-boot-initramfs-tools extlinux
sudo update-initramfs -u
How do I create a Squashfs file?

To create a Squashfs file, you can refer to the instructions provided in the link: LiveCDCustomizationFromScratch.

How do I format the target drive?

You can format the target drive with ext2/3/4 and enable the bootable flag using a tool like gparted.

How do I create the necessary folder layout and install extlinux?

After formatting the target drive, you can create the necessary folder layout and install extlinux by running the following commands in the terminal:

mkdir -p ${TARGET}/boot/extlinux ${TARGET}/live
extlinux -i ${TARGET}/boot/extlinux
dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdX # Replace X with the drive letter
cp /boot/vmlinuz-$(uname -r) ${TARGET}/boot/vmlinuz
cp /boot/initrd.img-$(uname -r) ${TARGET}/boot/initrd
cp filesystem.squashfs ${TARGET}/live
How do I create the extlinux configuration file?

To create the extlinux configuration file, you need to create a file named ${TARGET}/boot/extlinux/extlinux.conf with the following contents:

DEFAULT Live
LABEL Live
 KERNEL /boot/vmlinuz
 APPEND initrd=/boot/initrd boot=live toram=filesystem.squashfs
TIMEOUT 10
PROMPT 0
How can I fix user account login issues?

If you encounter user account login issues after the second boot, it is suggested to check the casper scripts, initrd, /usr/share, and libs for any changes or issues.

Leave a Comment

Your email address will not be published. Required fields are marked *