Network boot and install of Ubuntu Linux
You tried everything, booting from CD, DVD, USB, and in your desperate attempts you already started to look if there is a floppy drive laying around the house, just to get the damned thing to boot. The very same thing happened to me today. Computer, simply, would not boot. The only thing left to do is booting your computer from the network. Sounds scary, I know, but in reality this can be a trivial thing to acomplish. I have a Linksys WRT54 router that is running DD-WRT and it serves me as a DHCP server. DD-WRT is using dnsmasq which can provides DNS, DHCP and TFTP services! Great news, since this is all that you need for network boot. Unfortunately TFTP server is disabled and not really usable if you don’t have any extra storage where you could put the tftp files. You will have to use an alternative tftp server, in my case Ubuntu Workstation. Continue reading for the whole recipe …
Basic ingredients
- Linksys WRT54 Wireless router with running DD-WRT.
- Computer running Ubuntu Workstation.
- Ubuntu Server Installation CD (or whatever you are trying to install).
- Computer that is refusing to boot from CD.
- Cables and all other stuff that computers need.
Configuring the DD-WRT
First you will need to tell DD-WRT to what should PXE clients do upon boot. You need to tell them where the TFTP server is and which configuration file they should request. Open the web interface, click on Services and add the following line in the Additional DNSMasq Options text box:
dhcp-boot=pxelinux.0,thefish,10.0.0.1 |
Second and third parameters are hostname and IP address of TFTP server and yes, I have a computer named thefish. Click Save then Apply Settings. That’s it, you are done with the router.
Configuring the TFTP server
Your pretty Ubuntu Workstation will have to serve as a temporary TFTP server unless your router has some extra storage left1. First you need to install tftp:
$ sudo apt-get install tftpd-hpa |
Then you will have to change couple of values in the file /etc/default/tftpd-hpa. RUN_DAEMON should be set to yes and you can add -v -v to the OPTIONS to get more verbose logging. Now just restart the server and you are almost ready.
$ sudo /etc/init.d/tftpd-hpa restart |
Copying the files
WARNING: This is a temporary solution and it should be used only for quick installs and not as a permanent solution and setup for large installations. It is a security nightmare.
$ sudo chmod 777 /var/lib/tftpboot |
$ sudo mount -o loop ubuntu-9.10-desktop-i386.iso /mnt |
$ cd /var/lib/tftpboot |
$ cp -a /mnt/install/netboot/* . |
$ sudo chmod 777 * -R |
$ sudo umount /mnt |
A little explanation on what you just did is necessary. First you gave read write permissions for everyone to /var/lib/tftpboot directory (This is bad, but we’ll put things in order later). Then you mounted Ubuntu server ISO image and copied contents of netboot directory to /var/lib/tftpboot and again gave read write permissions for everyone to all the files there. Since you didn’t need ISO image anymore it was safe to unmount it at the end. Keep the terminal open and tail the syslog file so that you can see what is happening. Reboot your rebellious computer and cahnge BIOS settings so that it will boot from the network.
$ tail -f /var/log/syslog |
If all went well then you got IP address from DHCP server, install files were transfered and you should be looking at the Ubuntu server boot screen. If not, check that syslog you are tailing. The installation after that is trivial and the same as if you boot from CDROM or USB drive, you have nothing to worry about.
Putting things back to normal
Once you installed Ubuntu and tamed that computer you need to put things back in order again. Like this:
$ cd /var/lib/tftpboot |
$ echo "Just make sure that you're in the right directory!!!" |
$ pwd |
$ rm -rf * |
$ sudo chmod 755 . |
$ cd |
$ sudo /etc/init.d/tftpd-hpa stop |
$ apt-get remove tftpd-hpa |
A quick explanation of all that mumbo-jumbo: remove all the files and directories in /var/lib/tftpboot directory, change its permissions back to normal, stop the tftpd server and in the end remove the server from our system.
Congratulations! You managed your first netboot and netinstall. Geek Factor +10 awarded.
- Around 25MB. [↩]

![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=efa058e5-a7cf-4f25-91b8-dd7d5815fd6e)

[...] This post was mentioned on Twitter by David Klasinc, David Klasinc. David Klasinc said: New blog post: Netboot and netinstall of #ubuntu #linux — http://bit.ly/8SemDm [...]