More beginner questions

John G Heim jheim at math.wisc.edu
Wed Mar 8 15:31:15 CET 2017


You wouldn't  do anything in your pxe config to install a different 
operating system. It may be possible to have a non-debian nfsroot to 
boot from but you probably don't want to do that. Far easier is to use 
debian for your nfsroot even when installing another flavor of linux. We 
use ubuntu here and it works fine to use a debian nfsroot.

What you probably want to do is to write a script for the classes 
directory. By default this is /srv/fai/config/classes/. On our fai 
server, I have a script in there that uses SOAP to query a database for 
which operating system to install. I have a web app that allows my 
co-workers to change the operating system in the database. So without 
any understanding of the internals of FAI, my co-workers canupgrade a 
machine from ubuntu xenial to yakkety by going into the web app, 
changing the prefered operating system for the machine, pxe boot the 
machine, and come back 20 minutes later to a freshlyupgraded machine.

You don't have to do anything that elaborate. If you just want debian on 
some machines and ubuntu on others, you can write a script with a case 
statement based on the host name or the IP address.

Actually, there is one other thing you can do that might be worth 
mentioning ... Ask which operating system to install during the install. 
  Here is some perl code to ask a question in a FAI class script. The 
question appears on the console and if the user doesn't answer by the 
end of the wait/timeout, it returns the default value. You call the 
function something like this:

my $answer = &askQuestion ("Wich OS?", {d => 'debian', 'x => 'xenial', y 
=> 'yakkety'}, 'y', 30);

sub askQuestion
	{
	my $question = shift;
	my $choices = shift;
	my $default = shift;
	my $wait = shift;
	$wait = WAIT_TIMEOUT unless ($wait);
	my $answer = '';

	if (	open CONSOLE, "</dev/console")
		{
		while (not defined ($choices->{$answer}))
			{
			eval
				{
				local $SIG{ALRM} = sub { die "alarm clock restart" };
				alarm $wait;
				printf STDERR "$question\n\n" . join ("\n ", map ($_ . "=" . 
$choices->{$_}, sort keys %$choices)) . "\nYour choice 
(default=$default): \a";
				$answer = <CONSOLE>;
				chomp($answer);
				alarm 0;
				}; # lave
			$answer = $default unless ($answer);
			warn "ANSWER=$answer" if ($Main::VERBOSE);
			} # elihw
		close (CONSOLE);
		} # fi
	return $answer;
	} # bus AskQuestion








On 03/08/2017 03:05 AM, Bill MacAllister wrote:
> I have a minimal FAI server up to the point where it will install
> stretch on a client system.  I now need to be able to install other
> distributions. I understand that I need to create or download
> basefiles.  That is straight forward to me. What I am fuzzy on is how I
> create a PXE configuration so that the client picks the correct base file.
>
> For example, for a client system I have a PXE config of:
>
> serial 1 9600 0
> default fai-generated
>
> label fai-generated
> kernel vmlinuz-4.9.0-1-amd64
> append initrd=initrd.img-4.9.0-1-amd64 ip=dhcp
> root=172.21.65.51:/srv/fai/nfsroot rootovl console=tty0
> console=ttyS0,9600n8 FAI_FLAGS=verbose,sshd,createvt
> FAI_CONFIG_SRC=nfs://corpfai.corp.dropbox.com/srv/fai/config
> FAI_ACTION=install
>
> How do I tell FAI to add the class XENIAL?
>
> Bill
>


More information about the linux-fai mailing list