220

I would like to customize Ubuntu live CD by installing some additional packages. I have followed the Ubuntu help wiki guide but it doesn't seem to work. Can anyone provide clear instructions?

I'm not keen to use Remastersys; I'd prefer a manual way.

Customization

Packages that I want to install:

  • Thunderbird
  • Samba
  • SSH

Changes that I need:

  • Remove Games menu from the Application menu
  • Firefox shortcut on Desktop
  • Radiance as the default Theme
  • Different default Ubuntu Wallpaper

Configuration file changes

  • I want the panel to be placed at the bottom
  • I want to paste my Samba configuration file instead of default Samba configuration
  • I have few Firefox shortcuts and folders I would like to show that in Desktop
  • Also it will be nice if you say me how to change the icon sets

Recent Updates

  • I have customized Ubuntu 10.10 with Firefox shortcuts and few folders on desktops. Everything went smooth. But the installer gets crashes after choosing the timezone. How do i fix this issue?
  • Also setting wallpaper affects the login screen. The wallpaper which I set is displayed on the login screen also. I just want the default one for the login screen.
2
  • Related: askubuntu.com/q/83617/62483
    – Lucio
    Feb 8, 2016 at 2:34
  • 1
    I’m voting to close this question because it is about an End of Standard Support or End of Life Release. This question was written concerning 11.04. Most of the answers use outdated, obsolete, unsupported apps with broken links, such as Remastersys. None of the answers with high reputation are of any use to a user in the modern world. It may be a good history lesson but that is not users are looking for. May 15, 2021 at 2:52

17 Answers 17

123
+500

Creating your own Custom Live CD - the manual way.

1. Preparations

  • First you download the Live CD ISO. While it is downloading install some software that is needed for rebuilding: sudo apt-get install squashfs-tools schroot

    Squashfs Install squashfs-tools is a compressed read-only filesystem for Linux.

    schroot Install schroot allows users to execute commands or interactive shells in different chroots.

  • Mount the Live CD:

    mkdir /tmp/livecd
    sudo mount -o loop ~/Downloads/ubuntu-11.04-desktop-i386.iso /tmp/livecd
    

    If you use another ISO or another location for your download please adjust accordingly.

  • Create a working area and copy contents over to the working area:

    mkdir -p ~/livecd/cd
    rsync --exclude=/casper/filesystem.squashfs -a /tmp/livecd/ ~/livecd/cd
    mkdir ~/livecd/squashfs  ~/livecd/custom
    sudo modprobe squashfs
    sudo mount -t squashfs -o loop /tmp/livecd/casper/filesystem.squashfs ~/livecd/squashfs/
    sudo cp -a ~/livecd/squashfs/* ~/livecd/custom
    
  • If you get an error like this while doing modprobe:

    sudo modprobe squashfs 
    WARNING: Deprecated config file /etc/modprobe.conf, 
    all config files belong into /etc/modprobe.d/
    

    move the modprobe.conf mv /etc/modprobe.conf /etc/modprobe.conf.OLD and try again!

  • Network access:

    sudo cp /etc/resolv.conf /etc/hosts ~/livecd/custom/etc/
    
  • Create a pseudo filesystem:

    sudo chroot ~/livecd/custom /bin/bash -l
    mount -t proc none /proc/
    mount -t sysfs none /sys/
    

2. Customizing

  • You can get a list of all packages with dpkg-query -W --showformat='${Package}\n' | less

  • You can remove games with apt-get remove --purge gnome-games

  • Update your sources withsudoedit /etc/apt/sources.list. Comment out lines you do not want and uncomment the ones you do want, add in PPAs if you want and then you need to update with apt-get update && apt-get dist-upgrade

  • Adding packages like thunderbird, Samba, Samba system config and SSH is done the same way as you would normally install from command line. So sudo apt-get install thunderbird samba system-config-samba ssh will add those.

  • If you've manually downloaded the package from you can install it with sudo dpkg -i {file_name}.deb

    • You can check Ubuntu Software Center, Synaptic or the packages website for the names if more need to be installed.
    • You might consider adding (wireless) network utilities.
    • You will quickly run over 800 Mb; if you do you either remove more packages to get under 800 or you need to use a DVD when burning. Removing libre office will free up you 33+ Mb if you do not need it.
  • To create an AskUbuntu shortcut on the desktop:

    mkdir -p /etc/skel/Desktop && printf '[Desktop Entry]\nVersion=1.0\nName=Ask Ubuntu\nComment=Ask Questions About Ubuntu\nGenericName=Question and Answers\nExec=xdg-open http://askubuntu.com\nTerminal=false\nX-MultipleArgs=false\nType=Application\nIcon=firefox\nCategories=Internet;\n' > /etc/skel/Desktop/askubuntu.desktop && chmod a+x /etc/skel/Desktop/askubuntu.desktop
    

    You can add more of these (skip the mkdir part) by editing the URL to something else. Courtesy of dv3500ea

  • Changing settings inside gconf-editor.

    You can change any gconf option if you know what the path is of that option and the value you want it to be (and the type of the value of course).

    enter image description here

    Changing the wallpaper is done with the path I pointed arrows to: /desktop/gnome/background/, it is a string value and it uses picture_filename as an option. The value it currently holds on my desktop is /discworld2/Downloads/fantasticwall_2.jpg. The background itself should be copied into /usr/share/backgrounds/. Make sure to set permissions and owner.

    Examples:

    • To change the wallpaper (change the filename in the 1st command to your own image) to this image and to change the theme to Radiance you can use this information to create commands to set this for your live cd:

      gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --set -t string /desktop/gnome/background/picture_filename  /discworld2/Downloads/fantasticwall_2.jpg
      
      gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --set -t string /desktop/gnome/interface/gtk_theme Radiance
      

      Courtesy of dv3500ea

    • Enable remote desktop:

      gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --set -t bool /desktop/gnome/remote_access/enabled true
      

      Settings for icons, panels etc are all done by adding a command like this.

    • Alternatively you can edit /etc/gconf/gconf.xml.defaults/%gconf-tree.xml (or when you are down save this file for future usage). All the configuration settings done through gconftool-2 are stored in this file.

  • Change the default timezone used by the live cd

    dpkg-reconfigure tzdata
    
  • Change locale setting to english (of course change it to what you want)

    locale-gen en
    update-locale LANG=en LANGUAGE=en LC_ALL=en
    
  • Configure configuration files.

    If you want to have a custom configuration file for a certain package you can do this in several ways.

    The difficult (but most logical) way would be to either find the package, change the configuration file and repackage it or to find the source files, figure out where they store their dummy config file and change that and then rebuild the package.

    • Of course this only works if the default configuration file is included in the source package. Many packages auto-generate their config files in the {packagename}.postinst script so it would make it rather difficult to get this done.

      The easiest way would be to create a script and copy your current config to /etc/skel so they get added to your desktop (similar to adding firefox shortcuts as explained above) and after installing click the desktop link to set the config file to the place it needs to be. The script could both do the copying and removal of both the script and config file from your desktop after it succesfully installed. This method can be used to update the Samba configuration (put your current config in /etc/skel/. Put a script in there that has execute permissions and contains a move of said config to /etc/samba/smbd.conf and all you need to do afterwards is execute the script).

    • This basically always works since it replaces a post-install manual action with a post-install manually activated script. But it also means it is not part of the custom live cd.

3. Cleaning up

apt-get clean
rm -rf /tmp/*
rm -f /etc/hosts /etc/resolv.conf
umount /proc/
umount /sys/
exit

This removes all the temporary files; not what we created. ~/livecd/ is readonly so a normal rm will not remove these files. You need to mount it with write access (or as I did use the new live cd to boot and mount the home and rm it from there.

4. Setting up the ISO

  • Manifest files.

    chmod +w ~/livecd/cd/casper/filesystem.manifest
    sudo chroot ~/livecd/custom dpkg-query -W --showformat='${Package} ${Version}\n' > ~/livecd/cd/casper/filesystem.manifest
    sudo cp ~/livecd/cd/casper/filesystem.manifest ~/livecd/cd/casper/filesystem.manifest-desktop
    
  • Regenerate squashfs file.

    sudo mksquashfs ~/livecd/custom ~/livecd/cd/casper/filesystem.squashfs
    
  • Update md5 sums.

    sudo rm ~/livecd/cd/md5sum.txt
    sudo bash -c 'cd ~/livecd/cd && find . -type f -exec md5sum {} +' > md5sum.txt
    

5. Creating the ISO.

cd ~/livecd/cd
sudo mkisofs -r -V "Ubuntu-Live" -b isolinux/isolinux.bin -c isolinux/boot.cat -cache-inodes -J -l -no-emul-boot -boot-load-size 4 -boot-info-table -o ~/Downloads/ubuntu-11.04-desktop-i386.iso .

6. Unmount & Clean

sudo umount ~/livecd/squashfs/
sudo umount /tmp/livecd
sudo rm -fr ~/livecd/

7. Comments:

  • Everything was tested with an Ubuntu 11.04 Live CD. Only thing that went wrong was chrooting: I added dchroot to the files you need to install to do this.

  • Regarding "should create some firefox shortcuts on desktop", "Should change the default theme to radiance" and "Should change the default ubuntu wallpaper". I edited these in after dv3500ea put it into the comments; I did not test this while creating the 11.04 live cd.

19
  • Will apt-get update && apt-get dist-upgrade also upgrade the kernel/initrd used on the Live CD? I mean the kernel for the boot process form the live medium, loaded by Syslinux, not the one installed.
    – gertvdijk
    Jan 29, 2013 at 22:24
  • apt-get dist-upgrade works without a flaw, except for some warning: could not determine root device from /etc/fstab messages. Is it supposed to become a problem? Mar 3, 2015 at 21:58
  • No. But to be sure have a look at yours and see how / is mounted.
    – Rinzwind
    Mar 4, 2015 at 7:35
  • 1
    According to help.ubuntu.com in 12.04 and 14.04 the /etc/resolv.conf may not be removed as a part of the cleanup
    – sourav c.
    Mar 8, 2015 at 5:13
  • 2
    This method still works: Tested with Kubuntu 18.04.2. note: that I could only make the .ISO bootable using unetbootin (etcher did not work). No problems booting when burning .ISO to a DVD.
    – Nmath
    Jun 2, 2019 at 6:27
116
+500

For recent versions of Ubuntu, follow this answer.

Note: The Ubuntu Builder project has been discontinued.

##Creating a custom 12.04 CD with Gnome-Classic using Ubuntu-Builder (for now, this is specific to Karthik's needs; I will update answer later with more general/Unity-specific stuff)

###1. Get Ubuntu Builder and your source ISO

Ubuntu Builder automates many of the preliminary steps that had to be done by hand (mount ISO, extract squashfs, create chroot, etc.) It gives you Synaptic and a "graphical" chroot as well (Unity UI).

Add the PPA to install Ubuntu Builder:

sudo add-apt-repository ppa:kamilion/ubuntu-builder
sudo apt-get update
sudo apt-get install ubuntu-builder

Also download the Ubuntu Desktop ISO you're planning to work with.

###2. Ubuntu Builder Basics

  • Start Ubuntu Builder from the Launcher. I recommend you set all three fields to "Ubuntu" (like the actual LiveCD), because setting custom fields led to Software Center crashing. When you install, you can choose your own username, machine name, etc. as always.

    enter image description here

  • Load your ISO; I loaded the 64-bit with the Local Disk option, although Ubuntu Builder should be able to download the ISO if you want it to.

  • The buttons on the right are self-explanatory. Console gives you a CLI chroot, while Desktop gives you a graphical one!, i.e. a LiveCD session itself (this one may take a while to load). Note that the Select DE/WM does an incomplete job sometimes, so it's better to install via apt-get/Synaptic.

###3. Updating, adding Gnome Classic and other package management

Note: All this can also be done from Synaptic if you are more comfortable with that.

  • You can edit the sources.list with the button (or via the console) to add your own mirrors, ppas, etc.

Let's start with:

  • Remove the games
    apt-get remove --purge aisleriot gnome-games-data gnomine mahjongg -y
  • Do a general update and dist-upgrade to the latest stuff (optional, but recommended since the Gnome-classic and other packages you add will be the latest versions) -- on 12.04, this step also installs Thunderbird and the core Samba components. It will also save time on the actual install.
    apt-get update && apt-get dist-upgrade
  • Install Gnome Classic (gnome-shell to pull in indicators, etc.), Samba and SSH:
    apt-get install gnome-shell samba ssh

###4. Customization 1: Files, configs and removing the top-panel

Note: All commands must be run from the chrooted console of Ubuntu Builder unless otherwise noted (usually when copying files from your own system). The absolute path of the chroot is /home/ubuntu-builder/FileSystem

  1. Replace Samba configuration file (from your own system terminal, i.e. outside chroot!)
sudo cp /path/to/mysmb.conf /home/ubuntu-builder/FileSystem/etc/samba/smb.conf
  1. Put Firefox shortcut on desktop:
mkdir -p /etc/skel/Desktop && cd /etc/skel/Desktop
cp /usr/share/applications/firefox.desktop .
chmod +x firefox.desktop
  1. Copy custom shortcuts and folders to Desktop (from outside chroot!)

    sudo cp -r /path/to/mydesktopitems/ /home/ubuntu-builder/FileSystem/etc/skel/Desktop/
  2. Set gnome-classic as the default shell:

/usr/lib/lightdm/lightdm-set-defaults -s gnome-classic
  1. Remove the top Gnome-Classic panel and move top-items to the bottom-panel:
  • Open the default panel layout:
    nano /usr/share/gnome-panel/panel-default-layout.layout
  • Delete the top-panel, by removing lines 1-4:
    [Toplevel top-panel]
    

expand=true orientation=top size=24

  • Move the Start Menu to the bottom left by modifying the bolded value for the italicized parameter as below:

[Object menu-bar] object-iid=PanelInternalFactory::MenuBar toplevel-id=bottom-panel pack-index=0

  • Move the indicators to the bottom right, just to the left of the Workspace Switcher, by modifying the bolded value for the italicized parameters as below:

[Object indicators] object-iid=IndicatorAppletCompleteFactory::IndicatorAppletComplete toplevel-id=bottom-panel pack-type=end pack-index=1

  • Remove the "Show Desktop" button from the bottom left; I prefer the Start Menu to be the first thing there, you can leave it or move it to the bottom right, etc. Delete these lines:

[Object show-desktop] object-iid=WnckletFactory::ShowDesktopApplet toplevel-id=bottom-panel pack-index=0

  • Save and exit.

###5. Customization 2: Backgrounds and Themes

Note: /usr/share/glib-2.0/schemas contains most of the default background/theme settings; I found it easier to directly modify those for a LiveCD instead of having to deal complicated stuff just to, for example, prevent the login screen background from being the same as the desktop background.

  1. Disable the login screen (lightdm) from "copying" the desktop background and other changes:
  • Open nano /usr/share/glib-2.0/schemas/com.canonical.unity-greeter.gschema.xml
  • You can change the login background from the default here if you want:

<key name="background" type="s"> <default>'/usr/share/backgrounds/warty-final-ubuntu.png'</default>

  • Disable "copying" the desktop background by setting this to false:
     <key name="draw-user-backgrounds" type="b">
      <default>false</default>
    
- Set the login theme to Radiance:
          <key name="theme-name" type="s">
      <default>'Radiance'</default>
    
  1. Change the default wallpaper; here, we'll set it to the included "Tie My Boat" (/usr/share/backgrounds/Tie_My_Boat_by_Ray_García.jpg):
  • Open nano /usr/share/glib-2.0/schemas/10_gsettings-desktop-schemas.gschema.override, and change the below line to the path for your file:

picture-uri='file:///usr/share/backgrounds/warty-final-ubuntu.png'

  1. Change the theme to Radiance
  • Open Ubuntu's theme override file ``nano /usr/share/glib-2.0/schemas/ubuntu-artwork.gschema.override`, and change the Ambiance below to Radiance:

[org.gnome.desktop.interface] gtk-theme="Ambiance" ... [org.gnome.desktop.wm.preferences] theme="Ambiance"

  1. Important: Compile the modified schemas!
  • Now that we're done customizing, compile the modified schemas with:
    glib-compile-schemas /usr/share/glib-2.0/schemas 

###6. Build, test and install!

  • Press the Build button in Ubuntu Builder to begin building the custom Live-CD ISO. UB automatically handles the cleanup, etc. that previously had to be done manually.

    enter image description here

  • The ISO can be found in /home/ubuntu-builder; you can test it using the built-in QEMU, or in another virtual machine.

  • My finished CD size was 778 MB (after removing the old .23 kernel), with Unity and Gnome 3D still available if the user wishes to, so that's pretty good for a customization! :)

The following should result:

  1. After bootup, you get the "Try Ubuntu" or "Install Ubuntu" option:

enter image description here

  1. Clicking "Try" gets us our custom desktop!

enter image description here

  1. And logging out (login with ubuntu, blank password) shows that the login wallpaper is kept at the default:

enter image description here

  1. Installer does not crash upon Timezone selection:

enter image description here

  1. Select username, etc. for install:

enter image description here

  1. Installed login screen:

enter image description here

  1. Installed desktop:

enter image description here

8
  • 1
    How to update/install a package which requires system-restart (for example kernel or dbus)? When I try to update it installs; but in gui-mode, session-indicator turns red & says restart to complete the update. Apr 1, 2013 at 12:17
  • How do I replace the Ubuntu artwork with my own artwork ? Jun 10, 2013 at 14:03
  • This one doesn't work. I dont know why. I am not sure whether this happens to me alone. When I run it inside a virtualbox, it shows a popu saying that "/casper/vmlinuz.efi: file not found". How to correct this? s24.postimg.org/jbez8svx1/Untitled.png Jun 19, 2013 at 5:42
  • 6
    This project is discontinued. The PPA does not work, and the website has no download links. I suggest to add this info at the beginning of your answer to help others arriving here not wasting his time. Mar 3, 2015 at 16:02
  • 1
    Ubuntu Builder was discontinued in 2014; Ubuntu Customization Kit installs but doesn't work and was discontinued in 2015; System Imager was discontinued in 2016. This answer really needs to be updated. Is there an offiically supported method in 2019? Jul 4, 2019 at 23:37
23

Creating a live CD from an existing/new installation

EDIT: This method doesn't seem to work anymore. I suggest you try other methods suggested in this QA.

A good way would be making a live CD from a current installation. This can be done using a virtual machine (just don't install any VM tools inside the guest OS)

So, first we need a fresh install(if you can't install it for real, try using a virtual machine) with only things that you need (in your case thunderbird, samba and ssh). Then we tweak the system and record where the tweaks are (e.g. you change your desktop background, the settings are in ~/.gconf or you add firefox shortcuts, they are located in ~/Desktop). This is needed for step 4.

  1. Set up some variables:

    export WORK=~/temp
    export CD=~/livecd
    export FORMAT=squashfs
    export FS_DIR=casper
    

    Replace ~/temp with a path to a temporary directory in which we will work in. Replace ~/livecd with a path to the CD tree.

  2. Make the folder structure. sudo mkdir -p ${CD}/{${FS_DIR},boot/grub} ${WORK}/rootfs

  3. Now we will need to install some packages:

    sudo apt-get install grub2 xorriso squashfs-tools
    
  4. Now we will copy the current installation, modify the exclude flags to fit your needs:

    sudo rsync -av --one-file-system --exclude=/proc/* --exclude=/dev/* \
    --exclude=/sys/* --exclude=/tmp/* --exclude=/home/* --exclude=/lost+found \
    --exclude=/var/tmp/* --exclude=/boot/grub/* --exclude=/root/* \
    --exclude=/var/mail/* --exclude=/var/spool/* --exclude=${WORK}/rootfs \
    --exclude=/etc/fstab --exclude=/etc/mtab --exclude=/etc/hosts \
    --exclude=/etc/timezone --exclude=/etc/shadow* --exclude=/etc/gshadow* \
    --exclude=/etc/X11/xorg.conf* --exclude=/etc/gdm/custom.conf \
    / ${WORK}/rootfs
    

    If you have a separate boot partition, execute this: sudo cp -av /boot/* ${WORK}/rootfs/boot
    In your case, you want to copy settings and some files from the home directory. First, define what directories we want to copy: CONFIG='.config .gconf Desktop someotherfolder andanotherfolder' And now we copy that:

    cd ~ && for i in $CONFIG
    do
    sudo cp -rpv --parents $i ${WORK}/rootfs/etc/skel
    done        
    
  5. Now we chroot into the new system and modify it.

    sudo mount  --bind /dev/ ${WORK}/rootfs/dev
    sudo mount -t proc proc ${WORK}/rootfs/proc
    sudo mount -t sysfs sysfs ${WORK}/rootfs/sys
    sudo mount -t devpts devpts ${WORK}/rootfs/dev/pts
    sudo chroot ${WORK}/rootfs /bin/bash
    

    The next commands are done in chroot:

    LANG=
    apt-get update
    apt-get install casper
    

    Casper contains live scripts. If you want an installer too, run this:

    apt-get install ubiquity ubiquity-frontend-gtk
    

    Or if you want KDE:

    apt-get install ubiquity ubiquity-frontend-kde
    
  6. Update modules.dep and initramfs:

    depmod -a $(uname -r)
    update-initramfs -u -k $(uname -r)
    
  7. Remove non-system users - do not worry, we have copied the settings and data into the "skeleton" of users. That means all new users will have them.

    for i in `cat /etc/passwd | awk -F":" '{print $1}'`
    do
        uid=`cat /etc/passwd | grep "^${i}:" | awk -F":" '{print $3}'`
        [ "$uid" -gt "999" -a  "$uid" -ne "65534"  ] && userdel --force ${i} 2>/dev/null
    done
    
  8. Clean up:

    apt-get clean
    find /var/log -regex '.*?[0-9].*?' -exec rm -v {} \;
    find /var/log -type f | while read file
    do
        cat /dev/null | tee $file
    done
    rm /etc/resolv.conf /etc/hostname
    
  9. Exit chroot. exit

  10. Now, we copy the kernel:

    export kversion=`cd ${WORK}/rootfs/boot && ls -1 vmlinuz-* | tail -1 | sed 's@vmlinuz-@@'`
    sudo cp -vp ${WORK}/rootfs/boot/vmlinuz-${kversion} ${CD}/boot/vmlinuz
    sudo cp -vp ${WORK}/rootfs/boot/initrd.img-${kversion} ${CD}/boot/initrd.img
    sudo cp -vp ${WORK}/rootfs/boot/memtest86+.bin ${CD}/boot
    
  11. If you have installed the installer, you will need to do this, so that the installer doesn't install things like casper:

    sudo chroot ${WORK}/rootfs dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee ${CD}/${FS_DIR}/filesystem.manifest
    sudo cp -v ${CD}/${FS_DIR}/filesystem.manifest{,-desktop}
    REMOVE='ubiquity casper user-setup os-prober libdebian-installer4'
    for i in $REMOVE 
    do
        sudo sed -i "/${i}/d" ${CD}/${FS_DIR}/filesystem.manifest-desktop
    done        
    
  12. Unmount what we have mounted:

    sudo umount ${WORK}/rootfs/proc
    sudo umount ${WORK}/rootfs/sys
    sudo umount ${WORK}/rootfs/dev/pts
    sudo umount ${WORK}/rootfs/dev
    
  13. Convert to squashfs:

    sudo mksquashfs ${WORK}/rootfs ${CD}/${FS_DIR}/filesystem.${FORMAT}
    
  14. Make filesystem.size: echo -n $(sudo du -s --block-size=1 ${WORK}/rootfs | tail -1 | awk '{print $1}') | sudo tee ${CD}/casper/filesystem.size

  15. And md5: find ${CD} -type f -print0 | xargs -0 md5sum | sed "s@${CD}@.@" | grep -v md5sum.txt |sudo tee ${CD}/md5sum.txt

  16. Now grub.cfg:

    sudo nano ${CD}/boot/grub/grub.cfg
    

    (replace nano with your fav text editor, it doesn't matter) Paste this and save:

    set default="0"
    set timeout=10
    
    menuentry "Ubuntu GUI" {
    linux /boot/vmlinuz boot=casper quiet splash
    initrd /boot/initrd.img
    }
    
    
    menuentry "Ubuntu in safe mode" {
    linux /boot/vmlinuz boot=casper xforcevesa quiet splash
    initrd /boot/initrd.img
    }
    
    
    menuentry "Ubuntu CLI" {
    linux /boot/vmlinuz boot=casper textonly quiet splash
    initrd /boot/initrd.img
    }
    
    
    menuentry "Ubuntu GUI persistent mode" {
    linux /boot/vmlinuz boot=casper boot=casper persistent quiet splash
    initrd /boot/initrd.img
    }
    
    
    menuentry "Ubuntu GUI from RAM" {
    linux /boot/vmlinuz boot=casper nopersistent toram quiet splash
    initrd /boot/initrd.img
    }
    
    menuentry "Check Disk for Defects" {
    linux /boot/vmlinuz boot=casper integrity-check quiet splash
    initrd /boot/initrd.img
    }
    
    
    menuentry "Memory Test" {
    linux16 /boot/memtest86+.bin
    }
    
    
    menuentry "Boot from the first hard disk" {
    set root=(hd0)
    chainloader +1
    }
    
  17. If you want, you can add an additional menu entry, which allows you to jump straight into Ubiquity.

    menuentry "Install Ubuntu" {
    linux /boot/vmlinuz boot=casper only-ubiquity quiet splash
    initrd /boot/initrd.img
    }
    
  18. Make the CD/DVD! sudo grub-mkrescue -o ~/live-cd.iso ${CD}

  19. Test it using a virtual machine!

All credit goes to capink, because the guide is from here.

9
  • I have a question about the grub.cfg. Is this file grub.cfg just used while installation, or is it persistent to the installed system also. What if I dont edit the grub.cfg ? Jun 10, 2013 at 14:13
  • @RoshanGeorge This configures GRUB on the CD. It shouldn't persist after installation. Jun 12, 2013 at 12:55
  • Can we just have the installation like how it is for Ubuntu normally, that is, show the ubiquity installer, rather than showing grub? Means, in Ubuntu installation, when we insert and run the cd, ubiquity shows up rather than grub menu, Can we do like that ? Jun 12, 2013 at 17:14
  • @RoshanGeorge It should be possible by adding a menu entry with linux /boot/vmlinuz boot=casper only-ubiquity quiet splash. I will test and verify. Jun 13, 2013 at 16:18
  • @RoshanGeorge I have successfully added an option to launch Ubiquity from the boot menu. However, I need to fix the guide - some ubiquity steps are missing. I will attempt to fix it tomorrow. Jun 13, 2013 at 21:22
15

You can use uck or the live-magic to customize your Live CD.

uck is available from Ubuntu's official software sources, in all versions of Ubuntu since 10.04 LTS Lucid Lynx. You can install uck from the Software Center, with apt-get on the command-line, or by clicking here Install uck.

3
  • 1
    looks like UCK has been discontinued :(
    – amc
    Jun 15, 2016 at 22:17
  • Ubuntu Builder was discontinued in 2014; Ubuntu Customization Kit installs but doesn't work and was discontinued in 2015; System Imager was discontinued in 2016. This answer really needs to be updated. Is there an offiically supported method in 2019? Jul 4, 2019 at 23:36
  • @allquixotic uck is in the 18.04 universe repository. Does this version not work?
    – mchid
    Jul 30, 2019 at 7:36
10

Ubuntu Customization Kit

It is a collection of scripts that make it easier to create a custom LiveCD from an existing .iso image. It is very similar to Remastersys, with the difference that it is actively maintained. It has a GUI to help with the customization, but one can also use the command-line to do the same.

  1. It will ask to select which language packs to include in the CD.
  2. Then, it will ask to select the .iso image file, which will be used as the base for the new CD.
  3. Give a name for the new .iso image that will be created.
  4. Then, it will ask for the packages that are to be added/removed to/from the LiveCD. It will give you an option between the command-line and the default GUI (Ubuntu Software Center). Note: You should select command-line. From the command-line, you can add/remove packages either using apt-get or using Ubuntu Software Center (type software-center from the command-line). You can also modify configuration settings for all the software/apps.
  5. After you have finished (it might take some time to download the required packages), continue.
  6. Now, just sit back and relax. After some time, your customized LiveCD will be ready.
1
  • 2
    looks like the UCK project has been discontinued :(
    – amc
    Jun 15, 2016 at 21:59
8

Duplicating a Ubuntu System for Distribution

None of the current answers on this page still work. At least not with Ubuntu 20.04 or 20.10. All of the apps have been abandoned. Using an image file to duplicate an OS is simple and will always work.

1) Create Image file from existing operating system.

  • Boot Live Ubuntu USB and insert Full install, (or Persistent), USB to be copied.

  • Create an image file of the Full install USB, (or Persistent USB), using GNOME Disks.

    GNOME Disks

    Create disk image dialog

2) Truncate image for distribution, remove unwanted space from end of image file.

Example: Remove NTFS Microsoft basic data partition from end of drive.

Input:

cd /media/ubuntu/DATA/
fdisk -l DiskImageofsdd.img

Output:

Disk DiskImageofsdd.img: 28.66 GiB, 30752636928 bytes, 60063744 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 82741D01-6511-4A8A-8FDF-52D8C165C178

Device                 Start      End  Sectors   Size Type
DiskImageofsdd.img1     1953     3906     1954   977K BIOS boot
DiskImageofsdd.img2     3907   503906   500000 244.1M EFI System
DiskImageofsdd.img3   505856 44578815 44072960    21G Linux filesystem
DiskImageofsdd.img4 44578816 60061695 15482880   7.4G Microsoft basic data

Input:

truncate --size=$[(44578815+1)*512] DiskImageofsdd.img

3) Compress image for distribution.

  • For xz compression, if you are on Windows install 7-Zip from https://www.7-zip.org/a/7z1900-x64.msi, or, if you are on Ubuntu install P7Zip from the Ubuntu store. Once 7-Zip has been installed on Windows or Ubuntu, the flashing tool should work without first decompressing the xz file.

  • PKZip compression may also be used but is not as tight.

4) Virtual Machine: Convert .vdi file to .img file that can be flashed to bootable USB.

  • Open VirtualBox.

  • cd to folder that contains ubuntu.vdi and run:

    VBoxManage clonemedium --format RAW ubuntu.vdi ubuntu.img
    

5) Install Image File to target drive.

Caution: The target drive will be overwritten.

  • Use the pancake icon in Disks or use Etcher, Rufus, dd or mkusb when you want to restore or clone the image to another drive.

6) Create Installer Drive for Image File.

  • Use Etcher, Startup Disk Creator, dd, mkusb, etc to make a Live USB.

  • From another Linux drive, convert the new writable partition to NTFS partition using:

    sudo mkfs.ntfs -f -L usbdata /dev/sdx
    

    where sdx is the Live drive.

  • Place the OS image file in the NTFS partition of the Live USB, where it can be flashed to a target drive from the Live USB when required.

3
  • 2
    Only valid answer for 20.04+ 👍 Oct 30, 2022 at 10:17
  • I am confused at some parts: (1) Does "Boot Live Ubuntu USB and insert Full install, (or Persistent), USB to be copied." mean that I need to do everything in a live boot on a real machine (based on the disks shown in the photo), or can I do that in a VM (based on step 4)? Or are they multiple options in one step? I assume I should customize everything before step 1 anyway.
    – MakisH
    Feb 25, 2023 at 9:26
  • 1
    @MakisH: This was written to duplicate a Persistent or Full install USB, (as an alternative to Remastersys and other methods that no longer work). It should also work for duplicating Ubuntu installed on hard drive, however, the larger the drive being duplicated the longer it takes and the larger the disk required to save it. It should also work when booted to Ubuntu from the hard drive or from VM, (I have not tried this booted from VM). Step 4 is used to convert a .vdi file to a .img file in case you wish to duplicate Ubuntu located on a VM file and not a physical drive. Feb 25, 2023 at 10:44
7

If you need more control over exactly what changes are made, it is possible to make the modification manually.

The process consists of unpacking the SquashFS data file containing the live OS's root filesystem, chrooting into the extracted filesystem, making your modifications, exiting the chroot, repacking the SquashFS file, and then regenerating the ISO image.

Complete details are described on the LiveCDCustomization page of the Ubuntu wiki.

6

You can use Cubic -- this utility has been tested (by me) and works on Ubuntu 18.04 host with an Ubuntu 18.04 image, which is more than can be said for most of the other tools that don't work or are discontinued.

Here is a guide to use it from the website Linoxide.

The rough steps involve:

  • Make sure you're using a supported version of Ubuntu (I tried 18.04; it works)
  • Install the GPG key for the Cubic PPA
  • Add the Cubic PPA to your sources
  • Install the cubic tool
  • Run it, and follow the GUI prompts
3
  • Also, see this answer askubuntu.com/a/741770/100356 for instructions.
    – Enterprise
    Jul 30, 2019 at 16:04
  • Because of this answer I gave Cubic a try with 20.04 and unlike most answers on this page it worked as advertised, thank you. Jan 16, 2021 at 14:03
  • Worked like a charm for me in 2023, creating a custom Ubuntu 22.04 Live USB. Very easy, the documentation and the interface are very easy to follow, and the maintainer very responsive. Definitely worth supporting this project!
    – MakisH
    Feb 25, 2023 at 20:43
5

In Ubuntu Software Center

Edit>Software Sources>Other Software>Add..

Paste the following line in the box and click add source.

deb http://www.geekconnection.org/remastersys/repository karmic

Reload the sources and install Remastersys from Software Center.

Once done, install all the media codecs and apps you'd like on your custom ubuntu. Start remastersys from

System>Adminstration>Remastersys

Pick dist mode, click ok and Wait for the process to finish. Once done, you'll find your custom iso in

/home/remastersys/remastersys/custom.iso

1
  • I've followed exact the same procedures as you described here, but unfortunately during boot it's showing "could not find ramdisk image: /ubninit" and get refreshed again and again with 10 seconds interval. Result: I can't boot my customized ISO. Could you tell me how can I solve this? Please.
    – tuxtu
    Jun 13, 2013 at 9:17
3

Remastersys could be the answer to your needs. You need to go to http://www.remastersys.com/ubuntu.html and follow the instructions. This program makes an iso from your running os including all settings and apps. Than you can burn a CD using this iso. Unfortunately, there was in the past an issue to get it running as a live cd, while installing was no problem (I dont know if this is still a problem).

2
  • 1
    or UCK which uses GUI and is less difficult Jun 18, 2011 at 4:05
  • Remastersys is dead. Now this site is owned by a domain squatter. Jul 4, 2019 at 23:38
1

There is no "GUI" that I know of outside of Lucid, however gNewsense, which is a fork of Ubuntu makes their scripts to take an Ubuntu release and make a custom fork freely available and rather well documented.

Its basically a process of:

  1. Placing your custom artwork where the scripts can find it
  2. Deciding what you want in your kernel (or what you don't want)
  3. Deciding what packages you want (or what you don't want)
  4. Running a script that mirrors an apt repository
  5. Creating the distribution CD / ISO.

While not exactly 'novice friendly', their tools are relatively easy to use.

1

I have tinkered with a new web-based service called Reconstructor. According to their website,

Reconstructor is a toolkit for creating custom versions of the GNU/Linux operating system, specifically Debian and Ubuntu.

According to a Linux Journal article about Reconstructor, they charge small fees for customizations. Whether it's worth it depends on your needs.

1
  • link is dead and domain redirects to potentially malicious site!
    – amc
    Jun 15, 2016 at 22:05
1

I would advise you to try Reconstructor

"Reconstructor is an Ubuntu GNU/Linux CD Creator that allows you to modify an existing Ubuntu distribution and save as your own Linux distribution. It uses the Desktop(Live), Alternate(Install), or Server disc as a base, and then allows for user customization. You can basically customize the entire environment, such as add/remove software, change the default look (splash, themes, fonts, wallpaper, etc.), add desktop links, etc."

Also for more info you should read these links: http://maketecheasier.com/reconstructor-creating-your-own-ubuntu-distribution/2008/07/05

http://maketecheasier.com/build-your-own-ubuntu-based-distro-with-novo-builder/2010/07/02

http://ubuntuforums.org/showthread.php?t=869659

2
  • But these tools wont let me rebrand my distro, they will only allow me to build images and add packages, or atleast that's what I know.
    – user51447
    Mar 21, 2012 at 9:48
  • reconstructor link is dead and domain redirects to potentially malicious site!
    – amc
    Jun 15, 2016 at 22:08
1

You can use JLIVECD too to customize a ISO image. It's a command line tool to customize Ubuntu and Ubuntu based distros. It gives you complete control over things that needs customization but you need to know what needs to be done i.e it only prepares the chroot environment for you (the rest is upto you) and builds the final ISO. You can keep adding new changes to the existing changes and keep checking the ISOs built on them.

0

Download http://sourceforge.net/projects/uck/files/uck/2.4.6/uck_2.4.6-0ubuntu1_all.deb/download follow the instructions and when it asks to run package manager, a console application or continue packing, select Console application.

Now you can run

nautilus

unity-2d-launcher

unity-2d-panel

and do everything.

If this doesn't work first try running the package manager, then try again with the console.

Hope this helps.

1
  • ubuntu customization kit (UCK) has been discontinued
    – amc
    Jun 15, 2016 at 22:09
0

You can modify the default /etc/hosts file (as well as some other default files) by editing /usr/share/ubiquity/plugininstall.py

I thought it would be helpful to share as I needed to know how to do this.

1
  • Actually after further review it appears the /etc/hosts file that gets installed is not generated by the ubiquity plugininstall.py module. If you do wish to modify the default /etc/hosts file you will likely have to make a script that will run once after first boot and delete or rename itself. Unless you recompile the netcfg module - which is not recommended. Oct 10, 2014 at 18:14
0

The question is old, and most of the answers are (naturally?) outdated. I'd like to share my solution:

  1. Install Ubuntu 18.04 to e.g. Virtualbox VM.

  2. Customize to your needs: install new software, etc.

  3. Download pinguybuilder_5.2-1_all.deb from https://sourceforge.net/projects/pinguy-os/files/ISO_Builder/ and install it. NB: Pinguybuilder is an abandonded project, but it did do what I needed.

  4. Run sudo PinguyBuilder backup (or sudo PinguyBuilder dist, see below) - this can take an hour!

  5. Find the ISO file in /home/PinguyBuilder/PinguyBuilder/custom-backup.iso and copy it to a USB stick with something like sudo dd if=/home/PinguyBuilder/PinguyBuilder/custom-backup.iso of=/dev/sdX bs=1M (where sdX is the USB stick device)

Choosing the mode (source)

Depending on what option you choose determines what type of ISO gets created. If you pick “Dist”, this will backup the whole system but exclude your home folder and any personal info.

If you pick “Backup”, this will backup the system and will include you home folder (so make sure it isn’t to big).

Both options can run as a live session. “Dist” mode has no password to login. “Backup” mode uses the user name and password used to create the ISO.

3
  • 1
    pinguybuilder was abandoned three years ago. Jan 14, 2021 at 4:50
  • Thanks @C.S.Cameron - I added a note.
    – tuomassalo
    Jan 14, 2021 at 8:27
  • 2
    As far as I know Cameron's answer is the only answer on this page that is currently up-to-date. Cameron maintains his content, but it's not going to do anyone much good unless his answer gets 117 more upvotes that would put it at the top of this page where users will see it and read it.
    – karel
    Jan 14, 2021 at 8:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .