Twitter Updates

    follow me on Twitter

    G-AVLN in front of her home

    G-AVLN in front of her home

    Mostly Unix and Linux topics. But flying might get a mention too.

    Thursday, August 19, 2010

    Automated kickstart install of ubuntu

    Prepare the configuration server:
    Install packages
    Configure DHCP and TFTP to provide pxe-boot image files
    Configure lighttpd to serve operating system files
    Prepare kickstart configuration file
    Start client; intercept boot and request net boot

    Note: the steps below expect all servers (dhcp, tftp and web) to be on the same physical machine, here: Both the installation server, and anticipated clients are Ubuntu machines.

    Step 1.
    (a) Install dhcp3 server. This will provide the initial network boot, for the client's PXE start.

    $ sudo apt-get install dhcp3-server

    (b) Edit its configuration.
    Add the subnet info, leave all other elements of the file as they are.

    $ sudo vi /etc/dhcp3/dhcpd.conf
    ddns-update-style none;

    # option definitions common to all supported networks...

    option domain-name "";

    option domain-name-servers,;

    default-lease-time 600;

    max-lease-time 7200;

    log-facility local7;

    subnet netmask {


    option domain-name-servers; # your DNS server

    option domain-name ""; # your domain name

    option routers; # your gateway

    option broadcast-address;

    filename "pxelinux.0";


    (c) Start dhcp server.
    $ sudo /etc/init.d/dhcp3-server start

    Step 2.
    (a) Install tftpd-hpa (and its super-daemon, inetd):
    $ sudo apt-get install openbsd-inetd tftpd-hpa

    (b) Modify the main tftp setup file, in /etc/default/tftpd-hpa, to have the content as shown.
    $ sudo vi /etc/default/tftpd-hpa





    The address above is the IP address of your tftp server.

    (c) Start the inetd superdaemon
    $ sudo /etc/init.d/openbsd-inetd start
    Starting internet superserver inetd [ OK ]

    (d) Check the tftpd is now active:
    $ netstat -a | grep tftp
    udp 0 0 *:tftp *:*

    Step 3.
    Copy the netboot files into the tftp server. (Check lftp is there, if not – install it, with sudo apt-get install lftp).
    $ sudo mkdir -p /srv/tftp/
    $ cd /srv/tftp/
    $ sudo lftp -c “open; mirror”

    Step 4.
    (a) Edit /srv/tftp/pxelinux.cfg/default and change string menu.cfg into text.cfg.
    After the change, the file should look as follows:

    include ubuntu-installer/i386/boot-screens/text.cfg

    default ubuntu-installer/i386/boot-screens/vesamenu.c32

    prompt 0

    timeout 0

    (b) Modify the /srv/tftp/ubuntu-installer/i386/boot-screens/text.cfg file to have the following content:

    timeout 1

    default auto

    label auto

    menu label ^Auto

    menu default

    kernel ubuntu-installer/i386/linux

    append vga=normal initrd=ubuntu-installer/i386/initrd.gz

    ks= -- quiet

    Step 6.
    (a) Install lighttpd (may need to stop apache first, if running).
    $ sudo /etc/init.d/apache2 stop # if running
    $ sudo apt-get install lighttpd

    (b) Ensure that the root directory is /srv/www (the default /var/www could be used, but we follow proper FHS rules here ;-). This will serve all installation files. The url directive in the kickstart file will direct the installation program to this web page.
    $ sudo vi /etc/lighttpd/lighttpd.conf
    change the document-root directive to read as follows:
    server.document-root = "/srv/www/"

    (c) Start lighttpd
    $ sudo /etc/init.d/lighttpd start

    Step 7.
    Populate the the web server with the installation files.

    Here, we will get the installation files from the Ubuntu installation CD (assumes Ubuntu installation CD is in the drive on the server machine, and mounted).

    $ sudo mkdir /srv/www/ubuntu
    $ sudo cp -rv /dev/sr0/* /srv/www/ubuntu

    (time for a cuppa)

    Step 8.
    Create a text file called ks.cfg with the kickstart instructions, and place it in the /srv/www/ubuntu directory.
    Notice that /srv/tftp/ubuntu-installer/i386/boot-screens/text.cfg is pointing at this file.


    #System language

    lang en_UK

    #Language modules to install

    langsupport en_UK

    #System keyboard

    keyboard gb # not uk !

    #System mouse


    #System timezone

    timezone Europe/London

    #Root password

    rootpw --disabled

    #Initial user

    user fred --fullname "Fred User" --iscrypted --password

    #Reboot after installation


    #Use text mode install


    #Install OS instead of upgrade


    #Use Web installation - provide the URL of your web server

    url --url


    #System bootloader configuration

    bootloader --location=mbr

    #Clear the Master Boot Record

    zerombr yes

    #Partition clearing information

    clearpart --all --initlabel

    #Disk partitioning information

    part / --fstype ext3 --size 10000000 # --grow failed for me ;-(

    part swap --size 512

    part /lvm --fstype lvm --size 512

    #System authorization information

    auth --useshadow --enablemd5

    #Network information

    network --bootproto=dhcp --device=eth0

    #Firewall configuration

    firewall --disabled

    #Do not configure the X Window System


    %packages # comment out needed packages, or add new


    # ubuntu-vm-builder

    # libvirt-bin

    # screen



    perl -pi -e "s/kickseed/myserver/g" /etc/hosts /etc/motd

    perl -pi -e "s/ubuntu/myserver/g" /etc/hosts /etc/motd

    cat > /etc/hostname <<>



    cat >> /etc/hosts <<> myserver yourserver herserver


    # any other post-installation shell command(s) can go here

    This concludes server configuration.

    Step 9. On the client:

    Boot, intercept the booting process and enter BIOS. Change the sequence of boot devices, and select network boot.

    Ideally, you want to identify a separate key, like F12 on some machines, which request PXE boot without you changing the boot sequence. This will prevent repeated boots as the machine restarts after the installation.

    Thursday, August 12, 2010

    How did Ubuntu speed up boot time?

    Fact: Ubuntu 10.04 boots significantly faster than any other desktop/laptop OS I have ever used. On the same machine (Asus), boot time went from about 75 seconds to less than 30. My Lenovo X201 takes approximately 25 seconds to go through full reboot cycle.

    How come? Scott of Canonical, explained at LINUXCON.

    When booting a Linux system, four distinct phases occur:
    1.Load into memory the kernel and ramdisk
    2.Load platform drivers
    3.Start X-related stuff
    4.Start the desktop

    Ubuntu developers made a conscious decision to aim for target timing. Rather than tweaking existing sequence of events, they decided to invest time into redesigning the boot process, and aim for 2+2+2+4 seconds for each stage, respectively.

    That would give a cold-to-desktop time of 10 seconds. Test base platform that was used was a Dell laptop (can't remember which one, but it doesn't matter, as advantages and shortened time will apply to most contemporary PCs).

    How they went about it: first of all, they looked at the monolithic kernel content, and cleaned it up. This had a two-fold benefit: it allowed to remove some of the duplicity, where two (or more !) modules were doing the same thing, but also in the process, they managed to nearly half the footprint of the kernel image itself – a massive saving in resource and time to load.

    Ramdisk savings are not that easy to achieve. You can't remove it altogether: ramdisk is essential, as it provides the hibernate/suspend functionality, LVM, RAID, filesystem encryption, etc. However, where the saving can be made is if you start performing ramdisk tasks asynchronously with the loading of mainline kernel. That, of course, relies on the CPU with multi-cores, but even on a single core the benefits are significant, as the kernel will schedule things more efficiently whilst waiting for hardware to return.

    Other improvements:

    blkid process (relying on while/sleep) poll-style operation has now been fully replaced by libudev process (which instead of polling devices, it works on the “tell me when you are ready” principle. That alone saved 3.5 seconds off the boot time

    upstart – a total replacement to the init process; it allowed to eliminate 1000s of shell script code and replaced the sequential processing of the service startup with event-driven service initialisation. For example, in the traditional method, when got to mounting a device and the device wasn't up and running, it would miss out on being connected. With initupstart, device will be mounted when it announces its readiness

    ureadahead – a binary providing a method of speeding up disk seeks and reads; much more effective on SSD drives, because HDD disks are still prone to slow seeks, as disk geometry gets in the way; ureadahead is fs-independent, although it still can't cope with the fs metadata location problems
    use light-weight desktops

    in future compiz will be replaced with faster alternative

    Tuesday, August 10, 2010

    Oracle take on Linux

    Wim Coekaerts was the first guest speaker at this year's Linuxcon, in Boston. Oracle are one of the event's sponsors, which in itself seems rather significant.

    Considering recent acquisition of Sun Microsystems by Oracle, it's not surprising that Oracle's presence here is important.

    I'm not going to transcribe the talk. Few comments only: the indication of where Oracle stand on Solaris and Linux is apparently in the fact that they are at present hiring professionals in both of these.

    According to Wim, more than 20% of Oracle installations run on Linux. His closing comment was:

    "Linux is here to stay, also at Oracle"

    That was to say - nobody argues the place of Linux in today's IT, and that has nothing to do with Oracle, no individual or organisation can change the momentum Linux has. However, Oracle are declaring their full embrace for both Linux and open source in general.

    Blog Archive