Gentoo Wiki


This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Add custom stages or other files to a gentoo CD iso image


This is a quick and easy way to customize a livecd to contain your preferred stages, without going through the hassle of creating a completly new filesystem. This is not what you need if you want to change the way the gentoo install/livecd works. But it is handy to store stages or other files you may need for the install.


1. Grab an iso image from, I recommend a minimal cd image for maximum free space.

2. Create some directories

Code: setup:
  $ cd /mnt/
  $ mkdir oldimage
  $ mkdir newimage

3. mount your gentoo cdrom iso image to /mnt/oldimage

Code: mounting:
  $ mount -o loop /home/user/install-x86-minimal-2006.0.iso /mnt/oldimage
Note: this requires the loop device to be active

alternative: mount a previously burned CD

3.1 troubleshooting loop setup:

enable loopback support in kernel
modprobe loop // if loop was compiled as a module
mount should handle all the dirty work for you if the kernel is setup right. 
But if you need or want to get your hands dirty use the losetup command (part of sys-apps/util-linux).
for example, to free (unmount) the first loop device: losetup -d /dev/loop/0 
to see which loop devices are in use: losetup -a

4. Extract the CD contents into a temporary directory

Code: copy:
  $ cp -a oldimage/* newimage

5. Add a directory to store things in, and fill it:

Code: add files:
  $ mkdir newimage/stages
  $ cp ~/stage4.tar.bz2 newimage/stages/

Create iso

6. Now you are ready to create a new iso image using mkisofs:

Code: Create iso image:
  $ cd newimage
  $ mkisofs -J -R -l -V "My 2006.0 livecd" -o /mnt/mycd.iso -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table ./

7. Check the resulting image to ensure it fits on your media:

ls -lh /mnt/mycd.iso 
-rw-r--r--  1 root root 134M Apr  6 03:30 /mnt/mycd.iso
Code: optional: test it with qemu:
  $ qemu -cdrom /mnt/mycd.iso -boot d -m 128

8. Burn mycd.iso to a cd using your favorite cd burning application.

9. Clean up

  $ cd /mnt
  $ umount /mnt/oldimage
  $ rm -r oldimage newimage
  $ mv mycd.iso ~/

Tip: after the livecd is booted, your stages will be in /mnt/cdrom/stages/
Retrieved from ""

Last modified: Thu, 04 Sep 2008 06:26:00 +0000 Hits: 6,371