Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using PC-Sysinstall for automated network installs of FreeBSD

57 views
Skip to first unread message

Mark Saad

unread,
Nov 16, 2012, 11:54:11 AM11/16/12
to
All
I wanted to share with you my method for network installs of FreeBSD
9.1-RCn . This does not use PC-BSD just stock FreeBSD. This should
work on 9.0-RELEASE is known to work on 9.1-RC's and BETA.

I decided to use pc-sysinstall in place of bsdinstall as pc-sysinstall
supported using a config file that could be passed to the installer
much like the old sysinstall way of doing things.


Jumpstart host:
--------------------------

Exported filesystems: /export/

Useful paths on /export, /export/install/freebsd/9.1/{i386,amd64}
this is the contents of the install media rsync'd to a local filesystem

TFTP configured to server from /tftpboot which is a symlink to
/export/install/freebsd/9.1/{i386,amd64}

DHCPD configured as follows

subnet 10.1.5.0 netmask 255.255.255.0 {
authoritative;
option netbios-name-servers 10.1.5.252;
option routers 10.1.5.1;
option subnet-mask 255.255.255.0;
option broadcast-address 10.1.5.255;
option domain-name "ops.com";
option domain-name-servers 8.8.8.8, 10.1.5.101;
next-server 10.1.5.28;
option root-path "/tftpboot";
filename "/pxeboot";
default-lease-time 21600;
max-lease-time 43200;
}


Changes to make the install media boot the way I want it.
--------------------------------------

1. I copied boot/pxeboot to /export/install/freebsd/9.1/{i386,amd64}
thats a work symantic not required
2. I created a conf directory to store my pc-sysinatll configs
3. I added the following bits to rc.conf to make the nfs root happy
sendmail_enable="NONE"
hostid_enable="NO"
update_motd="NO"
hostid_enable="NO"
varmfs="YES"
hostname="jumpstart00.ops.com"
4. I modified the fstab file as follows
#/dev/iso9660/FREEBSD_INSTALL / cd9660 ro 0 0
none /tmp tmpfs rw 0 0
5 I changed my rc.conf to start a simple shell script and not the
bsdinstall bits

export TERM=vt220

echo "o PC-SYSINSTALL "
exec /conf/picker.sh

6. Here is /conf/picker.sh

#!/bin/sh

: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}


dialog --backtitle "FreeBSD Jumpstart" --title "Welcome" --no-label
"Shell" --yes-label "Install" --yesno "Welcome to FreeBSD! Woul
d you like to begin an installation or use the live filesystem?" 0 0

case $? in
$DIALOG_OK) # Install
exec /conf/disk.sh
;;
$DIALOG_CANCEL) # Live CD
;;
esac


7. Here is /conf/disk.sh
#!/bin/sh

: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}


dialog --backtitle "FreeBSD Jumpstart" --title "Select disk type"
--no-label "SCSI/SAS da0" --yes-label "IDE/SATA ada0" --yesno "Se
lect Your servers root disk type" 0 0

case $? in
$DIALOG_OK) # Install IDE/SATA
exec /usr/sbin/pc-sysinstall -c /conf/ada-install.cfg
;;
$DIALOG_CANCEL) # Install SCSI/SAS
exec /usr/sbin/pc-sysinstall -c /conf/da-install.cfg
;;
esac
exit 255

The install config
------------------------

I created /conf/ada-install.cfg and /conf/da-install.cfg the only
difference here is the name of the disk as that is not auto
discovered.

Here is ada-install.cfg

# User Generated pc-sysinstall configuration
installInteractive=no
installMode=fresh
installType=FreeBSD
installMedium=local
localPath=/usr/freebsd-dist/
installFile=fbsd-release.txz
packageType=tar

hostname=nynewserver1.ops.com
netDev=AUTO-DHCP


# Disk Setup
disk0=ada0 #Change me to suite your needs
partition=ALL
bootManager=bsd
partscheme=GPT
commitDiskPart

# Partition Setup for da0(ALL)
# All sizes are expressed in MB
# Avail FS Types, UFS, UFS+S, UFS+SUJ, UFS+J, ZFS, SWAP
# UFS.eli, UFS+S.eli, UFS+SUJ, UFS+J.eli, ZFS.eli, SWAP.eli
disk0-part=UFS+SUJ 0 /
disk0-part=SWAP 4096 none
disk0-part=UFS+SUJ 10240 /var
commitDiskLabel


# Optional Components
#installComponents=src

# Root Password
rootPass=iAmAwinner


# Setup basic network
runCommand=echo 'ifconfig_bge0="DHCP"' >>/etc/rc.conf
runCommand=echo 'ifconfig_em0="DHCP"' >>/etc/rc.conf
runCommand=echo 'ifconfig_igb0="DHCP"' >>/etc/rc.conf
runCommand=echo 'ifconfig_bce0="DHCP"' >>/etc/rc.conf
runCommand=echo 'ifconfig_nfe0="DHCP"' >>/etc/rc.conf
runCommand=echo 'sshd_enable="YES"' >>/etc/rc.conf
runCommand=echo 'ntpd_enable="YES"' >>/etc/rc.conf

#Tweak the configs
runExtCommand=/mnt/sbin/mount_nullfs /packages/ /mnt/mnt/
runExtCommand=mount -t devfs devfs ${FSMNT}/dev
runCommand=echo "-D" > /boot.config
runCommand=echo 'boot_multicons="YES"' > /boot/loader.conf
runCommand=echo 'boot_serial="YES"' >> /boot/loader.conf
runCommand=echo 'comconsole_speed="9600"' >> /boot/loader.conf
runCommand=echo 'console="comconsole,vidconsole"' >> /boot/loader.conf
runCommand=cp /mnt/sysctl.conf /etc
runCommand=cp /mnt/motd /etc
runCommand=cp /mnt/ttys /etc
runCommand=cp /mnt/sshd_config /etc/ssh/
runCommand=mkdir -p /root/.ssh/
runCommand=chmod 700 /root/.ssh/
runCommand=cp /mnt/authorized_keys /root/.ssh/
runCommand=chmod 600 /root/.ssh/authorized_keys

# Set up date/time
runCommand=cp /usr/share/zoneinfo/UTC /etc/localtime
runCommand=touch /etc/wall_cmos_clock
runCommand=adjkerntz -a

# Install packages
runCommand=pkg_add /mnt/All/bash-4.2.37.tbz
runCommand=pkg_add /mnt/All/vim-lite-7.3.632.tbz
runCommand=pkg_add /mnt/All/rsync-3.0.9_1.tbz
runCommand=pkg_add /mnt/All/perl-5.14.2_2.tbz
runCommand=pkg_add /mnt/All/python27-2.7.3_3.tbz
runCommand=pkg_add /mnt/All/ruby-1.8.7.370,1.tbz
runCommand=pkg_add /mnt/All/lua-5.1.5_4.tbz
runCommand=pkg_add /mnt/All/sudo-1.8.5.p3.tbz
runCommand=pkg_add /mnt/All/portaudit-0.6.0.tbz
runCommand=pkg_add /mnt/All/curl-7.24.0.tbz
runCommand=pkg_add /mnt/All/openldap-client-2.4.32_1.tbz
runCommand=pkg_add /mnt/All/pam_ldap-1.8.6_2.tbz
runCommand=pkg_add /mnt/All/pam_mkhomedir-0.2.tbz
runCommand=pkg_add /mnt/All/nss-3.13.6.tbz
runCommand=pkg_add /mnt/All/portupgrade-2.4.9.9,2.tbz
runCommand=pkg_add /mnt/All/unzip-6.0_1.tbz
runCommand=pkg_add /mnt/All/syslog-ng-3.3.5_1.tbz
runCommand=pkg_add /mnt/All/cciss_vol_status-1.10.tbz
runCommand=pkg_add /mnt/All/compat6x-amd64-6.4.604000.200810_3.tbz
runCommand=pkg_add /mnt/All/dmidecode-2.11.tbz
runCommand=pkg_add /mnt/All/pcre-8.31.tbz
runCommand=pkg_add /mnt/All/mcelog-1.0.p2.tbz
runCommand=pkg_add /mnt/All/openjdk6-b25_1.tbz
runCommand=pkg_add /mnt/All/net-snmp-5.7.1_7.tbz

#Clean up and reboot
runExtCommand=umount ${FSMNT}/mnt
runExtCommand=umount ${FSMNT}/dev
runCommand=shutdown -r now


Notes

1. The package install its some hoop jumping but it works. I hope that
Kriss More with add a macro to handle this in the future. I would like
it use to PKG_PATH to make this simpler.
2. The installed FreeBSD originally came from the fbsd-release.txz on
the pc-bsd mirrors however you can provide you own . Work is being
done to make this macro use the FreeBSD tar
balls provided on the install media . That may make it into
9.1-RELEASE but I doubt it.

Thanks to Kriss More for all his help.


--
mark saad | none...@longcount.org
_______________________________________________
freebsd...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hacke...@freebsd.org"

Warren Block

unread,
Nov 16, 2012, 5:40:01 PM11/16/12
to
On Fri, 16 Nov 2012, Mark Saad wrote:

> All
> I wanted to share with you my method for network installs of FreeBSD
> 9.1-RCn . This does not use PC-BSD just stock FreeBSD. This should
> work on 9.0-RELEASE is known to work on 9.1-RC's and BETA.
>
> I decided to use pc-sysinstall in place of bsdinstall as pc-sysinstall
> supported using a config file that could be passed to the installer
> much like the old sysinstall way of doing things.

This is really nice--thank you!

Warren Block

unread,
Nov 16, 2012, 8:35:17 PM11/16/12
to
On Fri, 16 Nov 2012, Mark Saad wrote:

> Useful paths on /export, /export/install/freebsd/9.1/{i386,amd64}
> this is the contents of the install media rsync'd to a local filesystem

Do you have a way to choose either i386 or amd64 installs?

> 5 I changed my rc.conf to start a simple shell script and not the
> bsdinstall bits

Maybe you mean "/etc/rc.local" there?

> export TERM=vt220
>
> echo "o PC-SYSINSTALL "
> exec /conf/picker.sh


Trying to start this from SYSLINUX almost works. My menu config just
does

menu label FreeBSD 9 Install
pxe {serverip}:/usr/tftpboot/images/fbsd9ins/boot/pxeboot

The kernel boots, it gets to

Trying to mount root from nfs: []...
NFS ROOT: {serverip}:/usr/tftpboot/images/fbsd9ins

and then it stops and just sits. NFS mount of that directory works on
another system. Anything obvious I should check? I know pxeboot needs
to be recompiled for some things, but can't recall the details.

Warren Block

unread,
Nov 16, 2012, 8:44:36 PM11/16/12
to
On Fri, 16 Nov 2012, Warren Block wrote:

> Trying to start this from SYSLINUX almost works. My menu config just does

Actually, it does work on a real machine. It stalls on a VirtualBox VM
during or after the NFS root mount.

Mark Saad

unread,
Nov 16, 2012, 10:51:08 PM11/16/12
to


On Nov 16, 2012, at 8:44 PM, Warren Block <wbl...@wonkity.com> wrote:

> On Fri, 16 Nov 2012, Warren Block wrote:
>
>> Trying to start this from SYSLINUX almost works. My menu config just does
>
> Actually, it does work on a real machine. It stalls on a VirtualBox VM during or after the NFS root mount.

Strange , I will test it on virtualbox when I get some time next week . I did a lot of the testing initially on VMware esxi 4.0 and I did not have any issues related to VM stuff . What version of vbox did you use ? What network interface choice did you use in vbox ?

---
Mark saad | mark...@longcount.org

Warren Block

unread,
Nov 17, 2012, 12:19:23 AM11/17/12
to
On Fri, 16 Nov 2012, Mark Saad wrote:

> On Nov 16, 2012, at 8:44 PM, Warren Block <wbl...@wonkity.com> wrote:
>
>> On Fri, 16 Nov 2012, Warren Block wrote:
>>
>>> Trying to start this from SYSLINUX almost works. My menu config just does
>>
>> Actually, it does work on a real machine. It stalls on a VirtualBox VM during or after the NFS root mount.
>
> Strange , I will test it on virtualbox when I get some time next week . I did a lot of the testing initially on VMware esxi 4.0 and I did not have any issues related to VM stuff . What version of vbox did you use ? What network interface choice did you use in vbox ?

VirtualBox 4.1.22, FreeBSD 9-stable amd64 host. Only the "PCnet-FAST
III (Am79C973)" can pxe-boot, and only in bridged mode.

Sam Fourman Jr.

unread,
Nov 19, 2012, 12:39:11 PM11/19/12
to
On Fri, Nov 16, 2012 at 7:35 PM, Warren Block <wbl...@wonkity.com> wrote:

> On Fri, 16 Nov 2012, Mark Saad wrote:
>
> Useful paths on /export, /export/install/freebsd/9.1/{**i386,amd64}
>> this is the contents of the install media rsync'd to a local filesystem
>>
>
> Do you have a way to choose either i386 or amd64 installs?
>
>
> 5 I changed my rc.conf to start a simple shell script and not the
>> bsdinstall bits
>>
>
> Maybe you mean "/etc/rc.local" there?
>
>
> export TERM=vt220
>>
>> echo "o PC-SYSINSTALL "
>> exec /conf/picker.sh
>>
>
this is a interesting place to start on a custom USB installer, as i Want
to learn more about how make release works, where would I look or rather
what would I modify to get make release generate a larger memstick image,
so that it has a few mb of free space on the image..



> --
>

Sam Fourman Jr.

Warren Block

unread,
Nov 22, 2012, 11:13:15 AM11/22/12
to
On Fri, 16 Nov 2012, Mark Saad wrote:

> The install config
> ------------------------
>
> I created /conf/ada-install.cfg and /conf/da-install.cfg the only
> difference here is the name of the disk as that is not auto
> discovered.
>
> Here is ada-install.cfg
>
> # User Generated pc-sysinstall configuration
> installInteractive=no
> installMode=fresh
> installType=FreeBSD
> installMedium=local
> localPath=/usr/freebsd-dist/
> installFile=fbsd-release.txz
> packageType=tar
>
> hostname=nynewserver1.ops.com
> netDev=AUTO-DHCP
>
>
> # Disk Setup
> disk0=ada0 #Change me to suite your needs

pc-bsdinstall does not seem to like a trailing comment. Moving this
comment to a separate line fixes it.

Another problem is that I've not figured out how to set a root password
in the installer file tree for login after Shell is selected.
Or rather,
pw -V /usr/tftpboot/images/freebsd9-i386/etc usermod root -h 0
changes the password, but something still causes the system to show
"Login incorrect" when it is entered.
0 new messages