Solaris 10 HANDBOOK

por | 18 marzo, 2008

Solaris 10

  • admintools is not implemented
  • pkgchk -P instead of grep /var/sadm/install/contents
  • RBAC: Role-Based access control (kind of built in sudo)

Solaris management commands

smc Starts the Solaris management console
smcront Manage cron jobs
smdiskless Manage diskless client support
smexec Manage entries in the exec_attr database
smgroup Manages group entries
smlog Manages and views WBEN log files
smmultiuser Manages bulk operations on multiples accounts
smosservice Add OS services and diskless client support
smprofile Manages profiles in the prof_attr and exec_attr db
smrole Manages roles and users in role accounts
smserialport Manages serial ports
smuser Manages user entries

how to Reboot / Halt / Poweroff

On Solaris using the shutdown command to reboot, halt or power off your server is the best option, because this command will call the rc script.

Reboot

shutdown -i6 -g60 -y

-i : init level
-g : grace time (60 secondes in this case)
-y : Pre-answer yes

Halt

shutdown -i0 -g60 -y

Power Off

shutdown -i5 -g60 -y

How to send a break on Solaris 10 x86

You will have to boot the system with «kadb».

From the command line

# eeprom boot-file=kadb
# reboot

OR

From the GRUB boot prompt choose edit and edit the second line

root (hd0,0,a)
kernel /platform/i86pc/multiboot kadb
module /platform/i86pc/boot_archive

Drop to kadb, generate a core file

From a directly attached keyboard or serial port connection, type:

 F1-A - press the "F1" and "A" keys, simultaneously. 

You can test it to make sure it’s work and then just enter:

:c

to return to the normal mode.

The control-alt-d key sequence also works.

Once at the kadb prompt, type:

$<systemdump

This will generate a core file, which can be retrieved from:

 /var/crash/'uname -n' (or wherever the local system stores core files)

How to determine 32-bit or 64-bit?

How to determine whether a system has 32-bit or 64-bit solaris capablilities enabled

# isainfo -v
32-bit sparc applications

How to display the native instruction sets executable?

Isalist prints the names of the native instruction sets executable on this platform on the standard output

# isalist 
sparcv8 sparcv8-fsmuld sparcv7 sparc

How to displays information about processors?

# psrinfo -v
Status of processor 0 as of: 01/24/07 13:03:35
  Processor has been on-line since 01/19/07 14:13:09.
  The sparc processor operates at 60 MHz,
        and has a sparc floating point processor.

How to find out if the the third processors is up?

if [ "`psrinfo -s 3 2> /dev/null`" -eq 1 ]
     then
          echo "processor 3 is up"
     fi

How to display solaris relase information?

# cat /etc/release 
                       Solaris 8 10/00 s28s_u2wos_11b SPARC
           Copyright 2000 Sun Microsystems, Inc.  All Rights Reserved.
                            Assembled 31 August 2000

How to display a system’s installed memory?

# ptrconf
System Configuration:  Sun Microsystems  sun4m
Memory size: 128 Megabytes
System Peripherals (Software Nodes):

SUNW,SPARCstation-20
...

Howto show machine and software revision information

# showrev
Hostname: clust01
Hostid: 7235260f
Release: 5.8
Kernel architecture: sun4m
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain: 
Kernel version: SunOS 5.8 Generic 108528-03 August 2000

Howto show patched installed list

# showrev -p | more 
Patch: 109965-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWpamsc
Patch: 109618-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWeuxwe, SUNWeuezt, SUNWeudlg, SUNWeudda
Patch: 108725-02 Obsoletes: 109579-01 Requires:  Incompatibles:  Packages: SUNWcsu, SUNWcsr, SUNWhea
Patch: 108825-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu
Patch: 108875-07 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu, SUNWcsr, SUNWcsl, SUNWarc, SUNWcstl, SUNWhea
Patch: 108899-01 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu
Patch: 108982-05 Obsoletes: 109440-01 Requires:  Incompatibles:  Packages: SUNWcsu, SUNWhea
Patch: 108985-02 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWcsu
Patch: 109043-02 Obsoletes:  Requires: 109041-01 Incompatibles:  Packages: SUNWcsu
Patch: 109045-02 Obsoletes:  Requires: 109041-01 Incompatibles:  Packages: SUNWcsu

How to display locales installed on a system (solaris 10)

# localeadm

How to determine if a local is installed on a system (solaris 10)

 
# localeadm -q

Display host id number

# hostid 
723560f

How to display the user ownership of local UFS

# quot -a 
/dev/rdsk/c0t1d0s0 (/):
834291  root    
312013  bin     
  812   uucp    
  146   adm     
   91   lp      
   22   nobody  
    4   daemon  
    3   listen  
/dev/rdsk/c1t1d0s0 (/opt):
538104  root    
66742   bin     
 2168   #3792    
/dev/rdsk/c0t1d0s7 (/export/home):
    9   root    

Howto configuring Telnet / FTP to login as root?

Now before getting into the details of how to configure Solaris for root logins, keep in mind that this is VERY BAD security. Make sure that you NEVER configure your production servers for this type of login.

Configure Telnet for root logins

Simply edit the file /etc/default/login and comment out the following line as follows:

# If CONSOLE is set, root can only login on that device.
# Comment this line out to allow remote login by root.
#
# CONSOLE=/dev/console

Configure FTP for root logins

First remove the ‘root’ line from /etc/ftpusers.
Also, don’t forget to edit the file /etc/ftpaccess and comment out the ‘deny-uid’ and ‘deny-gid’ lines. If the file doesn’t exist, there is no need to create it.

NOTE: If you are using Solaris 9 or Solaris 10, the ftp* files are located in /etc/ftpd

How to setup timezone?

/etc/TIMEZONE

Howto setup nis client?

  • set the domain name
domainname nis.domaine.com
  • edit /etc/hosts
#
# Internet host table
#
127.0.0.1       localhost

# NIS 
192.168.1.100 nis1.domain.com
192.168.1.101 nis2.domain.com
  • ypinit
ypinit -c

pkgadd common mistake

In this example I’m trying to install the package «SUNWbash» but it could be any package, you may have been through those different cases:

# pkgadd SUNWbash                                        
pkgadd: ERROR: no packages were found in </var/spool/pkg> 
 
# pkgadd ./SUNWbash                                        
pkgadd: ERROR: no packages were found in </var/spool/pkg> 
 
# pkgadd /mnt/Solaris_10/Product/SUNWbash       
pkgadd: ERROR: no packages were found in </var/spool/pkg>
 
# pkgadd -d ./SUNWbash
pkgadd: ERROR: no packages were found in </mnt/Solaris_10/Product/SUNWbash>

In the three first cases «pkgadd» looks in the default folder «/var/spool/pkg» in order to find packages and install them but none is found. In the fourth case the package himself is defined as a folder containing packages, that’s why it fails.
The right solution is:

# pkgadd -d /mnt/Solaris_10/Product/ SUNWbash
or 
# pkgadd -d $PWD SUNWbash

Thus pkgadd will consider «/mnt/Solaris_10/Product/» as default folder and «SUNWbash» as package to install.

Where is the packages folder

/var/sadm/pkg/

Package installed

/var/sadm/install/content

Which package owns an installed file

pkgchk -l -p /usr/bin/ls

If you cannot access your sun box, ssh/ftp/console whatever

Then try and issue a break from the console.

telnet> sent brk
Type  'go' to resume
{0} ok
{0} ok boot -s
Resetting ...

OBP Quick Memo

SEND A BREAK

From a telnet session:

ctrl+]
send brk

From a ssh session:

~break

Quick memo

help (show categories)

help sys (show sys help)

printenv (varible name and status)

setenv (to change)

setenv auto-boot? true

banner (show the mac address)
 
prob-scsi-all (find all scsi devices, show number off harddrives)

boot -s ( single user mode)
boot cdrom -s (boot single user mode from the cdrom)
boot net (boot network)

boot net:dhcp - install (Boot install using jumpstart with DHCP)

boot net - install (Boot install using jumpstart with Bootp)

boot cdrom - install (Boot install using the cdrom)

devalias (same as /etc/path_to_inst)

devalias toto /sbus/SUNW,fdtwo

show-devs (show all dev)

show-nets (show net interface)


set-default

From the running os:

eeprom