Automated Installer Setup And Virtual Box

The best way to investigate and play with a technology is within a virtual environment. So with that in mind I wanted to try and setup an Automated Install (AI) in a VirtualBox environment.

NOTE : Blogs by Chris Armes, Configuring an auto install client / server setup in VirtualBox and Joe Vlcek, Automated Install Using VirtualBox, were used extensively as references in following this process.

NOTE : All of the commands I performed as root. Run following command before starting :

   $ pfexec su

NOTE : One caveat I will mention, I've noticed that getting the network set up correctly BEFORE creating the install service and creating the initial DHCP server settings is vital, and changes to the AI server VM network setup, requires and reset of the DHCP server and the install-services.

1. Create And Install VirtualBox Server VM

Create a new guest VM in VirtualBox for the AI server, with following setup, ensure you configure network interfaces before booting up, Network Adapter 1, should be left as the default value of NAT.

  Name :
    ai-server

  Network Interfaces :
    Adapter 1: Intel PRO/1000 MT Desktop (NAT)
    Adapter 2: Intel PRO/1000 MT Desktop (internal network, 'AI')

  Base Memory :
    1024 MB

Install OpenSolaris 2009.06 or later in this guest. ISO can be got from http://hub.opensolaris.org/bin/view/Main/TryOpenSolaris.

NOTE: Remeber the name you provided when installing as you'll use this later, the default is "opensolaris".

2. Configure AI-Server VM.

Once installed, reboot into the AI-Server VM, and perform the following steps :

2.1. Set preferred pkg repository

By default OpenSolaris install's will point to publisher http://pkg.opensolaris.org/release, if you want to continue using the released repository then thats fine, however I prefer to use the latest dev repository.
   $ pkg set-publisher -O http://pkg.opensolaris.org/dev opensolaris.org
Make sure your preferred publisher is actually working, try doing a simple search to determine if it's contactable and returning information e.g
   $ pkg search -r entire
Should return loads of information, if not you could try the internal only repo http://ipkg.sfbay/dev.

2.2. Install required installadm tools

   Recent Builds of OpenSolaris :
   $ pkg install install/installadm

   Old package name :
   $ pkg install SUNWinstalladm-tools 
   

2.3. Configure network SMF services

By default NWAM is turned on, you need to disable this and enable network/physical:default SMF instead :

   $ svcadm disable network/physical:nwam
   $ svcadm enable network/physical:default

2.4. Configure Network Adapter 1 to be DHCP

   $ ifconfig e1000g0 dhcp
   $ touch /etc/dhcp.e1000g0

Everytime you boot your ai-server VM you will need to ensure this interface is plumbed and the set up for dhcp, I've yet to determine why.

   $ ifconfig e1000g0 plumb
   $ ifconfig e1000g0 dhcp

2.5. Configure Network Adaptor 2, Step 1 : /etc/hosts

Edit /etc/hosts adding the following lines

   10.0.2.15       ai-server
   192.168.2.50    ai-server-private
   192.168.2.60    ai-client0
   192.168.2.61    ai-client1
   192.168.2.62    ai-client2
   192.168.2.63    ai-client3
   192.168.2.64    ai-client4

ai-server is the name I called my Server VM when installing, by default this is called opensolaris. Just check output from uname -n and use the output from that. You can add as many ai-client lines as you like, I just added 5.

Also comment out the lines ::1 and 127.0.0.1 as follows

   #::1 ai-server ai-server.local localhost loghost
   #127.0.0.1   ai-server ai-server.local localhost loghost

2.6. Configure Network Adaptor 2, Step 2 : /etc/netmasks

Edit /etc/netmasks adding the following lines :

   10.0.2.0       255.255.255.0
   192.168.2.0    255.255.255.0

2.7. Configure Network Adaptor 2, Step 3 : hostname.e1000g1

Enter the IP assigned to the server in /etc/hosts into this file:

Enter the server name assigned to interface /etc/hosts :

   $ cat hostname.e1000g1
   ai-server-private

2.8. Configure Network Adaptor 2, Step 3 : ifconfig

   $ ifconfig e1000g1 plumb
   $ ifconfig e1000g1 inet 192.168.2.50 netmask 255.255.255.0 broadcast 192.168.2.0
   $ ifconfig e1000g1 up

2.9. Enable ipv4 fowarding and routing:

   $ routeadm -e ipv4-fowarding
   $ routeadm -e ipv4-routing
   $ routeadm -u

2.10. Ensure Your name service is using DNS on ai-server VM

   $ grep \^ipnodes /etc/nsswitch.conf | grep dns
   ipnodes: files dns # Added by DHCP

   $ grep \^hosts /etc/nsswitch.conf | grep dns
   hosts: files dns # Added by DHCP

2.11. Ensure /etc/resolv.conf contains valid IP's of DNS servers

On ai-server VM :

   $ cat /etc/resolv.conf
   domain ireland.sun.com
   111.111.22.01
   111.111.22.02

NOTE : These IP's are for illustration purposes only, and don't actually exist.

2.12. Ensure dns SMF services are enabled :

   $ svcs dns/client:default 
   online         12:44:41 svc:/network/dns/client:default

   $ svcadm enable network/dns/multicast:default
   $ svcs dns/multicast:default
   online         12:44:41 svc:/network/dns/multicast:default

2.13. Configure NAT and enable ipfilter SMF service

Create /etc/ipf/ipnat.conf :

   $ echo "map e1000g0 192.168.2.0/24 -> 0/32" > /etc/ipf/ipnat.conf

Enable ipfilter SMF service :

   $ svcadm enable network/ipfilter:default

This can sometimes timeout and fail, depending on your hardware setup, to get around this simply increase the start/timeout_seconds SMF property, and try restarting.

   $ svcadm disable network/ipfilter
   $ svccfg -s network/ipfilter setprop start/timeout_seconds = 90
   $ svcadm refresh network/ipfilter
   $ svcadm enable network/ipfilter

2.14. Ensure route:default SMF service is enabled

Ensure route:default SMF service is online :

   $ svcs routing/route:default
   STATE     STIME    FMRI
   online    10:21:13 svc:/network/routing/route:default

If not online then enable it :

   $ svcadm enable /network/routing/route:default

3. Download AI Client Image

Download an AI ISO image to use with your automated install, this can be got from http://www.opensolaris.com/get/index.jsp.

Before downloading I created image and server location areas :

   $ mkdir /export/home/ai-images
   $ mkdir /export/home/ai-servers

Here's a convenient download command :

   $ mkdir /export/home/ai-images
   $ wget http://dlc.sun.com/osol/opensolaris/2009/06/osol-0906-ai-x86.iso 

4. Create Install Service

When creating your first install service you need to supply DHCP network information, e.g -i and -c flags. Subsequent create-service calls do not require this information.

   $ installadm create-service -n osol-0906-x86 -i 192.168.2.60 -c 5 -s /export/home/ai-images/osol-0906-ai-x86.iso /export/home/ai-servers/osol-0906-ai-x86
   Setting up the target image at /export/home/ai-servers/osol-0906-x86 ...
   Registering the service osol-0906-x86._OSInstall._tcp.local
   Creating DHCP Server
   Created DHCP configuration file.
   Created dhcptab.
   Added "Locale" macro to dhcptab.
   Added server macro to dhcptab - ai-server.
   DHCP server started.
   dhtadm: Unable to signal the daemon to reload the dhcptab
   Unable to determine the proper default router
   or gateway for the 192.168.2.0 subnet. The default
   router or gateway for this subnet will need to
   be provided later using the following command:
      /usr/sbin/dhtadm -M -m 192.168.2.0 -e  Router=<address> -g
   Added network macro to dhcptab - 192.168.2.0.
   Created network table.
   adding tftp to /etc/inetd.conf
   Converting /etc/inetd.conf
   copying boot file to /tftpboot/pxegrub.I86PC.OpenSolaris-1
   Service discovery fallback mechanism set up

This will create install service osol-0906-x86. If you wanted to create another service with a different AI Iso Image, e.g. dev-131 you would use the following :

   $ installadm create-service -n dev-131 -s /export/home/ai-images/dev-131.iso /export/home/ai-servers/dev-131
   Setting up the target image at /export/home/ai-servers/dev-131 ...
   Registering the service dev-131._OSInstall._tcp.local
   Service discovery fallback mechanism set up

5. Ensure tftp SMF service is enabled

Initial call to installadm create-service will add an entry to /etc/inetd.conf to start the tftp SMF Service, at this point just make sure it's enabled :

   $ svcs -a | grep tftp
   online   11:46:48 svc://network/tftp/udp6:default

If it's not online then enable it :

   $ svcadm enable network/tftp/udp6:default   

6. Configure DHCP

Run dhcpmgr GUI tool

Select macros tab and double click on the dhcp_macro_osol-0906-x86 to bring up a macro properties dialog ensure the following macros are set :

  Option Name : Router
  Option Value : 192.168.2.50

  Option Name : DNSserv
  Option Value : <IP address(s) from /etc/resolv.conf, space delimeted>

  Option Name : BootSrvA
  Option Value : 10.0.2.15

NOTE : DNSserv will need to be changed when you move the system around to the correct DNS entries specifed in /etc/resolv.conf.

You will need to set these macros for each service that is created using create-service.

7. Verify Install Server Available

Launch browser and browse to http:/localhost:5555, you should see "Index of /" page. You can also use installadm list :

  $ installadm list
  Service Name  Status  Arch Port  Image Path
  ------------  ------  ---- ----  ----------
  osol-0906-x86 on      x86  46501 /export/home/ai-servers/osol-0906-x86
  dev-131       on      x86  46502 /export/home/ai-servers/dev-131

8. Create And Configure VirtualBox Client VM

Create another VirtualBox VM for the client :

  Name :
    ai-client0

  Network Interfaces :
    Adapter 1: Intel PRO/1000 MT Desktop (internal network, 'AI')

  Base Memory :
    1024 MB

  Boot Sequence :
    Network, Floppy, CD/DVD ROM, Hard Disk

You can assign a specific client to use a specific install service using the network adapters MAC address. This can be seen by clicking on advanced when viewing the network adaptor, before the VM guest is started.

To assign this client to the dev-131 install service you would do the following on the server VM, lets assume MAC address is 08:00:27:28:C3:1D :

   $ installadm create-client -n dev-131 -e 08:00:27:28:C3:1D
   Setting up X86 client...
   Service discovery fallback mechanism set up
   Enabled network boot by adding macro named 08002728C31D
   to DHCP server with:
     Boot server IP     (BootSrvA) : 192.168.2.50
     Boot file          (BootFile) : 08002728C31D

Now when you boot the client it will specificaly attempt to install using the dev-131 install service.

9. Boot and Install Client

Start up your new VirtualBox Client, it should boot from the network and get a DHCP address assigned from the ai-server VM, and should present you with a grub menu item to perform an automated install.

10. Amending the default manifest.

For more information see the section "How to change or replace the default manifest?" at http://dlc.sun.com/osol/docs/content/dev/AIinstall/customai.html#changeai.

10.1. Determine the target image path for your specific service :

   $ svccvg -s :/system/install/server:default listprop AI<svcname>/image_path
Where svcname is your newly created install service e.g. :
   $ svccvg -s :/system/install/server:default listprop AIosol-0906-x86/image_path
   AIosol-0906-x86/image_path  astring  /export/home/ai-servers/osol-0906-x86

10.2. Make a copy of the default manifest

   $ cp /export/home/ai-servers/osol-0906-x86/auto_install/default.xml /tmp

10.3. Edit your copied /tmp/default.xml

Ensure <ai_manifest name> tag value remains "default".

Revise <ai_embedded_manifest> and <sc_embedded_manifest> sections as necessary.

To change the publisher from the default of pkg.opensolaris.org/release, simply change the value of <main utl> tag under <ai_pkg_repo_default_publisher>.

  From
   <main url="http://pkg.opensollaris.org/release" publisher="opensolaris.org"/>

  From
   <main url="http://ipkg.sfbay/dev" publisher="opensolaris.org"/>

now using installadm add this new manifest to the service overriding the previous default.xml

   $ installadm add -m /tmp/default.xml -n osol-0906-x86

Installing a new client from this service will now reference the new default.xml manifest.

11. Enabling Debug/Verbose.

When doing an AI install verbose can be enabled, which simply outputs extra debug info to /tmp/install_log. This is achieved via a boot argument on the install client. There are three methods of enabling this.

11.1. Enabling debug at install service creation time

To enable debug output when creating your install service, just use the -b option for installadm as follows :

   $ installadm create-service -n dev-131 -b install_debug=enable -s /export/home/ai-images/dev-131.iso /export/home/ai-servers/dev-131
   Setting up the target image at /export/home/ai-servers/dev-131 ...
   Registering the service dev-131._OSInstall._tcp.local
   Service discovery fallback mechanism set up

Remember any subsequent clients created using installadm create-client for this install service MUST also have the -b install_debug=enable, set via the create-client command line, as it will not be turned on by default. (Potentially a bug).

11.2. Enabling debug for specific client via installadm.

Specific client's can be assigned to boot from specific install servers, this is achieved by associating the clients MAC address with a specific install service, as shown in section 8 above. the create-client installadm subcommand can also take a -b option to specify boot arguments.

   $ installadm create-client -b install_debug=enabled -n dev-131 -e 08:00:27:28:C3:1D
   Setting up X86 client...
   Service discovery fallback mechanism set up
   Enabled network boot by adding macro named 08002728C31D
   to DHCP server with:
     Boot server IP     (BootSrvA) : 192.168.2.50
     Boot file          (BootFile) : 08002728C31D

11.3. Enabling debug via grub menu editing.

For already existing services you can enable debug output by editing the grub menu entry at boot time and adding the boot argument. When the install client gets to grub menu, select grub entry you want to edit and press "e", then press "e" again to edit the kernel line, scroll back using arrow key until you get to "-B". Just after this add " install_debug=enabled,", then press "b" to boot.

12. Troubleshooting

The following is a list of issues that may arise and how one might resolve them.

Auto Install DNS Failure

If client auto install is failing with the following install_log excerpt :

    <TRANSFER_MOD_E Nov  2 06:56:35> pkg image-create: The URI 'http://pkg.opensolaris.org' does not appear to point to a valid pkg server.
    <TRANSFER_MOD_E Nov  2 06:56:35> Please check the server's address and client's network configuration.
    <TRANSFER_MOD_E Nov  2 06:56:35> Additional details:
    <TRANSFER_MOD_E Nov  2 06:56:35>
    <TRANSFER_MOD_E Nov  2 06:56:35> Unable to contact valid package server
    <TRANSFER_MOD_E Nov  2 06:56:35> Encountered the following error(s):
    <TRANSFER_MOD_E Nov  2 06:56:35> Unable to contact any configured publishers. This is likely a network configuration problem.
    <TRANSFER_MOD_E Nov  2 06:56:35> Unable to initialize the pkg image area at /a
    ...
    <AI Nov  2 06:56:36> Automated Installation failed in Transfer module
    <AI Nov  2 06:56:36> Transferring the files from the source failed. Please see previous messages for more details

From within the Vbox Client VM try the following tests :

Is the repository pingable :

   $ ping pkg.opensolaris.org

If you get back: 'ping: unknown host pkg.opensolaris.org' the error may be DNS related.

If you get back: 'no answer from pkg.opensolaris.org' the error may be connectivity related

Is DNS Serer Reachable

Firstly get the server IP addresses via :

   $ grep \^nameserver /etc/resolve
   nameserver 192.168.0.1

Verify the server is reachable by pinging the ip addresses returned :

   $ ping 192.168.0.1
   192.168.0.1 is alive

If you get don't get returned IP is alive, then there is a DNS issue, talk to your DNS/Network administrator.

If /etc/resolv.conf is empty

If /etc/resolv.conf is empty, you can run :
   $ dhcpinfo DNSServ
and see if you get any addresses back. If nothing is returned your DHCP is mis-configured. If address are return, try pinging them as stated above.

DNS Server is alive

If the DNS server was alive, you can see if you are getting the right IP address for pkg.opensolaris.org by running :

   $ getent hosts pkg.opensolaris.org

If the IP address differs from a machine able to go to pkg.opensolaris.org, then you should contact your DNS/network administrator.

If getent is not returning anything, there is a routing issue between your Vbox network and the host network on which VirtualBox is running.

Check the value of the BootSrvA DHCP Macro property for your install service :

   $ dhcpinfo BootSrvA
   10.0.2.15

This should be the IP address of network adaptor 1 on your AI server VM. If not go back to your server, and set this value correctly and refresh the dhcp-server SMF service, and try rebooting the install AI client VM.

Another more extreme method is to re-initialize DHCP and re-install the install services :

Firstly delete the install service :

   $ installadm delete-service osol-0906-x86
   Boot archive /tftpboot/I86PC.OpenSolaris-1 for services is not a mountpoint.
   Boot archive (/tftpboot/I86PC.Opensolaris-1) for service osol-0906-x86 nto in vfstab
   Unable to find path /tftpboot/I86PC.OpenSolaris-1
   To delete DHCP macro, run the following command:
   /usr/sbin/dhtadm -D -m dhcp_macro_osol-0906-x86

Remove dhcp macro for this service :

   $ dhtadm -D -m dhcp_macro_osol-0906-x86

Now unconfgiure the DHCP server settings completly :

   $ dhcpconfig -U -x
   Unconfigure will stop the DHCP service and remove the DHCP configuration file.
   Are you SURE you want to unconfigure the DHCP service? (Y/N): y
   DHCP server shutdown.
   Deleted the server macro from dhcptab.
   Deleted table for network 192.168.2.0.
   Deleted the dhcptab.
   Deleted the DHCP configuration file.

Now recreate the install service and the dhcp starting from Step 4 above, and try booting into the AI client VM again.

Useful Resources

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Install engineer at Oracle who is passionate about Music, Sport and has a soft spot for Solaris

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today