Imaging Guide

From Physiki
Revision as of 03:21, 11 August 2008 by Ahubl (Talk | contribs)
Jump to: navigation, search

Decprecated incarnations of tablet imaging walkthroughs are located at the Deprecated Imaging Guides

Contents

Clonezilla Implementation

Somewhat patchy original documentation at http://www.clonezilla.org/clonezilla-server-edition/ and http://drbl.sourceforge.net/

Import the repo key to your keyring

wget http://drbl.nchc.org.tw/GPG-KEY-DRBL; apt-key add GPG-KEY-DRBL

Edit sources.list

Add the following to your /etc/apt/sources.list

(This should also work if you add a file in /etc/apt/sources.list.d/, then apt-get update) This repo is the only one with the DRBL package, but it's really slow. Consider downloading the .deb from SourceForge (http://drbl.sourceforge.net/download/sourceforge/) and installing it locally. “sudo apt install XYZ.deb” is the command, I believe. Otherwise apt-get update && apt-get install drbl

Install DRBL, step 1

There are two commands you use to install and activate CloneZilla. The first is /opt/drbl/sbin/drblsrv -i . Note: There is a space before the "-i". The first time you run it, this will also connect to the Intarweb and download a bunch of packages. Decline installing packages for “Diskless Linux”, as we don't run any thin clients. Other than that, the questions are pretty straightforward. Make sure you have two network interfaces up when you run this command – it will detect one as “Internet” and one as “private”. If it doesn't detect two interfaces, the clients won't get a DHCP lease. Don't bother to configure your clients – letting the range in dhcp.conf control leases is fine. It warns you about this, but we don't care.

Install DRBL, step 2

Run /opt/drbl/sbin/drblpush -i - Sorry, I don't remember what this does, just that it's necessary. The default options are again mostly acceptable. We want “no diskless Linux” and “Clonezilla box”. Some options give information about “increased requirements on server for more clients”. These options are never what we want – we don't care about persistent client configuration.

Get image from source tablet

Now run /opt/drbl/sbin/dcs to set the mode. Primarily pay attention to “clonezilla-start” and “clonezilla-stop”, then “clonezilla-save-disk” or “clonezilla-restore-disk”. Note that the defaults include no graphical boot screen – this is nice to have, so change this option. Also, choose whether you want to set the image name now or later. “Now” is fine. Your first task is to receive an image, so select that option. Netboot your master, and follow the instructions.

Broadcast image

After you receive the image, you have to put it back out to the others. Rerun /opt/drbl/sbin/dcs, selecting “clonezilla-start” and “clonezilla-restore-disk”. When you are broadcasting an image, you have two options. You can wait for a certain amount of time or a certain number of clients. I suggest the “number of clients” option, as it should prevent the problem we've experienced with our dd/udpcast script of missing one client and having to reboot all the clients.

Da-da!

That's it! Our test run showed a sustained transfer speed of about 1GB of data/minute, which may or may not happen on a regular basis.

Misc. Comments

Each interactive command ends with a statement like “Next time you want to do this, run the following command”, giving you a method to bypass the interactive part by using a huge command line instead. I was never paying enough attention to capture these, but we should get them and put them up on the wiki to save some time.

Good luck!


The Grand Unified Tablet Build

TICC is now using a single build to image all of our tablets. Our first attempt at this build has focused on the tc1100 and tc4200, this build will eventually be updated to handle differences between these tablets and the tc4400 and 2710p tablets. To setup a tablet with the GUTB scripts just download the archive and copy it to the root partition (/), untar it (tar -xzf ticc-scripts.tar.gz), and then run the install script (/scripts/INSTALL.sh).

Archive.png Download ticc-scripts for the GUTB (Alpha Release)

Detection of Tablet Model

A simple hash of the CPU information is used to create a unique identifier for each tablet. The script '/scripts/cpuhash.sh' can be used to generate this id, this script just runs the command:

cat /proc/cpuinfo | grep -v bogomips | grep -v "cpu MHz" | md5sum | awk '{ print $1 }'

This command takes the CPU identification and strips out the part that varies from time to time (bogomips and "cpu MHz") and creates an md5sum of the remaining data. It is important to note that because of the technique used to detect the model, more than one CPU can correspond to a particular tablet model. To add a hash to the list so that it correspond to a particular model you must tack on the result of '/scripts/cpuhash.sh' to the file '/scripts/hashes.sh'. This file is formatted 'addHash <hash> <name>'; for example, the tc1100 entry appears as:

        # CPU Hash                       # Tablet Name
addHash d4c66c8352264f0fd3a70935ad43dacc tc1100

Differences in the Wacom Driver

The tc1100 and tc4200 have three major differences in how they utilize the Wacom pen: the tc1100 has no eraser, the side-buttons have different IDs on the two tablets, and the serial port used by the pen controller has a different address. To resolve the eraser issue, there is a separate xorg.conf for each tablet. To handle the button codes being different there is a separate folder of scripts for each pen button for the two tablets, when the tablet starts up a symbolic link is made to the appropriate script folder. In order to handle the different serial ports being used, a unique "autoserial.conf" file (part of setserial) is used for each tablet and a symbolic link is made to the appropriate configuration file on boot.

Differences in the Video Driver

The tc1100 uses nVidia's proprietary video card driver while the tc4200 uses the open-source Intel i810 driver. Due to this issue there is a separate xorg.conf for each tablet and there are also separate GLX and OpenGL libraries (libglx.so and libGL.so.1). While the tablets will work without these changes, without xorg.conf you will need to reconfigure the graphics driver at every boot and without the correct graphics libraries Compiz will not be able to function.

Conventions

username is your username (I'll assume that if you are doing this you have an account on Ticc).

eth0 refers to the wired NIC. This may be different, so check!

eth1 refers to the wireless NIC (if I ever refer to it).

Prep work

Setting up the tablets takes a while. Likely one person can start getting the master machine ready while everyone else gets tablets ready to boot up. They should be plugged in and they should have a wired connection to the switch.

Needed files

Before we get started, pick a master machine with a working installation and enough space to hold the image (shouldn't be much more than 20 gigs at the most). You'll want to wire it to the schools network to grab the files (unless you want to wait two hours for the image file to transfer wirelessly). I'll also assume that it's running Ubuntu Gutsy. If not, you'll have to translate some commands.

We (obviously) need the image files. They are stored on ticc. Log on and find them in the /images directory. Generally, they'll be .img.gz files, but some appear to be different (either format wise, in which case they may be unuseable, or naming wise). Go ahead and sign off ticc and copy the image file from your master:

  • scp username@ticc.mines.edu:/images/imagename.img.gz .

We'll also need the tftpboot files. I've tar'd them and you can grab and extract them:

  • scp username@ticc.mines.edu:/images/tftpboot.tar.gz .
  • tar -xvzf tftpboot.tar.gz /var/lib

We want to have the dhcp and tftp servers installed before we take it off the network (although, these aren't huge, so doing them over wireless after unplugging is an option). But, as long as we're plugged in, we may as well install the packages:

  • sudo apt-get install tftpd-hpa
  • sudo apt-get install dhcp3-server

That should be everything we need, so now we configure the tftp and dhcp servers. At this point we can plug the wired connection into the standalone switch.

Static IP

We'll want a static IP of 192.168.0.1 on the master. Go to System | Administration | Network. Double-click the wired connection. In the box that comes up:

  • Uncheck "Enable roaming mode"
  • Set "Configuration" to "Static IP address"
  • Set "IP Address" to "192.168.0.1"
  • Set "Subnet Mask" to "255.255.255.0"
  • "Gateway" can be left blank.

Now, form a command prompt do

  • sudo /etc/init.d/networking restart

Run ifconfig and verify that eth0 has the static IP of 192.168.0.1. You should also be able to remain connected to the wireless (configured by NetworkManager), so you can browse the internet and do homework while the imaging fun is happening.

Undo static IP

To undo the changes, go back to System | Administration | Network. Double-click the wired connection and check "Enable roaming mode."

Configuring dhcp3-server

If the master is a personal machine (I used mine), you probably don't want the dhcp running every boot, so, before we forget, remove it from bootup:

  • sudo update-rc.d -f dhcp3-server remove

Edit /etc/dhcp3/dhcp.conf and add the following to the bottom:

subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.10 192.168.0.254 ;
   option subnet-mask 255.255.255.0;
   option routers 192.168.0.1;
   option broadcast-address 192.168.0.255 ;
   default-lease-time 30000;
   max-lease-time 30000;
   server-name "192.168.0.1";
   filename "pxelinux.0";
}

Now, the dhcp server can be started with:

  • sudo /etc/init.d/dhcp3-server start

Configuring tftpd-hpa

Again, if this is a personal machine, you probably don't want it running every boot, so remove it from bootup:

  • sudo update-rc.d -f tftpd-hpa remove

Edit /etc/default/tftpd-hpa and change "no" to "yes".

That's it, you can start it by doing:

  • sudo /etc/init.d/tftpd-hpa start

Start the imaging fun

For good measure, restart the dhcp and tftp servers:

  • sudo /etc/init.d/dhcp3-server start
  • sudo /etc/init.d/tftpd-hpa start

Network boot all the tablets (F12 at bootup). They should reach a "maxwell" login prompt. This means they are ready to go.

They will be expecting a gzip'd file. The image file should be gzip'd, but may not be. If it is, we use

  • udp-sender --file /media/hda1/imagename.img.gz --interface eth0

to start the sender. Before hitting enter, make sure the number of clients makes sense (it counts form 0, so if you have 4 clients, the last one will report as #3). Hit enter and watch it go (hopefully it will).

Some of the images don't seem to be gzip'd. The clients are expecting a gzip'd image, so this won't fly (plus, it'd take longer to send over the network). If, for some reason, you have an un-gzip'd image, you should gzip on the fly:

  • cat imagename.img | gzip -c | udp-sender --interface eth0

Miscellanea

Writing zeros to free space

  • cat /dev/zero > ./zero

Delete the file afterwards.

Imaging from a drive

On the 1100s, I can't get a response form the keyboard after netbooting, so I had to ssh in (you can find there IP by looking around on the screen). The username is root and they use the super-secret password.

First, we must turn of udp-reciever:

  • sudo killall udp-receiver

Now, we can start the sender (once the other clients are ready:

  • cat /dev/hda | gzip -c | udp-sender

Note: if you start this via an ssh session, you cannot terminate ssh or it will kill the sender.

If you want to make an image file while you are imaging drive-to-drive, start up the client on some functioning machine (like your tftp and dhcp master, if it has space):

  • udp-receiver --file imagename.img.gz

From there, it should receive along with the other clients and dump the results into the filename you gave.

Reseting Linux password

If for some reason, the linux student password is not "password" as expected (like last night when we imaged from somebody's already checked out tablet), you may need to reset it. I did this by netbooting the tablets, ssh'ing to them from the master, and editing the shadow file:

  • ssh root@192.168.0.###

The netbooted tablets take the super-secret password. After login:

  • mkdir /mnt/hda4
  • mount /dev/hda4 /mnt/hda4
  • nano /mnt/hda4/etc/shadow

Note: hda4 is the root linux partition on the current tc1100 image. It could be different. You can do "fdisk /dev/hda" to figure out where it is. In the shadow file, there will be a line starting with "student:". Replace the contents of that line with:

  • student:$1$M2kDEuFM$.N9fW/oipzqaMl9NpZ26S0:13915:0:99999:7:::

This will reset the student password to "password".




ARCHIVE (original wiki'd instructions--thanks Kenton)

Connect all tablets to dedicated TICC switch except Magic Master, which is for now connected to the school network. This one will be performing the magic of imaging. Boot the Magic Master into Linux.

With the Master open a terminal. SSH into the TICC server (ticc.mines.edu). User name “root” with the password of “hello”. Find the images (currently at /images). Open a new terminal to copy and paste names.

  • Store the desired image where there is adequate space (requires 12-14 GB)
  • Check if tftpd is running (ps -A | grep ftp) (not default installed)
  • sudo apt-get install tftpd-hpa
  • edit /etc/default/tftpd-hpa
    • change no to yes!
  • Then sudo /etc/init.d/tftpd-hpa start
  • sudo killall dhclient (otherwise it gets its own IP address)
  • Make sure that dhcp3-server is installed/install if needed
  • Edit /etc/dhcp3/dhcpd.conf
  • Add the following:
subnet 192.168.0.0 netmask 255.255.255.0 {
   range 192.168.0.10 192.168.0.254 ;
   option subnet-mask 255.255.255.0;
   option routers 192.168.0.1;
   option broadcast-address 192.168.0.255 ;
   default-lease-time 600;
   max-lease-time 7200;
   server-name "192.168.0.1";
   filename "pxelinux.0";
}
  • check file /etc/default/tftpd-hpa for proper boot image location (should be something like "/pxelinux.0")
  • actually fetch the netboot part

sudo scp -r root@ticc.mines.edu:/images/tftpboot <space> /var/lib/

    • (we might want to store this directory tarred, as it is the entire netboot kernel)
  • on server, do

ifconfig eth2 192.168.0.1 netmask 255.255.0.0 bcast 192.168.0.255

    • kill Network Manager and all associated parts, killall dhclient on ethernet interface, then ifconfig
    • I think we need the netmask option, but I'm not sure. The bcast part is only req'd if you're going to use udp-receiver to get a copy of the image as it transfers
  • After changing the ip address restart the dhcp server

sudo /etc/init.d/dh(something) restart

  • restart tftpd

sudo /etc/init.d/tftpd-hpa restart

  • Reboot all servile tablets so that they may prepare for what they are about to receive. Remember to F12 for network boot
  • Once all servile tablets have reached the maxwell login prompt, issue the +3 Strength magic command on the heretofore Magic Master.

udp-sender --file /media/hda1/011507tc4200.img.gz --interface eth2

Other Miscellaneous Usefulness

  • To write zeroes to free space, do “cat /dev/zero > ./zero”, then delete file when finished. Also do it to the FAT32 partition.
  • To image from one hard drive to another, first turn off udp-receiver by

sudo killall udp-receiver

and then do

cat /dev/hda | gzip -c | udp-sender

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox