Skip to content

Instantly share code, notes, and snippets.

@stardigits
Last active July 6, 2020 13:06
Show Gist options
  • Save stardigits/7fd5c9973d5acbc98ad1c22a53dd459c to your computer and use it in GitHub Desktop.
Save stardigits/7fd5c9973d5acbc98ad1c22a53dd459c to your computer and use it in GitHub Desktop.
How to remaster / make a custom MX Linux 19.2 image

How to remaster / make a custom MX Linux 19.2 image

Incomplete Gist, it's still being written here

Purpose

To reduce the images by removing unnecessary pacakges To Install required packages and pack it to an image which can be run the later using Live USB

Requirements

  1. Virtualbox
  2. MX Linux 19.2 ISO

Prepare virtual disk

Create new partition of virtual disk (/dev/sda) then mount it

sudo fdisk /dev/sda
n
p
1
<enter>
<enter>
w

sudo mkfs.ext4 /dev/sda1
sudo mkdir /dev/sda1
sudo mount /dev/sda1 /mnt/sda1
sudo chown -R demo:demo /mnt/sda1

Unsquash linuxfs image

cd /mnt/sda1
mkdir chroot
sudo unsquashfs -f -d chroot/ /live/boot-dev/antiX/linuxfs
#!/bin/bash
cd ~
sudo unsquashfs -f -d chroot /live/to-ram/antiX/linuxfs
sudo mount --bind /proc chroot/proc
sudo mount --bind /dev/pts chroot/dev/pts
sudo mount --bind /run/resolvconf/resolv.conf chroot/run/resolvconf/resolv.conf
# sudo mknod -m 666 chroot/dev/null c 1 3
# sudo mknod -m 666 chroot/dev/zero c 1 5
# sudo mknod -m 0644 chroot/dev/random c 1 8
# sudo mknod -m 0644 chroot/dev/urandom c 1 9
sudo chroot chroot/
# Do any things here to install or remove
# Remove cache files before exit
#!/bin/bash
# Run this script after enter chroot
# Do any things here to install or remove
# Remove cache files before exit
rm -rf /var/cache/*
rm -rf /var/lib/apt/lists
rm -rf /tmp/*
exit
sudo umount chroot/proc
sudo umount chroot/dev/pts
sudo umount chroot/run/resolvconf/resolv.conf
sudo mksquashfs chroot/ linuxfs -comp lzo -b 262144
md5sum linuxfs > linuxfs.md5
# Copy linuxfs* to boot device or make an iso file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment