Solaris for the System Administrator

Solaris for the System Administrator

Boot Up/Shutdown

init 0 – power down
init S – single user, all file systems mounted
init s – single user, all file systems mounted
init 1 – administrative state, all file systems mounted, logins allowed
init 2 – multi user, all daemons running except nfs – exports not allowed
init 3 – multi user
init 4 – alternative multi user – unused
init 5 – power down – shutdown and automatically power off if supported
init 6 – reboot

PROM Prompt (ok)

  • If you abort the boot process you will get the PROM prompt
    • Abort key sequence depends on keyboard type (could be:  Stop-A, L1-A or Break)
  • Type “n” at the “>” prompt to get to the “ok” prompt.
  • boot –>  boots to multi user mode
  • boot cdrom  –> boots from cdrom
  • boot -r  –> reconfiguration boot
  • boot -a  –> interactive boot
    • specify kernel or accept default
    • specify modules or accept default
    • specify system file or accept default
    • specify root filesystem or accept default
    • specify physical name of the root device or accept default
  • boot -s –> single user mode

Bootup Files

  • /etc/inittab
  • /sbin/rc*
    • /etc/rc0 – rc5 and rcS
    • These main scripts call the appropriate S and K scripts located in /etc/rc*.d
  • /etc/init.d  –>  linked to /etc/rc.etc
  • /etc/rc*.d
    • Individual start and kill scripts

Bootup Commands

  • telinit 1  –> changes to single user mode
  • telinit 2  –>  changes to muli-user with no NFS
  • telinit 3  –>  changes to multiuser
  • <ctrl> <d>  –> changes from single user mode to multi user mode
  • Forcing a Crash Dump, then rebooting:
    • savecore must be enabled
    • type the stop key sequence
    • at the “ok” prompt type sync  –>  this synchronizes the disk and writes the crash dump, system will reboot when dump is complete
  • Booting with the Kernel debugger
    • type the stop key sequence
    • at the “ok” prompt type sync
    • when the message “syncing file systems . . . ” appears, press the stop key sequence
    • at the “ok” prompt type boot kadb

Shutdown Commands

  • shutdown  –> you will be prompted to confirm the shutdown, system will shutdown to single user state
  • shutdown -y  –> you will not be prompted to confirm, system will shutdown to single user state
  • shutdown -g XXX  –> system will wait XXX seconds to start shutdown
  • shutdown -i6  –> shutdown and reboot
  • uadmin 2 0  –>  shutsdown the system to a powerdown state, PROM prompt is displayed
  • shutdown -s
  • init -s
  • telinit 0 or init 0 –> shutsdown the system from single user mode
  • telinit 6 or init 6  –>  shutsdown and reboots a single user system
  • halt  –> shutsdown immediately, not necessarily cleanly (no warning, no scripts run)
  • reboot  –>  shutsdown and reboots, but not necessarily cleanly (no warning, no scripts run)

SPARC Boot Process

  • Boot PROM  –>  self test
  • bootblk executes –>  primary boot program which loads ufsboot program from UFS filesystem
  • ufsboot executes –>  loads the kernel
  • kernel initialization
  • /sbin/init processes /etc/inittab entries
  • /sbin/rc* scripts are run

IA Boot Process

  • BIOS PROM  –> self test, low level drivers
  • BIOS looks for mboot MBR
  • pboot is loaded from active paration
  • bootblk is loaded by pboot
  • If multiple bootable partions exist bootblk displays Primary Boot Subsystem Menu
  • boobblk starts either boot.bin or ufsboot  –>  this can be interrupted to run the Configuration Assistant
  • command interpreter starts which processes /etc//bootrc script  –>  this provides a menu of boot choices
  • kernel initiailization using either boot.bin or ufsboot to read the files
  • /sbin/init processes the inittab
  • /sbin/rc* scripts are run

IA Boot Menus

  • Primary Boot Subsystem Menu –> If boot disk has multiple partitions
  • Secondary Boot Subsystem  Menu  –>  If boot process is interupted then the Solaris Device Configuration Assistant is run
  • Solaris Device Configuration Asistant Boot Diskette
  • Current Boot Parameters Menu

Console

Using tip (the serial port is connected to another Sun server)

  • tip hardwire
  • ~.  –> end’s session and goes back to prompt
  • ~#  –> Stop A
  • /etc/remote is configuration file

Crontab

See unix.html for crontab basics.

Note:  Solaris defaults to ed when using crontab -e, unless the $EDITOR variable is set to something else, like vi.

ksh  –>  export EDITOR=vi

sh  –>   EDITOR=vi
export EDITOR

Devices

devfsadm  –>  manages special files in /dev and /devices  (boot -r no longer required)

Process to add new hardware:

  • load the device driver
  • shutdown system
  • add new hardware
  • at the PROM ok prompt type “boot -r”

devinfo  –>  prints information about disk devices.

Mounting a cdrom:

  • check to see if volume mangement is running -
    • ps -ef|grep vold
  • If volume management is running then cd will auto mount
  • If volume management is not running then manually mount it
    • ls /dev/dsk/c0*
    • usually t=6 is the cdrom, start with slice =0
    • mount -o ro /dev/dsk/c0t6d0s0 /cdrom
    • share -F nfs -o ro /cdrom

Manually unmounting a cdrom:

  • check to see if volume mangement is running -
    • ps -ef|grep vold
  • If volume management is running then stop it
    • /etc/init.d/volmgt stop
  • umount -f /dev/dsk/c0t6d0s0

Log Files

/var/adm/messages file
/usr/sbin/dmesg  –> obsolete command, can still display boot messages

Network Info

/etc/defaultrouter   –> contains ip address of default router
/etc/inet/netmasks  –>  contains subnet masks for each subnet connected
/etc/nodename  –> contains hostname of server
/etc/hostname.<interface>  –>  contains hostname of server for that interface

Configuring an interface from the command line:

  • Check the existing configuration
    • ifconfig -a
  • If the interface is not in the existing configuration, set it up
    • ifconfig <interface> plumb  –>  Sets up the interface for use, if the ifconfig -a does not show the interface already.
  • Bring the interface up with an ip address and subnet mask
    • ifconfig ge0  10.212.1.241 netmask 255.255.255.0 up

OSI Stack

Check to see if it is running:
ps -ef|grep osi

server:/> ps -ef|grep osi
root 17495 17484  0 13:30:42 pts/3    0:00 grep osi
root  5443  5442  0   Sep 03 ?        0:00 /usr/sbin/osilogd
root  5442     1  0   Sep 03 ?        0:00 /usr/sbin/osinetd

Starting/Stopping
/etc/rc2.d/S90osinet stop
/etc/rc2.d/S90osinet start

Processes

ps -e
ps -el
kill
kill -9

/usr/proc/bin  –> process analysis utilities are located here

  • pcred – credentials
  • pfiles – open files
  • pflags – tracing flags
  • pldd – dynamic libraries
  • pmap – address map
  • prun – restart the process
  • psig – signal actions
  • pstack – hex stack trace
  • pstop – stop the process
  • pstime – time the process
  • ptree – process trees
  • pwait – wait for termination of process
  • pwdx – working directory

priocntl  –> priority control
nice  –>  sets the priority
renice –> changes the priority
pgrep –> shows active processes
pkill  –> kills active processes
pkill -HUP  –> kills and restarts the process
smpatch –> CLI for Solaris Patch Manager Tool

prstat  –> lists processes and % cpu time, continuously like “top”
prstat -n 5 1 1  –> shows top 5 processes using the cpu and only prints out 1 set of statistics, not continuous.

Root Password – Lost

  • Get the machine to the boot prom (ok prompt)
    • init 0
    • halt
    • poweroff?
  • Boot from the cdrom into single user mode
    • boot cdrom -s
  • Mount the root disk
    • mount /dev/dsk/c0t0d0s0 /a
    • If unable to mount the disk
      • fsck /dev/dsk/c0t0d0s0
  • Change to the proper directory
    • cd /a/etc
  • Edit the shadow file
    • TERM=vt100;export TERM
    • vi shadow
  • Replace the root password encryped string with nothing:
    • root:3oWleAoGjh5ls:6445::::::
    • root::6445::::::

Software/Patches

Software Packages

  • Listing installed packages
    • pkginfo
  • Installing packages
    • pkgadd -d <package name>

Solaris Flash Technology

  • Image based snapshots of OS and Patched OS
  • Similar systems are cloned

patchadd -p  –> lists patches on the system
showrev -p –> lists patches on the system

install_mu – script to install maintenance update using patchadd

Get patches from:  http://www.sun.com/sunsolve/patches

Swap Space

/usr/sbin/swap -l   –> lists swap space

swap -s  –>  shows swap space usage

How to add more swap space

  • Create the swap space
    • mkfile <size>[k|b|m] <filename>
  • Activate the swap space
    • swap -a <path><filename>
  • Add entry to /etc/vfstab
    • <path><swapfile> -   -   swap    -       no      -
    • (mount dev,  fsck dev, mount point, fstype, fsck pass, mount at boot,  mount options)

System Information

cat /etc/release  <– shows version of Solaris and the type of hardware such as SPARC

eeprom  –>  displays and allows the administrator to alter the contents of the eeprom configuration variables

uname -X  –>  display os version, kernel id, number of processors and type of machine

prtconf   –> prints system configuration

prtconf -vp| grep banner-name:  –> prints model of server

prtconf -vp| grep Memory  –> prints amount of memory

dmesg –>  collects system error messages

psrinfo  –> prints information about processors
psrinfo -v | grep MHz   –>  prints speed of each processor

sysdef –>  prints current system definition in table form

modinfo  –> displays information about loaded kernel modules

/usr/platform/`uname -i`/sbin/prtdiag  –>  displays system diagnostic information

isainfo -v   –> displays whether the kernel supports 32 bit or 64/32 bit architecture (64 bit kernel is available on Solaris 7 and up)

Local Hard Disk Info
format:
0. c0t10d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
/sbus@3,0/SUNW,fas@3,8800000/sd@a,0
1. c0t11d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
/sbus@3,0/SUNW,fas@3,8800000/sd@b,0
2. c3t5d1 <Symbios-StorEdgeA3500FCd-0301 cyl 8615 alt 2 hd 64 sec 64>    <– NOT Local, but on an external A3500FC array
/pseudo/rdnexus@3/rdriver@5,1
3. c3t5d3 <Symbios-StorEdgeA3500FCd-0301 cyl 8615 alt 2 hd 64 sec 64>
/pseudo/rdnexus@3/rdriver@5,3

cfgadm -alv

SunOS to Solaris Mapping:
SunOS Solaris
1.0
5.0 2.0
5.1 2.1
5.2 2.2
5.3 2.3
5.4 2.4
5.5 2.5
5.5.1 2.5.1
5.6 2.6
5.7 7
5.8 8
9

Tuning/Kernel Parameters

/etc/system

Administration Command

Service command

svcadm

Link aggregation command

dladm

Resources

http://www.wright.edu/~mike.corcoran/htmldocs/systems/solaris/-CIPCZQX01aa9e9de1=02002b0214a8858100000000