1

I want to make a remix of Ubuntu that can be run live but also have the option to install. I am using the tutorials for Live CD Customization From Scratch and Live CD Customization. I have also had some success with the ubuntu mode of the live-build(4.0.5-1) scripts but I could not get it to have an install option. I want to start from scratch so I don't want to use uck. I am running into some issues while trying to install the distro. The live option works just fine. First off, I am doing all of this on Xubunutu 14.04.

I will walk through my steps from the begining:

ARCH=i386
RELEASE=trusty
# make chroot environment
mkdir -p work/chroot && cd work
sudo debootstrap --arch=$ARCH $RELEASE chroot
# Copy Files For Internet
sudo cp /etc/hosts chroot/etc/hosts
sudo cp /etc/resolv.conf chroot/etc/resolv.conf
sudo cp /etc/apt/sources.list chroot/etc/apt/sources.list
# Copy A text file with a list of packages (packages.txt) to the chroot environment
sudo mkdir -p chroot/usr/share/initialinstall
grep -vE '^\s*(#|$)' packages.txt >> packages-list.txt
sudo cp packages-list.txt chroot/usr/share/initialinstall/packages
rm packages-list.txt
sudo mount --bind /dev chroot/dev

Now I have a chroot environment setup successfully. Now I can chroot into the environment now.

sudo chroot ./chroot
mount none -t proc /proc
mount none -t sysfs /sys
mount none -t devpts /dev/pts
HOME=/root
export LC_ALL=C
apt-get update
apt-get install --yes dbus
dbus-uuidgen > /var/lib/dbus/machine-id
dpkg-divert --local --rename --add /sbin/initctl
apt-get install --yes casper lupin-casper
apt-get install --yes discover laptop-detect os-prober
apt-get install --yes linux-generic
apt-get install --yes ubiquity-frontend-gtk

While Installing these previous packages a grub-pc configuration comes up. I don't think that it will affect my host system since I am in a chroot environment. So I click [ok], and then install it to dev/sda

Then, while still in the chroot environment I install all of the packages that are in the text file that I moved into the chroot environment from before.

# Install new packages from the list from before
apt-get install $(grep -vE "^\s*#" /usr/share/initialinstall/packages  | tr "\n" " ")
# Prepare to exit chroot environment
rm /var/lib/dbus/machine-id
rm /sbin/initctl
dpkg-divert --rename --remove /sbin/initctl
apt-get clean
rm -rf /tmp/*
rm /etc/resolv.conf
umount -lf /proc
umount -lf /sys
umount -lf /dev/pts
exit
sudo umount /path/to/chroot/dev

I already have syslinux squashfs-tools genisoimage so now I have to set up the cd image directory.

mkdir -p image/{casper,isolinux,install}
cp chroot/boot/vmlinuz-* image/casper/vmlinuz
cp chroot/boot/initrd.img-* image/casper/initrd.lz
cp /usr/lib/syslinux/isolinux.bin image/isolinux/
cp /boot/memtest86+.bin image/install/memtest
cp /usr/lib/syslinux/menu.c32 image/isolinux/

Then I made isolinux.cfg and placed it in image/isolinux/. It contained the following:

UI menu.c32
PROMPT 1

MENU TITLE Boot Menu
DEFAULT live
LABEL live
  menu label ^Start or install Ubuntu Remix
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz quiet splash --
LABEL live-install
  menu label ^Install Uubuntu Remix
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.lz quiet splash ---
LABEL check
  menu label ^Check CD for defects
  kernel /casper/vmlinuz
  append  boot=casper integrity-check initrd=/casper/initrd.lz quiet splash --
LABEL memtest
  menu label ^Memory test
  kernel /install/memtest
  append -
LABEL hd
  menu label ^Boot from first hard disk
  localboot 0x80
  append -
TIMEOUT 50

Then I created the manifest

sudo chroot chroot dpkg-query -W --showformat='${Package} ${Version}\n' | sudo tee image/casper/filesystem.manifest
sudo cp -v image/casper/filesystem.manifest image/casper/filesystem.manifest-desktop
REMOVE='ubiquity ubiquity-frontend-gtk ubiquity-frontend-kde casper lupin-casper live-initramfs user-setup discover1 xresprobe os-prober libdebian-installer4'
for i in $REMOVE 
do
        sudo sed -i "/${i}/d" image/casper/filesystem.manifest-desktop
done

After that compress the chroot

sudo mksquashfs chroot image/casper/filesystem.squashfs 
printf $(sudo du -sx --block-size=1 chroot | cut -f1) > image/casper/filesystem.size

Create diskdefines

touch image/README.diskdefines

It contains:

#define DISKNAME  Ubuntu Remix
#define TYPE  binary
#define TYPEbinary  1
#define ARCH  i386
#define ARCHi386  1
#define DISKNUM  1
#define DISKNUM1  1
#define TOTALNUM  0
#define TOTALNUM0  1

Recognize as Ubuntu Remix

touch image/ubuntu
mkdir image/.disk
cd image/.disk
touch base_installable
echo "full_cd/single" > cd_type
echo "Ubuntu Remix 14.04" > info  # Update version number to match your OS version
echo "http//your-release-notes-url.com" > release_notes_url
cd ../..

Calculate MD5

sudo -s
(cd image && find . -type f -print0 | xargs -0 md5sum | grep -v "\./md5sum.txt" > md5sum.txt)
exit

Create ISO image

IMAGE_NAME=UBUNTUREMIX
cd image
sudo mkisofs -r -V "$IMAGE_NAME" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o ../ubuntu-remix.iso .
cd ..

Now I try and test it with VirtualBox. I created a virtual machine with the following settings:

Settings

My Issue Is With Testing It

When I start it, I am greeted with the menu that I want and I can try out the live option which works just fine. I close out of the machine and try to install it to the virtual hard drive and the ubiquity installer works just fine until the very end, I get the following error: An attempt to configure apt to install additional packages from the CD failed

apt config error

It boots me into the live version so that I can try and fix the problem. I tried using lsblk to see if it sees a cdrom device and it appears to see it:

lsblk

If anyone has any hints or pointers I would really appreciate it. This is my last issue to overcome with this project and I am really stumped. A debian bug from 2012 had a work around to delete /usr/lib/ubiquity/apt-setup/generators/40cdrom. I verified that my distro has the file and I unpacked an Xubuntu iso and it had that file as well. So I don't know if just deleting it is the correct course of action or if my Virtual Box settings are wrong.

As an aside here is the packages that are in the text file that I install:

xorg
xinit
xterm
xserver-xorg
xserver-xorg-core
xfonts-base
x11-xserver-utils
x11-apps
x11-session-utils
x11-utils
xinput 
openbox
obconf
obmenu
tint2
volti
clipit
gmrun
lightdm
lightdm-gtk-greeter
light-locker
light-locker-settings
laptop-detect
spacefm
synaptic
libnotify4
dkms
gvfs
gvfs-backends
policykit-1
unzip
zip
p7zip
unrar-free

I could be missing an important package too.

  • Well I did delete chroot/usr/lib/ubiquity/apt-setup/generators/40cdrom and it works but I think I'll wait and see if there are any other more elegant solutions – Jesse Sep 10 '15 at 22:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.