Install custom packages to an Ubuntu ISO using Ubuntu 14.04 or higher with

I released a shell script borne from my attempts to remaster Ubuntu 14.04. Tested in VirtualBox! You must have root and an ISO to remaster.

Get it here:

The command is used like so:

./ original_official_iso.iso new_custom_iso_name.iso

First, it will attempt to update your system and install squashfs-tools.

Then, you will be dropped down into a terminal prompt inside of the ISO where you can use apt-get to install whatever you want.

Just type “exit” when you are done, and it will continue to write your changes into your new iso file.

At some point, you’ll be entered into nano where you can optionally change the DISKNAME which appears when the USB device is plugged in, for example.

When you’re done, use sudo to remove the livecdtmp/ directory. “Good” build and running XUbuntu

Earlier this month, I bought the parts to the “Good” build from

Motherboard: Gigabyte GA-F2A88X-D3H

APU: Athlon X4 860K 64 bit 3.7 GHz FM2+ chipset

Gfx: Asus Radeon R9 270X 2 GB GDDR5

RAM: Crucial Ballistic Tactical 4 GB DDR3-1866

SSD: Samsung 120 GB SSD

All in all the total came out to about $650 since I wasn’t willing to sign up for multiple random websites with my payment info..

The computer was pretty simple to put together. Took me a few hours. I was up and running within the same day.

The AMD Athlon processor comes with heat sink paste already applied, so you don’t need a tube of arctic silver. The Corsair 200R case came with all the necessary screws. There’s one stand-off toward the “top right” of the board (if it was standing up and facing the I/O shield like it would be installed).

Curiously this case has the power supply on the bottom of the machine. The BIOS/UEFI on the GA-F2A88X-D3H is very nice. It has lots of features. The “help” messages in the BIOS itself are a little mangled for English speakers, but it’s mostly self-explanatory.

This computer is pretty nice, but there is definitely room for improvement.

I installed Ubuntu 15.04 on this, then I went back and installed XUbuntu 14.04.

Everything seems to work out of the box. I played some Elder Scrolls Oblivion and CS: GO.

Oblivion worked well in Ubuntu 15.04 and XUbuntu 14.04 on high settings with high resolution.

In Ubuntu 15.04, I could get ~100 FPS in Counter-Strike: Global Offensive without VSync, 1600×1200 resolution, mostly high settings, low quality shaders. The FPS would rubber band when the scoreboard was displayed (“tab key” in game).

In XUbuntu 14.04, I needed to lower my resolution. This might be due to some kind of driver issues. I seem to get around ~60 FPS.

This computer seems to have no problem emulating virtual machines as well.

One issue with this motherboard is that the lm-sensors package won’t really detect the sensors properly for some reason.

The stock fans on this computer are quite loud. Also, the ballistix RAM lights up, which is an interesting feature that makes a nice backlight under my desk when the computer is running.

Ubuntu 15.04 Remastering Custom ISO for Live USB

UPDATE: The script in this blog post is out of date. I created a new github repo for a shell script called which should help you remaster Ubuntu on Ubuntu. Go here to learn more:

These steps produce a ‘No-Op’ ISO. It appears to work for me in VirtualBox.

Original source:

Next, I’ll perform some actual customizations.

Step 1:
# Make a parent directory for our Live USB
mkdir ~/livecdtmp
mv ubuntu-*.iso ~/livecdtmp
cd ~/livecdtmp

Step 2:
mkdir mnt
sudo su
# Mount the ISO as a loop filesystem to ~/livecdtmp/mnt
# This will allow us to look at its insides, basically
mount -o loop ubuntu-*.iso mnt
mkdir extract-cd
# Copy all the ISO’s innards except for filesystem.squashfs to extract-cd/
rsync –exclude=/casper/filesystem.squashfs -a mnt/ extract-cd
# Expand the squashed filesystem and put it into ~/livecdtmp/edit so we can update the squashed filesystem with our new values it needs to boot and install properly
unsquashfs mnt/casper/filesystem.squashfs
mv squashfs-root edit

Step 3:
mount -o bind /run edit/run
# This makes our terminal’s “perspective” come from ~/livecdtmp/edit/
chroot edit
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

export HOME=/root
export LC_ALL=C

Step 4:
# Normally this is where you’d do your customizations.
# I recommend copying from your main system’s /etc/apt/sources.list to your ISO’s sources.list.

Step 5:
# Back out of the chroot
umount /proc || umount -lf /proc
umount /sys
umount /dev/pts
umount /run
# exiting out of the chroot
umount edit/dev

Step 6:
chmod +w extract-cd/casper/filesystem.manifest
chroot edit dpkg-query -W –showformat=’${Package} ${Version}n’ > extract-cd/casper/filesystem.manifest
cp extract-cd/casper/filesystem.manifest extract-cd/casper/filesystem.manifest-desktop
sed -i ‘/ubiquity/d’ extract-cd/casper/filesystem.manifest-desktop
sed -i ‘/casper/d’ extract-cd/casper/filesystem.manifest-desktop
rm extract-cd/casper/filesystem.squashfs
mksquashfs edit extract-cd/casper/filesystem.squashfs
printf $(sudo du -sx –block-size=1 edit | cut -f1) > extract-cd/casper/filesystem.size
nano extract-cd/README.diskdefines
cd extract-cd
rm md5sum.txt
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/ | sudo tee md5sum.txt
IMAGE_NAME=’Whatever name you want’
sudo mkisofs -D -r -V “$IMAGE_NAME” -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -o ../my-custom-ubuntu.iso .
chmod 775 ../my-custom-ubuntu.iso

Remastering an Ubuntu Live CD Manually

UPDATE: I now have a script to help you remaster Ubuntu ISOs like a pro:

I’m building an Ubuntu Live CD for WES (my Webcam Security System software). I tried out the Ubuntu Creation Kit. It didn’t work, and it hasn’t been updated in a long time. So, like any right-thinking person, I wanted to take matters into my own hands.

This is a walkthrough on how to remaster an Ubuntu Live CD, which should transfer to just about any Linux. We’ll be going through the guide at except I’ll be talking about why exactly we run each command as we go along.

First, download the ISO. That’s obvious right?

Then you have to have enough space available for the ISO, the unpacked ISO and whatever packages you’re installing. Just assume 5+ GB will be spent. Right now my ~/livecdtmp folder is 4.3 GB according to `du -hs ~/livecdtmp`.

I wanted to get my command-line installation right, so I also installed a VM under VirtualBox. This was a bit of a pain, mostly because my old fashioned computer struggles to keep up. I went through the entire Ubuntu 15.04 installation process, a basic generic install. I saved the state. I installed VirtualBox Guest Additions and setup a shared folder between my host machine and the VM.

Second, I formulated a list of requirements for this Live USB to make sure I stay on target throughout the process.

  • Must have “motion” installed.
  • Must run WES on start up.
  • Must have access to a webcam.
  • Must have access to the internet.
  • Must be able to email from a local account.
  • Must have a locked screen.
  • Must have updates disabled.
  • Should have exfat-fuse and anything needed for NTFS.
  • Should have no access to “shutdown” from the user interface.
  • Should have some persistence enabled (mainly for the config and images/video).
  • Should prune images/video.
  • Could have a configurable password.
  • Could have some custom screensaver and background image.
  • Could have XFCE as the window manager.
  • Could have tmux/vim/emacs installed and ready to use.
  • Want to have Dropbox access for remote storage/syncing of video/images/etc..
  • Want to have GPG encrypted configs, video, images, etc.

Third, I began informally recording my installation process.

My first run at it has failed. The ISO failed to boot, presenting a black screen and no other activity. For some reason, the Live CD customization instructions on the ubuntu site appear to be out of date for this distribution. I’ll attempt to do a No-Op (do nothing) remastering to the ISO to see if I can get it to work at all in the next post.