In my last entry I showed how to make the Linux distro SystemRescueCD PXE bootable. In this entry I'm going to give you 2 examples of making boot images that you can boot over the network with PXE. The first image we are going to make is a bootable version of the Seatools diagnostic software to test hard drives from Seagate. The second image we are going to make is a generic dos bootable PXE image.
The images we make will be loaded by the syslinux bootloader. The installation and setup of syslinux was covered in the entry "Making SystemRescueCD PXE bootable".
The first image we are going to make one for Seatools. Seatools is diagnostic software given out by Seagate to test/fix their hard drives. To make a this image you will need access to a windows machine. Either boot into a windows virtual machine or just use a actual windows machine. First, go to the Seagate website and go to the support section. In there you will see the downloads section. Look for the software "Seatools for DOS". Follow the links to the download section. When offered the choice of text or graphical choose either one they both work. Now choose the "Floppy Diskette Creator" and download that to the windows machine. It will be a windows executable. This is what we will need to make the floppy disk for us.
The next thing we need to download is the software that will emulate a floppy disk drive for us. Download the free software called Virtual Floppy Drive for Windows. Unzip it and run the vfdwin.exe executable. Click the driver tab and click the Start button to load the virtual floppy driver. Then click the Drive0 tab. Click the Change button and select a drive letter to be the virtual floppy drive. Then click the Open/Create button and click the browse button. Type the name of an image file you want to make. Make sure you give the filename the extention .img. Then click the Open button to finish the selection. Media type should be 3.5 1.44MB. Disk type should be set to FILE. Then click the create button. Now, Run the Seatools software you downloaded and if it asks point it to the floppy drive. It might not ask. Just click the "Create Floppy" button. After its done writing click the close button under the Drive0 tab to finish the floppy image. Now take the .img file you just made and put it on the tftp server with the other PXE boot images you have. Edit your PXE boot menu and put in an entry for this image. Below is the entry for my syslinux PXE boot menu.
label seatools kernel memdisk append initrd=seatools.img floppy
On next boot you should be able to type "seatools" at the PXE boot prompt and seatools should load
Now lets look at creating a generic dos boot image. With this dos boot image you can do things like flash a bios of a machine that does not have a cdrom or floppy disk. You can run lots of dos programs you need right from the PXE boot prompt. First, we need to download a dos floppy disk image from somewhere. This is just generic dos boot disk made by using dd on linux to copy it to a file. Like "dd if=/dev/fd0 of=/tmp/floppy.img bs=10240". If you have a favorite dos floppy you can make an boot image of it with that last command. Then copy the image over to the tftp directory where the other images are and put in a boot menu item for it. It just might boot.
I choose to take an already made dos boot image and put my own software on it. I downloaded a clean version of a 2.88MB FreeDOS boot disk. It was made by a Sourceforge project called FreeDOS Odin. So go there and download one yourself. Save a copy of the downloaded image file somewhere so you can keep reusing it. Now we are going to add our own software to the dos boot disk image we just downloaded. I made a copy of my downloaded image and called it dosboot.img. We are going to mount that file and copy the files we need to the disk image. The example below will copy the file dosbin.exe as an example.
mkdir /tmp/dos
sudo mount -o loop dosboot.img /tmp/dos/
sudo cp dosbin.exe /tmp/dos
sudo umount /tmp/dos
Now copy the dosboot.img file back up to the tftp boot dir. Edit the PXE menu file and put in a new line for the DOS floppy image. Look at the example above for a reference. Save the file and boot your new PXE image.
Del.icio.us! | Digg Me! | Reddit!
Have you ever wanted to stop carrying those bootable floppy disks, cd-rom's, or usb drives everytime you want to install, test, update, or rescue a machine on your network? If you have a network with hundreds or thousands of computers it's a pain to be lugging usb drives or cd-rom's to boot one if they need a new disk image or to test a hardware problem. Enter PXE. PXE, aka Pre-Execution Environment, or 'pixie' is an environment used to boot computers using a network interface. That means you need no data storage device at all to boot the machine. Most current machines have settings in the bios to turn on PXE booting. With PXE booting you can do things like booting dos floppy image with bios update or run a memory test with memtest86. You can also boot full operating systems to rescue or burn in machines. The following information will show you how to setup the enviorment to PXE boot the linux distro SystemRescueCD and some other boot images. This example is done using CentOS. Let's get started.
First we have to turn on PXE booting for each machine. Boot the computer and go into the bios. Find the section in the bios that has to do with the boards devices. There will usually be a section about the LAN or ethernet devices. It will say something like "OnBoard LAN Boot ROM". Turn this on. Save the settings. Reboot. Go back into the bios and find the boot device section. Here you will select the order of your boot devices. Your network controller should be in the list of devices. It might be called something funny like "IBA GE Slot ..." but rest assured that is the LAN adapter. Move it up or down in the order you want to have it try to boot the machine over the network. It has to be before a device that has boot media or it will boot that device first.
Now we need to add a few lines to your dhcp server. If you don't have one you will need to set one up as PXE can not work without one. If your using CentOS you can install one with the command "yum install dhcp". On a working dhcpd server you will need to add the following lines to the /etc/dhcpd.conf configuration file. Make sure you choose your own ip blocks for the different ranges here. Restart the dhcpd server after putting in the lines.
subnet 192.168.5.0 netmask 255.255.255.0
{
range 192.168.1.50 192.168.1.55;
range dynamic-bootp 192.168.1.56 192.168.1.60;
next-server 192.168.5.1;
filename "pxelinux.0";
}
If your dhcpd.conf file already has the subnet line then you just need following lines in between the curly braces. Make sure you choose your own ip blocks for different ranges here. The dynamic-bootp line is the ip range for the PXE boot servers. Choose an empty range on your network for these ip's. The next-server line should be the tftp server ip address (which we will setup next). The filename line is the file that is given out on boot.
range dynamic-bootp 192.168.1.56 192.168.1.60; next-server 192.168.5.1; filename "pxelinux.0";
On the same machine or another machine you will need to start a tftp server. PXE will not work without this either. You can install one on CentOS machines with the command "yum install tftp-server". After it's installed we will make a few dir's we need and start the server. The commands for this are below.
mkdir /tftpboot
mkdir -p /tftpboot/pxelinux.cfg
/usr/sbin/in.tftpd -l -B 1460 -s /tftpboot/
Now make sure the syslinux package is installed on the machine with the tftp server. Syslinux is the boot loader PXE will use to boot. You can install it on CentOS using the command "yum install syslinux". Then find out where the file pxelinux.0 lives. On my install it was in /usr/lib/syslinux/pxelinux.0. Copy this file to the /tftpboot dir.
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
Download the latest SystemRescueCd iso to the machine with the tftp server. We are going to mount it on loopback so we can pull some files off to put in the /tftpboot dir. Don't use any version of SystemRescueCD prior to 1.0 for PXE booting. It's broken. This example uses version 1.0.
mkdir /tmp/iso
mount -o loop systemrescuecd-x86-1.0.0.iso /tmp/iso
cd /tmp/iso
cp bootdisk/* /tftpboot
cp isolinux/* /tftpboot
cp syslinux/syslinux.cfg /tftpboot/pxelinux.cfg/default
Now we need to setup an http server. Apache, thttpd, lighttpd, or any other http server will do. I would suggest thttpd if you just want to setup a simple http server. The reason for this is that we need to pull the root filesystem over on boot and it's over 150MB. Doing that via tftp is super slow. Tftp was not made for large files. sysrcd.md5 and sysrcd.dat are the 2 files that need to be copied to the http server running on the machine you installed tftp or any other http server you have running already. It does not have to be on this machine. Only these 2 files are transfered this way. The rest are done via tftp. My example will show copying the 2 files to a dir on the same machine as the tftp server. The root of the my http server will be pointing to /var/www/htdocs/.
cp /tftpboot/sysrcd.md5 /tftpboot/sysrcd.sys /var/www/htdocs/systemrescuecd
Let's modify the default SystemRescueCD menu file /tftpboot/pxelinux.cfg/default. You will need to modify the 2nd line in the file which is the kernel options line for the default kernel (rescuecd). The line starts with the word append. Append the following line (below) to the end of the append line.They are just boot options for the kernel. This will need to go after each line in the default file you want to boot from that needs the SystemRescueCD root filesystem. Other boot images like memtest won't need it. If you put your sysrcd.dat file on a different http server or path from example configuration above then you will need to edit the boot line to reflect where that file is.
setkmap=us boothttp=http://192.168.5.1/systemrescuecd/sysrcd.dat dodhcp ar_source=http://192.168.5.1/systemrescuecd/ ar_nowait
The first sets the keymap to US. The second tells rescue cd to get the root filesystem from an http server (tftp is very slow ~2MB/s). You can also replace boothttp=http with boottftp=tftp. I can't stress enough that tftp is to slow for big images like sysrcd.dat. The dodhcp says to make a dhcp request after booting. The line starting with ar_source tells the system to pull a shell script off an server and execute it after booting. The file it pulls has to be named autorun and it has to be a shell script. You can have 10 autorun files. The format is autorun#. Where # is a digit from 0 to 9. ar_nowait tells the machine to not wait for a keypress after executing server. Take out the ar_source part if you don't want to execute an autorun shell script after boot. It is not required. Save this file after your done editing.
If you do what to use the autorun script then here is an idea for it. Put some files you might need when you boot your enviorment in a dir and have ncftpget or wget (already on the SystemRescueCD cd) get any files for you after boot. Make a dir in the same dir you have your SystemRescueCD boot files and put your files in there. Then on boot it will pull those files over for you to use. For example I have an ftp server I pull files from when my image boots. The example is below.
#!/bin/bash ncftpget ftp://192.168.5.6/systemrescuecd/scripts/*.sh ncftpget ftp://192.168.5.6/seatools/st chmod 755 *.sh st
That should be it. Boot a machine (with PXE turned on) that has network access to all the things we setup. It should boot. PXE will get an ip from the dhcp server (bootp) and then pull the pxelinux.0 file (via tftp) to boot. After the pxelinux.0 file is loaded it should bring up the SystemRescueCD menu and you can boot from there. You will notice if you hit the F2 key you will get other menu items. You can boot these other images also. SystemRescueCD comes with boot images like memtest for memory testing or dban for disk wiping.
Del.icio.us! | Digg Me! | Reddit!
This will show you how to configure a Movemail account in Thunderbird. The setup works by using Fetchmail to grab the email from remote mailboxes and giving it to Procmail to put into a local file on the users system. Thunderbird will then grab (move) the mail from the file to the users home dir under the .thunderbird dir.
Why do this? Well, if you have a bad connection to an IMAP server that goes up and down all the time along with other POP and IMAP accounts this pulls in all your mail from all your accounts and keeps it locally. If you have ever used Thunderbird with IMAP connecting over a bad network (lot's of packet loss) then you will appreciate this. You can only crank the timeout to the server up or down. You can not turn it off. The box that pops up every time it can not connect is an annoyance. Using the stop button is the only way to kill the connect. This install was done using CentOS 4.
First make sure Procmail and Fetchmail are installed on the machine. If it's a machine with a rpm package manager then try the following to see if they are installed.
rpm -qa |grep fetchmail
rpm -qa |grep procmail
If nothing shows up for one or the other install them. On a CentOS machine with yum installed just execute the following. Use sudo with the commands below if need be.
yum install fetchmail
yum install procmail
It's assumed Thunderbird is installed already. Lets configure Fetchmail first. Put the following configuration file in the your home dir and call it .fetchmailrc. Then chmod the .fetchmailrc file you just made to 0710 (chmod 0710 .fetchmailrc).
set daemon 240 set logfile /home/local_login_name/fetchmail.log poll pop3.domain.com proto POP3 user "pop3_username" pass "pop3_password" is "local_login_name" ssl fetchall no keep no rewrite mda "/usr/bin/procmail -d %T"; poll imap.domain.com proto IMAP user "imap_username" pass "imap_password" is "local_login_name" ssl fetchall no keep no rewrite mda "/usr/bin/procmail -d %T";
"set daemon 240" sets Fetchmail to get mail every 240 secs. "set logfile" is where the logfile will go (take it out if you don't want a logfile). The "poll" line is for the mail server and protocol info. The "user" entry is the users username on the mail server. The "pass" entry is their password on the server. The "is" line is the login name you use on that linux/unix workstation. Both connections use SSL to get the mail. Remove the ssl lines if your provider does not support it. See the Fetchmail man page for more details. The settings in the file will get the mail from the server and give it to Procmail to deliver it. Then it will send the command to remove the mail from the server. No mail will be left on the server after this! All mail will be local and the you will not be able to see it in any webmail system the ISP runs. If you want to see it in a webmail system you will have to kill Fetchmail so it stops removing the mail from the server (killall fetchmail).
Procmail does not need any special settings as it will deliver the mail to /var/mail/local_login_name by default. Thunderbird will pick up the mail from that file and move it to it's own dir.
Now to make a Movemail account in Thunderbird. Open Thunderbird and go to the top menu and select File->New->Account. You will get the new account dialog box. If you are opening Thunderbird for the first time then this box is already up. In the new account box choose "Unix Mailspool (Movemail)" then click the next button. Put in the users name and email address then click the next button. Uncheck the "Use Global Inbox (store mail in Local Folders) box. This will put the mail in the global Inbox for all accounts. Then click next. Put in a name for the account (what it will be called in the config menu and in the left hand pane). Go to Edit->Account Settings. Go to the name of the account you just choose to set some configuration settings. Fill in the "Reply-To" address with the users email address. Click on "Server Settings" and choose the check for messages times. Then click on the next item "Copies & Folders". Select each drop down box and choose "Local Folders" for each. Set the rest of the settings to your preference.
Now start Fetchmail by going to a command prompt and typing "fetchmail". It should start. To watch the mail come in you can watch (tail -f ) the /home/local_login_name/fetchmail.log file that we specified in the config file. When mail comes in it is shown in the logfile along with any errors. Once an email comes in you can hit the "Get Mail" button in Thunderbird and it will get the mail from the /var/mail/local_login_name dir and put it in /home/local_login_name/.thunderbird/xxxxx.default/Mail/localhost. You should see the mail come up in Thunderbird.
Now let's make sure Fetchmail starts on boot. Put the line "/usr/bin/fetchmail" in the /etc/rc.local file. That is if you have or can use that file on start up. Most Unixes have this. That will make it start on boot. At anytime you want to make Fetchmail get mail just execute "fetchmail" from the command line and it will try and retrieve mail.
Del.icio.us! | Digg Me! | Reddit!