Mr. Mizzens Ubuntu Remaster Scripts and Guide !
Remastering an [Ubuntu alternate] ISO with Ubuntu Remaster Kit URM - the complete guide

If you need to automate the install or need the security of Encrypted root, the alternate installer is the only option to work with (for now).
As of Ubuntu 9.04 Alpha, there is support for a minimal encryption of the home directory. The goal is said to have /root encryption available as well however, they have had that goal for a long time now......
NEW 1.0 Version: Works with Ubuntu 9.10 i386 and AMD64
Preamble
With remastering any distribution there are basicaly two approaches to this. Top down, and bottom up......If at all possible, I would prefer the "bottom up" approach, in that you would gather only the packages you really need and build from that.
Unfortunately, that is the most difficult way to do it, and making a selection like "ubuntu-desktop" will drag in large number of applications as dependencies. Failure to select all the packages you actualy need can make for some problems as well. "Bottom up" is not so easy.
In the "Top down" approach, we start with the standard issue distribution that we know works, then add in files we want or swap out files as needed.
This Remastering guide uses the "Top Down" approach.
Prerequisites
To remaster an Ubuntu alternate ISO you need to:* Be running the same Ubuntu distribution on your host system in order to run URM successfully
* Unpack the URM tarball and be sure there are no spaces in the path names.
* Have an Ubuntu alternate (x86) ISO downloaded on your hard disks. (X64 is not done yet)
* Have dpkg-dev build-essential devscripts dependencies installed
When you unpack the tarball, the following directory structure will be created.
As the script is run, additional directories will be made as needed.
There is a test for dpkg-dev build-essential devscripts and if not found, they "should" be installed by the script.
Directory Tree: ~/ubuntu-remaster/
~/ubuntu-remaster/example-preseed.seed-------------(You will want to study and edit this file)
~/ubuntu-remaster/remaster-cd.sh-------------------(The library script with all the functions)
~/ubuntu-remaster/sample_key.gpg-------------------(A gpg key with NO password to sign the packages)
~/ubuntu-remaster/urm------------------------------(The script you will run and make changes to)
~/ubuntu-remaster/ubuntu-8.04.1-alternate-i386.iso-(The ISO you will use)
~/ubuntu-remaster/apt/archives/--------------------(The directory you will keep your official extra .deb files in)
~/ubuntu-remaster/packages/------------------------(The directrory you keep your personal .deb files in)
~/ubuntu-remaster/packages/gdm.conf-custom---------(See details below)
~/ubuntu-remaster/post/----------------------------(A directory of files to include on the ISO and place
--------------------------------------------------- on the target system for post install work)
How it all works:
Be sure that the urm and remaster-cd.sh scripts are both executable, then just run it with ./urmIf all goes well,,,,,,,,,
It will mount the ISO
Copy the files to the working directory
Unmount the ISO
Add in all your .deb files from ~/ubuntu-remaster/apt/archives/
Add in all your .deb files from ~/ubuntu-remaster/packages/
Swap out the original preseed file for the example-preseed.seed file
If not already on your gpg keyring, it will add the Ubuntu and sample_key to your keyring.
Sign all the pakcages
Compile the entire mess into a new ISO.
Preseed file details:
The original Ubuntu preseed file contains only one line - Ubuntu-desktop.All other settings of the Debian Installer are then just the defaults Ubuntu hard coded into the installer.
The "Locale sets language and country" and "Keyboard selection" don't do much.
You can play with it, but expect to get the questions anyway.
Clock time zone and NTP, are set to true to supress those questions.
Partitioning:
As I have it set, it will install the sytem as LVM encrypted root. After you enter the passphrase, all other questions are suppressed.
If you comment out all of this, or just remove it, you will have all the options presented as hard coded by Ubuntu.
Account setup:
Now this was fun.... As you can see, it will ask for the root password and it will NOT make a user account.
If you fail to include the gdm.conf-custom file, admin login will NOT be enabled, and you will not get in.
Interesting to note, that if you set the root password AND set a user account, expect the user account to have NO SUDO privilege.
This leaves you with a root account and password, but no admin login and no sudo from the user account to enable it.....
Slipping the gdm.conf-custom file in solves that problem..... though you can comment all of this out and have the usual user only account to start with.
Individual additional packages to install:
Probably why you are remastering an ISO in the first place.....
Right after the line d-i pkgsel/include string \ list your packages with a space or tab between each and end each line with a \ as shown.
The installer will find all of these files (and the dependencies) on the disk, and install them for you.
But how do you get the packages and all the dependencies on the disk????
The easy and fool proof way to do this, is to install Ubuntu on a test box (real or virtual), but DO NOT update it.
Go to /var/cache/apt/archives and you will find a few hundred .deb files that have been cached. Delete them!
As a sample, you can use my list of files (or your own), and just replace the line
d-i pkgsel/include string \
with
apt-get install -y \
Apt will get all the packages and dependencies, install them AND leave all the files in /var/cache/apt/archives
Since you did NOT do an update, all the dependencies will match what is on your starting ISO file.
Then just drop them into ~/ubuntu-remaster/apt/archives/
You can even do this with the Medibuntu repository enabled and pick up the media packages too.
But avoid the ones that require user agreement - Adobe, MS TT fonts, java etc.
Boot loader / Finish up / X configuration:
What is here works, supresses some common questions and reboots after it ejects the CD.
Running custom commands during the installation:
We start this action with d-i preseed/late_command string \
After that, you have some very basic shell commands you can work with - so do not expect anything fancy here.
Since we have the gdm.conf-custom file on the CD, we just copy that over to the target system.
Read the file, but it just enables admin login and sets a different GDM login screen.
Next is a simple mkdir command on the target system, so that we can copy over the post install directory and files.
Packages that require user agreement are best done post install.
Personaly, I use this to place things like my Themes, Fonts, Firefox extensions, post install script etc. onto the target system so it is all ready at first boot to finish up.
Last, since these were copied from a CD, they end up being read only. So I slip in a chmod to correct that.
Special Note: modifying software that was already on the original ISO
Sometimes you want to modify default configurations of software which is bundled with the default ISO, in order to do that you need to:
* locate the original deb package within the remaster-iso/pool tree
* delete it
* create a new deb package for the software, with all your customizations inside it
* copy your new deb package to the position where the original one was (eg: ~/tmp/remaster-iso/pool/main/a/app2)
You need to delete the original package to avoid possible conflicts.
As you can see, I do this with my wallpaper and gnome-session files. But I also needed to swap out the pango files.
This came up because the version of gnome-session I rebuilt is newer than what is on the ISO and it requires the newer pango files.
Without those newer files, gnome-session fails to install and the installer only reports the infamous "exiting error code 1".
Now you're ready to burn it or prferably, test it with qemu/virtualbox/vmware.
Testing it is highly recomended before you burn a disk.
If the intall fails, <alt>F4 should bring up the text and you should see the cause of the error.
Getting back to the installer is <alt>F1
Many thanks to the following for code, ideas and inspiration:
Install CD Customization
debian-cd
Ubuntu-devel-discuss