Ubuntu 10.04 LiveCD customisation gotchas
Here are the gotchas that I came across so far via building Ubuntu 10.04 LiveCD from scratch.
- If you decided not to install NetworkManager, the /etc/network/interfaces file will be started with the following lines
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet dhcp auto eth2 iface eth2 inet dhcp auto ath0 iface ath0 inet dhcp auto wlan0 iface wlan0 inet dhcp
regardless of how many or what physical network interfaces you have. This took me quite a while to figure out where the content of interfaces file generated from. As first, I thought one of the upstart processes but eventually I traced it down to chroot/usr/share/initramfs-tools/scripts/casper-bottom/23networking script. Comment out the last part of the script and rebuild the LiveCD, the interfaces file in the next boot will only contain existing network devices
#if [ ! -x /root/usr/sbin/NetworkManager ]; then # for i in eth0 eth1 eth2 ath0 wlan0; do # grep -q "iface $i" $IFFILE && continue # cat >> "$IFFILE" <<EOF #auto $i #iface $i inet dhcp #EOF # done #fi
- File permission – If your startup script involves changing file permission, then it may not behave as what it seem. A user may appear to have the right permission for accessing a file or directory but the LiveCD keeps saying permission denied. This is because the same file permission in the /rofs hasn’t been changed and it is not modifiable because of read-only filesystem. So the workaround is to sort out the user and group permission of the file before building the LiveCD.
Following is an example, ubuntu user is part of the mysql group and cannot access /var/lib/mysql because without group permission.
ubuntu@ubuntu:~$ groups ubuntu adm dialout cdrom plugdev mysql lpadmin sambashare admin ubuntu@ubuntu:~$ cd /var/lib/mysql/ -bash: cd: /var/lib/mysql/: Permission denied ubuntu@ubuntu:~$ sudo ls -ld /var/lib/mysql drwx------ 4 mysql mysql 120 2010-08-03 23:08 /var/lib/mysql
Change the /var/lib/mysql with group permission and still can’t access
ubuntu@ubuntu:~$ sudo chmod g+rwx /var/lib/mysql ubuntu@ubuntu:~$ sudo ls -ld /var/lib/mysql drwxrwx--- 4 mysql mysql 120 2010-08-03 23:08 /var/lib/mysql ubuntu@ubuntu:~$ ls -l /var/lib/mysql ls: cannot open directory /var/lib/mysql: Permission denied
However, the same file or directory permission remains untouched.
ubuntu@ubuntu:~$ sudo ls -ld /rofs/var/lib/mysql drwx------ 3 mysql mysql 104 2010-08-03 21:44 /rofs/var/lib/mysql