Automated installs for debian (read: ubuntu) linux are pretty awesome, and the default preseed files provide a fair amount of flexibility. When you add in the ability to run commands at various times during the installation, the flexibility is almost limitless. EXCEPT… heh:
I wanted to have an ssh server set up on my target machine while an automated installation was occuring. That way I could debug what was going on, or even force a reboot (yes, this machine was all the way in the other room!). The debian installer provides a “network console” option that sets up an ssh server, which you then use to complete the installation. However, it required user input. I want an ssh server that’s there during installation for “emergencies”, but I want the install to complete automatically on it’s own. I tried hard, using scripts, various installs, and i even compiled my own ssh-server udeb (which worked, by the way, but it felt like a little bit of overkill).
Then I figured out this neat little trick. You can use network-console, but pass a debconf arg in your preseed file that will allow your install to continue without waiting for user input! Here’s the relevant chunk from a preseed file. The cool bit is the last line:
d-i anna/choose_modules string network-console d-i network-console/password password putyourpasswordhere d-i network-console/password-again password putyourpasswordhere d-i network-console/start note
Be careful though, this is a bit of a hack… If the rest of the preseed allows your install to continue normally, it will continue to install even though when you log in over ssh, you are presented with the initial install screen. If you select “install” from your ssh term, you’ll likely get all kinds of errors as the install process tries to run on top of itself. However, if you go to “advanced install”, you can drop into a regular terminal. From there, you can tail the syslog, check configs, and even reboot the machine. Woo hoo!
Here are some other preseed / installation resources I was looking at, in no particular order:
https://help.ubuntu.com/community/Installation/NetworkConsole
http://wiki.debian.org/DebianInstaller/NetworkConsole
http://www.debian-administration.org/articles/394
http://blog.loftninjas.org/2008/02/22/getting-a-debian-installer-ssh-shell-the-hard-way/
http://packages.debian.org/squeeze/openssh-server-udeb
this is just some random stuff about shadow file hash gen:
http://www.linuxquestions.org/questions/linux-general-1/what-is-used-to-create-the-shadow-password-hash-602739/
Cheers!
{ 2 comments… read them below or add one }
Thanks for your blog post! I had the same problem and you’ve saved me probably lots of time/hacking.
Could you explain the method you have used to find the ‘d-i network-console/start note’ parameter? Thanks in advance!
This was a while ago, but I’m pretty sure that I ended up going through all of the ubuntu installation scripts in order to find that one. I know there is very little documentation out there covering all of the preseed options, probably because with each release they seem to change a little bit. Check this out to see how to extract the initrd — then just poke around in the scripts until you find what you’re looking for!