wiki:Documentation/SupportedImages/BuildingBaselineImage

Version 40 (modified by seskar, 9 years ago) ( diff )

Steps for Building a Baseline Image

Our images are primarily derived from a stock distributions OS. Currently we're following the Ubuntu distribution line. The only core service required during installation is the ssh server. The partition size should be kept small to simplify the image gathering process. Due to limitations with the Frisbee tools we can only use ext2/ext3 file systems.

The major modifications that will be required are:

  • Configuring partitions and mount tables
    • We expect a 15G ext3 root partition (/dev/sda1) and no other partitions. Swap will be handled via a file in the file system.
  • Setting up serial console
    • Grub serial / Boot Fail config (including kernel flags)
    • Getty serial config (for login in from the serial console, other wise it looks like it hangs)
  • Modify fstab/rcS to avoid file system checks
  • Setting Root user to have password less login (and dropping all other user records/directories)
    • Modifying console logins (for serial console)
    • Modifying ssh logins (the two are coupled)
  • Installing necessary omf/oml packages
  • Blacklisting modules of wireless interfaces
  • adding the ntp package and then touch a file named /etc/ntp.conf.dhcp
  • Remove the file /etc/udev/rules.d/70-persistent-net.rules
    • prepare.sh usually handles this
  • Removing unnecessary packages and docs to minimize image size
    • prepare.sh usually handles this
  • Get hostname from dhcp

Base OS configuration

  1. Install base OS with a single 15GB partition. It should have no Swap. Openssh Server service should be installed.
  2. To configure grub/kernel messages to goto serial and prevent grub from looking for user input add/modify the following lines in /etc/default/grub and run update-grub(* see version notes):
    GRUB_DEFAULT=0
    GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    GRUB_TIMEOUT=10
    GRUB_RECORDFAIL_TIMEOUT=0
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    #These lines are optimized for boot speed, remove the log/quiet options for debug
    GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
    GRUB_CMDLINE_LINUX_DEFAULT="biosdevname=0 hrn=%fqdn% ip=dhcp loglevel=0 quiet"
    GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 biosdevname=0 hrn=%fqdn% ip=dhcp loglevel=0 quiet"
    
  3. To configure the serial console for login create a file named /etc/init/ttyS0.conf and give it the following contents:
    # ttyS0 - getty
    #
    # This service maintains a getty on ttyS0 from the point the system is
    # started until it is shut down again.
    
    start on stopped rc or RUNLEVEL=[2345]
    stop on runlevel [!2345]
    
    respawn
    exec /sbin/getty -L 115200 ttyS0 vt102
    
    then start it with up start:
    sudo start ttyS0
    
  4. Edit /etc/default/rcS and change the value of FSCKFIX
    FSCKFIX=yes
    
  5. Edit /etc/fstab to have the single disk (/dev/sda1) mount point
    proc      /proc           proc    nodev,noexec,nosuid 0       0
    /dev/sda1 /               ext3    errors=continue 0       1
    
  6. To configure root with no password edit /etc/shadow, the first line should look like:
    root:!:15363:0:99999:7:::
    
    remove the ! that follows the root. This will make the root account active and set the password to nil. Console logins for root will now not require a password.

    To get ssh to accept the changes we need to modify /etc/ssh/sshd_config make sure a couple of lines have specific values. They are:
    PermitRootLogin yes
    StrictModes no
    PermitEmptyPasswords yes
    UsePAM no
    
  7. Configure modules blacklisting so that no wireless devices are started at boot with:
    wget -qO - 'http://www.orbit-lab.org/raw-attachment/wiki/Documentation/SupportedImages/BuildingBaselineImage/blacklist.tar' | sudo tar xf - -C /etc/modprobe.d
    
    After this the content of the /etc/modprobe.d directory should look like:
    root@node1-1:/etc/modprobe.d# ls -ltr
    total 68
    -rw-r--r-- 1 root root   29 Oct  1  2010 intel-5300-iwlagn-disable11n.conf
    -rw-r--r-- 1 root root 1077 Oct  1  2010 blacklist-watchdog.conf
    -rw-r--r-- 1 root root  660 Oct  1  2010 blacklist-framebuffer.conf
    -rw-r--r-- 1 root root  210 Oct  1  2010 blacklist-firewire.conf
    -rw-r--r-- 1 root root 1603 Oct  1  2010 blacklist.conf
    -rw-r--r-- 1 root root  325 Oct  1  2010 blacklist-ath_pci.conf
    -rw-r--r-- 1 root root  323 Mar  2  2011 blacklist-ath5k.conf
    -rw-r--r-- 1 root root   16 Mar  2  2011 blacklist-ath9k.conf
    -rw-r--r-- 1 root root   36 Jun  5  2011 blacklist-iwlagn.conf
    -rw-r--r-- 1 root root   44 Jun  5  2011 blacklist-i2400m_usb.conf
    -rw-r--r-- 1 root root  181 Dec  8  2012 i2400m.conf
    -rw-r--r-- 1 root root  104 Apr 10  2014 mlx4.conf
    -rw-r--r-- 1 root root  347 Apr 10  2014 iwlwifi.conf
    -rw-r--r-- 1 root root  583 Apr 10  2014 blacklist-rare-network.conf
    -rw-r--r-- 1 root root  456 Apr 14  2014 fbdev-blacklist.conf
    -rw-r--r-- 1 root root   62 Jul 28 15:53 blacklist-ipw2200.conf
    -rw-r--r-- 1 root root   51 Jul 28 15:54 blacklist-iwlwifi.conf
    
    Once the files are installed, run:
    /etc/modprobe.d# update-initramfs -u
    update-initramfs: Generating /boot/initrd.img-3.8.0-19-generic
    
    
  8. Setup NTP
    apt-get install ntp
    touch /etc/ntp.conf.dhcp.
    
  9. In order to get dhcp to set the hostname we'll need to make a link for the the /var/lib/dhcp directory and remove the send hostname line of the dhclient config. First run
    ln -s /var/lib/dhcp /var/lib/dhcp3
    
    and in /etc/dhcp/dhclient.conf comment this line
    #send host-name "<hostname>";
    
    then delete /etc/hostname.
  10. Add a symbolic link for lsusb
    ln -s /usr/bin/lsusb /sbin/lsusb
    
  11. Add the making a swap file script to /etc/init.d
    cd /etc/init.d/
    wget http://www.orbit-lab.org/raw-attachment/wiki/Documentation/SupportedImages/BuildingBaselineImage/mkswap.sh
    chmod +x mkswap.sh
    update-rc.d mkswap.sh defaults 99
    cd /
    
  12. You may need to edit /etc/fstab to make sure that the mount point for / is /dev/sda1 (instead of the uuid), and edit /etc/default/grub to set the do not use UUID flag to true. There were some issues with image saves and uuids.
  13. Change the dhcp client from:
    apt-get --purge remove isc-dhcp-common isc-dhcp-client
    
    to
    apt-get install dhcpcd
    

OMF configuration

  1. To begin we'll need to add the repositories (ORBIT and MyTestbed) to the list of sources that our node will pull packages from. This is done by running the following commands:
    wget -qO - http://packages.orbit-lab.org/downloads/orbitapt.gpg.key | sudo apt-key add -
    wget -qO /etc/apt/sources.list.d/orbit.list http://packages.orbit-lab.org/downloads/orbit-precise.list
    wget -qO - http://download.opensuse.org/repositories/devel:tools:mytestbed:stable/xUbuntu_12.04/Release.key | sudo apt-key add -
    echo 'deb http://download.opensuse.org/repositories/devel:/tools:/mytestbed:/stable/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/oml2.list
    
  2. Once we have these changes in place, we need to update the repository list via
    apt-get update
    
  3. Finally, we need to add the following packages and files
    apt-get install omf-resctl-5.4 oml2-apps iperf-oml2
    gem install oml4r
    cd /usr/local/bin; wget http://witestlab.poly.edu/repos/misc/wmxstat
    cd /etc/omf-resctl-5.4/;
    wget http://www.orbit-lab.org/raw-attachment/wiki/Documentation/SupportedImages/BuildingBaselineImage/omf-resctl.yaml
    cd /root;
    

Final Steps

  1. Run the prepare file
    cd /root
    wget http://www.orbit-lab.org/raw-attachment/wiki/Documentation/SupportedImages/BuildingBaselineImage/prepare.sh
    chmod +x prepare.sh
    ./prepare.sh
    

Version Specific Notes

  • Ubuntu 12.10 (and 13.04)
    • This version of ubuntu enumerates the devices with a new naming scheme. It breaks many of our instrumentation scripts. To rectify the problem make this adjustment to /etc/default/grub:
      GRUB_CMDLINE_LINUX_DEFAULT="biosdevname=0"
      GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 biosdevname=0"
      
      Note: When you do this you will also have to fix /etc/network/interfaces as it will have the wrong device name.

Attachments (5)

  • modprobe.d.tar (20.0 KB ) - added by ssugrim 12 years ago. Collection of module black list conf files.
  • omf-resctl.yaml (2.3 KB ) - added by seskar 11 years ago. OMF Resource Controller 5.4 configuration file
  • mkswap.sh (918 bytes ) - added by ssugrim 11 years ago. Start up script to make swap files
  • prepare.sh (1.2 KB ) - added by ssugrim 10 years ago. Updated prepare file to deal with hostnames
  • blacklist.tar (10.0 KB ) - added by seskar 9 years ago. Blacklisted drivers

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.