Deprecated Imaging Guides

From Physiki
Jump to: navigation, search

Contents

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