如何使用 squashfs 根创建可引导系统

cld*_*fzn 6 live-usb boot grub2 kernel squashfs

我的目标是能够采用加载了我想要的软件的自定义根文件系统。到目前为止,我已经使用 debootstrap 和 chroot 创建了一个压缩的文件系统,以在系统上安装我想要的软件。

我现在遇到的问题……每当我启动到系统时,我在 chroot 中设置的用户帐户都不起作用。第一次启动一切正常,第二次启动我无法登录。这让我很困惑。

有人知道开始寻找的原因或地点吗?

cld*_*fzn 8

要获得带有 squashfs 文件系统的工作系统:

sudo apt-get install live-boot live-boot-initramfs-tools extlinux
sudo update-initramfs -u
Run Code Online (Sandbox Code Playgroud)

从引导或运行的 ubuntu 文件系统创建一个 squashfs 文件,其中包含您想要的任何可用包。 https://help.ubuntu.com/community/LiveCDCustomizationFromScratch提供了很好的说明,用于创建要在其上构建的 debootstrapped 系统。使用 ext2/3/4 格式化目标驱动器并启用可引导标志。在目标驱动器上创建文件夹布局并安装 extlinux:

mkdir -p ${TARGET}/boot/extlinux ${TARGET}/live
extlinux -i ${TARGET}/boot/extlinux
dd if=/usr/lib/syslinux/mbr.bin of=/dev/sdX #X is 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
Run Code Online (Sandbox Code Playgroud)

使用以下内容创建 ${TARGET}/boot/extlinux/extlinux.conf:

DEFAULT Live
LABEL Live
  KERNEL /boot/vmlinuz
  APPEND initrd=/boot/initrd boot=live toram=filesystem.squashfs
TIMEOUT 10
PROMPT 0
Run Code Online (Sandbox Code Playgroud)

现在您应该能够从目标驱动器启动到您的压缩系统。