compared with
Current by razamatan
on Aug 23, 2014 01:39.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (12)

View Page History
{toc}

While USB and DVD installation are useful for small or non-production deployments, SmartOS is fundamentally designed as a netboot operating system. Advantages of netbooting include:

#!ipxe

kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -B smartos=true
initrd /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive
boot
# SmartOS Root shadow is "root"
:smartos
kernel /smartos/${smartos-build}/platform/i86pc/kernel/amd64/unix -B root_shadow='$5$2HOHRnK3$NvLlm.1KQBbB0WjoP7xcIwGnllhzp2HnT.mDO7DpxYA' smartos=true,root_shadow='$5$2HOHRnK3$NvLlm.1KQBbB0WjoP7xcIwGnllhzp2HnT.mDO7DpxYA'
initrd /smartos/${smartos-build}/platform/i86pc/amd64/boot_archive
boot

title SmartOS Live 64-bit
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -B smartos=true
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive

title Live 64-bit +kmdb
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -kd -B smartos=true
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive

title Live 64-bit Serial (ttyb)
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -B smartos=true,console=ttyb,ttyb-mode="115200,8,n,1,-"
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive

title Live 64-bit Serial (ttyb) +kmdb
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -kd -B smartos=true,console=ttyb,ttyb-mode="115200,8,n,1,-"
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive

title Live 64-bit Serial (ttya)
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -B smartos=true,console=ttya,ttya-mode="115200,8,n,1,-"
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive

title Live 64-bit Serial (ttya) +kmdb
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -kd -B smartos=true,console=ttya,ttya-mode="115200,8,n,1,-"
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive

title Live 64-bit Rescue (no importing zpool)
kernel /smartos/20121004T212912Z/platform/i86pc/kernel/amd64/unix -B noimport=true standalone=true,noimport=true
module /smartos/20121004T212912Z/platform/i86pc/amd64/boot_archive
{noformat}
h1. Kernel Boot Options

Several parameters can and should be passed to the "unix" kernel. These would be coma delimted comma-delimited following "-B", as seen in examples above.

* *smartos=*: If set true and */usbkey/shadow* is present, it will use the root password within */usbkey/shadow*
* *\-kd*: Enable the Kernel Debugger (KMDB); this is typically only used for debugging drivers
* *\-v*: Verbose boot

h1. Alternatives

h2. Stripped down dnsmasq, tftp-hpa, pxegrub

{warning}
The example code in this section uses a very old image and hasn't been tested in a while. If you end up using this section as a guide, try using a modern image. If you succeed, please update the image_uuid.
{warning}

h3. Motivation

So you have a machine running SmartOS from a USB stick or CD.
Wouldn't it be nice to be able to use that machine to PXE boot a whole additional rack of machines?
Here's how to set up a simple PXE server in a SmartOS zone that will serve up... SmartOS\!
{info}
This section assumes some basics covered in other wiki pages.
{info}

h3. Zone Configuration
{code:language=javascript}
{
"alias": "pxe-server",
"hostname": "pxe-server",
"brand": "joyent",
"max_physical_memory": 64,
"quota": 2,
"image_uuid": "f9e4be48-9466-11e1-bc41-9f993f5dff36",
"nics": [
{
"nic_tag": "admin",
"ip": "172.16.0.2",
"netmask": "255.255.255.0",
"gateway": "172.16.0.1",
"dhcp_server": "1"
}
]
}
{code}

{warning}
It's up to you to get the networking right, and not to run multiple DHCP servers on your network in a way that breaks things. BE CAREFUL\!
{warning}

h3. Setting up TFTP

Use zlogin to log into the zone:
{code:language=bash}
zlogin <uuid>
{code}

In the zone:
{code:language=bash}
pkgin -y install tftp-hpa
mkdir /tftpboot
echo "tftp dgram udp wait root /opt/local/sbin/in.tftpd in.tftpd -s /tftpboot" > /tmp/tftp.inetd
svcadm enable inetd
inetconv -i /tmp/tftp.inetd -o /tmp
svccfg import /tmp/tftp-udp.xml
svcadm restart tftp/udp
{code}
The last two commands are probably extraneous.

h3. Setting up DHCP (using Dnsmasq)

{code:language=bash}
pkgin -y install dnsmasq
{code}

{code:title=/opt/local/etc/dnsmasq.conf}
#Lease File to track leases
dhcp-leasefile=/etc/dnsmasq.leases
# Give out addresses in the 172.16.0.1/24 subnet
dhcp-range=172.16.0.10,172.16.0.50,2h
# The name of the boot file is pxegrub
dhcp-boot=pxegrub
{code}

{warning}
It's up to you to get the networking right, and not to run multiple DHCP servers on your network in a way that breaks things. BE CAREFUL\!
{warning}

{code:language=bash}
svcadm enable dnsmasq
{code}

h3. Setting up the tftpboot directory

(Use the pkgsrc wget which can actually validate certificates)
{code:language=bash}
pkgin -y install wget
hash -r
cd /tftpboot
wget https://download.joyent.com/pub/iso/latest.iso
LOFI=$(lofiadm -a latest.iso)
mount -F hsfs $LOFI /mnt
rsync -av /mnt/ .
umount /mnt
lofiadm -d $LOFI
wget -O pxegrub http://aszeszo.googlepages.com/pxegrub
{code}

h2. Integrating SmartOS into an existing PXELINUX environment

The critical detail to know about booting SmartOS from PXELINUX (or SYSLINUX) is that you must use *mboot.c32* to get them to load the kernel and boot_archive using the multiboot specification.
See [http://syslinux.zytor.com/wiki/index.php/Mboot.c32|mboot.c32 documentation] for further details about that.

Recent versions of SYSLINUX require *libcom32.c32* and *ldlinux.c32* to be present to use *mboot.c32*

Instructions:
1. Download the ISO from [http://smartos.org/|smartos.org]
1. Extract the entire *platform* subtree from the ISO.
1. Download a tarball of [http://syslinux.zytor.com/wiki/index.php/Download|SYSLINUX] and get the *mboot.c32*, *libcom32.c32*, and *ldlinux.c32* files out of it.
1. In the tftp root directory, create a directory named *smartos*
1. Copy the *platform* directory you got from the ISO into the *smartos* directory
1. Copy the the *mboot.c32*, *libcom32.c32*, and *ldlinux.c32* files into the *smartos* directory
1. Update your *pxelinux.cfg/default* file with this content:
{code}
default smartos
prompt 1
timeout 50
label smartos
kernel smartos/mboot.c32
append smartos/platform/i86pc/kernel/amd64/unix -B smartos=true,console=text,standalone=true,noimport=true,root_shadow='$5$2HOHRnK3$NvLlm.1KQBbB0WjoP7xcIwGnllhzp2HnT.mDO7DpxYA' --- smartos/platform/i86pc/amd64/boot_archive
{code}