13 Jan 2015

Uploading large files to Oracle using curl.

Uloading large files through the MOS portal doesn't always work out. Use curl to upload the files instead.

curl -T "$UPLOAD" -o "$UPLOAD.out" -u "${USERID}:${UPSWD}" "https://transport.oracle.com/upload/issue/${SR}/${UPLOAD}"

09 Jan 2015

Super Cluster zone unavailable

Sometime after a reboot/crash the zonehome is unavailable.
Follow these steps to bring it back online.

zonecfg -z [ZONENAME] export > $HOME/zones/[ZONENAME].cfg
zfs set setuid=on [ZONENAME]
zfs set devices=on [ZONENAME]
zoneadm -z [ZONENAME] attach
zoneadm -z [ZONENAME] boot

11 Nov 2014

rc script trouble shooting.

Sometime in Soalris 10 the rc scripts fail to work.

Check the following log file for possible errors.


/var/svc/log/milestone-multi-user-server:default.log


10 Nov 2014

View full zone name with the ps command.

ps -efZ truncates the zone name if its more than 8 characters.
In order to see the full zone name use the following command.

ps -eo zone,uid,pid,ppid,time,vsz,rss,comm,args

Check ps man page for all the options that can be used with the -o option.

24 Feb 2012

Locate CD-ROM

Locate newly inserted CD in drive.

rmformat -l
Looking for devices...
     1. Logical Node: /dev/rdsk/c3t0d0p0
        Physical Node: /pci@0,0/pci8086,244e@1e/pci103c,3305@4,4/hub@2/cdrom@2/disk@0,0
        Connected Device: HP       Virtual DVD-ROM     
        Device Type: CD Reader

27 Jul 2011

Get serial number from command line

To obtain the serial number of the server from Solaris command line. HP Blades


/usr/sbin/smbios -t 1

On  linux run

dmidecode -t system

07 Jul 2011

Hanging cron jobs

I found a application user that was using cron  to monitor the app every minute of the day.
At 03H10 the logadm would run and rotates cron's log file. On the odd occasion this would occur the same time the app user runs a script vi cron and cause logadm & cron into a dead lock situation and prevent cron & logadm from processing any further requests.

To fix the  problem search for all PIDs & PPIDs associated with logadm and look for the defunct process's. This would normally indicate the offending process.


for PID in $( ps -ef | grep logad[m] | awk '{print $3}')
do
        PIDS="${PID}|${PID}"
done
ps -ef | egrep "${PIDS}"
 BAD_APP 18635 14216   0        - ?           0:00 <defunct>
    root 14216     1   0   Jul 04 ?           0:07 /usr/sbin/cron
     sys 18632 14216   0        - ?           0:00 <defunct>
     sys 19104 14216   0        - ?           0:01 <defunct>
    root 20894 20090   0 11:33:08 pts/25      0:00 egrep 14216|14216
    root 18629 14216   0   Jul 06 ?           0:00 sh -c /usr/sbin/logadm


Running:

# svcs cron
STATE          STIME    FMRI
online         Nov_02   svc:/system/cron:default   

You will notice all looks well and it is not :-(
Restart cron and all the held back jobs will start running again.

# svcadm restart cron

22 Jun 2011

Keep users history.

Set the default shell that users use to bash.
http://stanlo-solaris.blogspot.com/search/label/useradd


Next add this to your /etc/profile file

HISTTIMEFORMAT='%F %T '
export HISTTIMEFORMAT

Then create a .bash_logout script for the user.
#----------------------------------------------------------
#               Record bash history
#
#       Written : Stan Lovisa
#       Date    : 29-01-2010
#       Mod     :
#
#----------------------------------------------------------
TSATMP=$(date +%Y%M%d-%T)
if [ ! -d ~/.hist ]
then
        mkdir ~/.hist
fi
who am i > ~/.hist/$$.bash_history.${TSATMP}
history >> ~/.hist/$$.bash_history.${TSATMP}
banner bye

Each time the user logs out a history file is created in $HOME/.hist

Sample output:

480  2011-06-21 14:44:24 lr
481  2011-06-21 14:44:29 l tmp/
482  2011-06-21 14:44:35 l dat
483  2011-06-21 14:44:42 cd dat
484  2011-06-21 14:44:44 c
485  2011-06-21 14:44:44 l
486  2011-06-21 14:44:50 l 2011/
487  2011-06-21 14:44:56 ls 2011/
488  2011-06-21 14:45:07 cd ../..
489  2011-06-21 14:45:09 l tmp/
490  2011-06-21 14:45:17 lf tmp
491  2011-06-21 14:45:25 lf /tmp
492  2011-06-21 14:46:05 digs -x 172.19.1.50
493  2011-06-21 18:06:09 . s.bashrc
494  2011-06-21 18:06:20 ssh stl@suse-dell
495  2011-06-22 08:04:00 . s.bashrc
496  2011-06-22 08:04:00 c
497  2011-06-22 08:04:03 history
498  2011-06-22 08:04:13 cd /etc/
499  2011-06-22 08:04:15 vi profile
500  2011-06-22 08:07:38 cd
501  2011-06-22 08:07:41 vi .profile
502  2011-06-22 08:07:53 l
503  2011-06-22 08:07:56 lf
504  2011-06-22 08:08:10 vi .bash_logout
505  2011-06-22 08:11:41 history

useradd

Adding a user in Solaris:
Changing the defaults settings in this file:

/usr/sadm/defadduser

defgroup=1
defgname=other
defparent=/home
defskel=/etc/skel
defshell=/bin/bash
definact=0
defexpire=
defauthorization=
defprofile=
defproj=3
defprojname=
defrole=

I searched hi & lo for this file. I could not find it documented any where, so here it is.

08 Jun 2011

crle

Manage Library path

Display current library paths
crle 
 Configuration file [version 4]: /var/ld/ld.config
  Default Library Path (ELF):   /lib:/usr/lib:/opt/csw/lib
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure  (system default)

Update library path

crle -l /lib:/usr/lib:/opt/csw/lib

12 Apr 2011

pools

Create new pool resources. Limit the number of cpus.

poolcfg -c discover
poolcfg -c 'create pset mypool-pset  (uint pset.min=1 ; uint pset.max=2)'
poolcfg -c 'create pool mypool-pool'
poolcfg -c 'associate pool mypool-pool (pset mypool-pset)'

Create new pool resources.

pooladm -c

View changes.

poolladm | pg

zones: capped resources

Cap memory.

zonecfg -z zone
zonecfg:zone> add capped-memory
zonecfg:zonecapped-memory> set physical=2G
zonecfg:zonecapped-memory> end
zonecfg:zone> verify
zonecfg:zone> commit
zonecfg:zone> exit


To cap the number of cpus.


zonecfg -z zone
zonecfg:zone> add dedicated-cpu
zonecfg:zone:dedicated-cpu> set ncpus=1-2
zonecfg:zone:dedicated-cpu> set importance=10
zonecfg:zone:dedicated-cpu> end
zonecfg:zone> verify
zonecfg:zone> commit
zonecfg:zone> exit

zfs: create new filesystem

Create new filesystem

zfs create tank/data

Set the mount point.

zfs set mountpoint=/data tank/data

05 Jan 2011

Install perl modules on Solaris

- /usr/perl5/bin/perlgcc Makefile.PL
- /usr/sfw/bin/gmake
- /usr/sfw/bin/gmake test
- /usr/sfw/bin/gmake install

15 Jul 2010

pca on Solaris update 09 error

When trying to run pca on Solaris 10/09 I get the following error.

./pca

ERROR: Dummy Wget

To fix:
./pca --wget=/usr/sfw/bin/wget

30 Mar 2010

Network interface's setup


/sbin/dladm show-dev
bge0 link: up speed: 1000 Mbps duplex: full
bge1 link: unknown speed: 0 Mbps duplex: unknown
bge2 link: unknown speed: 0 Mbps duplex: unknown
bge3 link: unknown speed: 0 Mbps duplex: unknown

06 Nov 2009

luxadm probe

Found Fibre Channel device(s):                                                                                                              
  Node WWN:50001fe1501114c0  Device Type:Disk device                                                                                        
    Logical Path:/dev/rdsk/c4t600508B4000901790000C00004AF0000d0s2  


 luxadm display /dev/rdsk/c4t600508B4000901790000C00004AF0000d0s2



Check mpxio setup.


Look in /kernel/drv/fp.conf

Enable snmp

Enabling snmp:

svcadm disable snmpdx

Edit and make what ever changes required.
vim /etc/sma/snmp/snmpd.conf

svcadm restart sma

To test.
snmpwalk -v 2c -c public hostname system

11 Sept 2009

NRPE failed ssl handshake

Can't get nrpe to work but config looks ok.

My remote host is behind a firewall and IP address is nated.

Run dmesg | tail

Get this message (Lots of them):

Sep 11 14:32:56 host nrpe[3321]: [ID 381997 daemon.error] Host 196.4.165.245 is not allowed to talk to us!

Add IP address in nrpe.cfg file:

allowed_hosts=127.0.0.1,xxx.xxx.xxx.xxx,196.4.165.245
 and restart nrpe daemon.

11 Aug 2009

Vim. Open at specific line number

To open a file at specific line number

vim <filename> +<linenumber>

18 Jun 2009

Installed memory

Quick check for memory size

prtconf | awk '/^Memory/ {print $0}'

03 Jun 2009

Setting ulimits in csh

Setting the ulimit nofiles in that cursed csh.

limit descriptors 1024

13 May 2009

Port number to PID

Print out all the PIDs and associated ports.

ps -ef | awk '!/PID/{print $2}' | xargs pfiles 2>/dev/null | awk -F":" '$1~/^[0-9]/{XPID=$1;XCMD=$2};
/port/{print XPID, " ", XCMD, " : \n\t",$0}'

04 May 2009

Zones: Change IP address

To change an IP address of an zone.

zonecfg:z> select net address=[old IP]
zonecfg:z:net> set address=[new IP]
zonecfg:z:net> end
zonecfg:z> commit


Reference: Sun Forums

02 Apr 2009

Contrl-M

Some settings to keep in mind when setting up control-m on Solaris 10

In /etc/profile. Add the following line.

ulimit -n 2048

Then Run these 2 commands.

projadd user.cms63prod
projmod -sK "project.max-shm-memory=(priv,16384MB,deny)" user.cms63prod

19 Mar 2009

HBAs

Querry HBAs.

fcinfo hba-port

fcinfo hba-port -l

fcinfo remote-port -slp WWN

luxadm -e port


24 Jun 2008

DVD burnining

/opt/schily/bin/cdrecord dev=1,0,0 driveropts=help -checkdrive
Cdrecord-ProDVD-ProBD-Clone 2.01.01a35 (i386-pc-solaris2.10) Copyright (C) 1995-2007 Jörg Schilling
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Warning: Using USCSI interface.
Using libscg version 'schily-0.9'.
Device type : Removable CD-ROM
Version : 0
Response Format: 2
Capabilities :
Vendor_info : 'MATSHITA'
Identifikation : 'DVD-RAM UJ-822S '
Revision : '1.61'
Device seems to be: Generic mmc2 DVD-R/DVD-RW/DVD-RAM.
/opt/schily/bin/cdrecord: Cannot load media with this drive!
/opt/schily/bin/cdrecord: Try to load media by hand.
Driver options:
burnfree Prepare writer to use BURN-Free technology
noburnfree Disable using BURN-Free technology

# /opt/schily/bin/cdrecord driveropts=burnfree dev=1,0,0 SUSE11x64.iso
/opt/schily/bin/cdrecord: No write mode specified.
/opt/schily/bin/cdrecord: Asuming -sao mode.
/opt/schily/bin/cdrecord: If your drive does not accept -sao, try -tao.
/opt/schily/bin/cdrecord: Future versions of cdrecord may have different drive dependent defaults.
Cdrecord-ProDVD-ProBD-Clone 2.01.01a35 (i386-pc-solaris2.10) Copyright (C) 1995-2007 Jörg Schilling
scsidev: '1,0,0'
scsibus: 1 target: 0 lun: 0
Warning: Using USCSI interface.
Using libscg version 'schily-0.9'.
Device type : Removable CD-ROM
Version : 0
Response Format: 2
Capabilities :
Vendor_info : 'MATSHITA'
Identifikation : 'DVD-RAM UJ-822S '
Revision : '1.61'
Device seems to be: Generic mmc2 DVD-R/DVD-RW/DVD-RAM.
Using generic SCSI-3/mmc-2 DVD-R/DVD-RW/DVD-RAM driver (mmc_dvd).
Driver flags : NO-CD DVD MMC-3 SWABAUDIO BURNFREE
Supported modes: PACKET SAO
WARNING: Phys disk size 1 differs from rzone size 2298496! Prerecorded disk?
WARNING: Phys start: 196608 Phys end 196608
Starting to write CD/DVD/BD at speed 2 in real SAO mode for single session.
Last chance to quit, starting real write 0 seconds. Operation starts.
Track 01: Total bytes read/written: 4651712512/4651712512 (2271344 sectors).

19 Jun 2008

Dhcp & unknwon host

To fix the problem with unknown host using dhcp in Solaris 10, you need to edit 2 files:

1.) /etc/nodename. Add hostname to this file.
2.) /etc/default/dhcpagent. Edit this file and set this option: REQUEST_HOSTNAME=no

reboot and viola!

12 Jun 2008

Proccess commands

  • pflags: Prints the tracing flags, pending and held signals and other /proc status information for each LWP.
  • pcred: Prints credentials (ie, EUID/EGID, RUID/EGID, saved UID/GIDs).
  • pmap: Prints process address space map.
  • pldd: Lists dynamic libraries linked to the process.
  • psig: Lists signal actions.
  • pstack: Prints a stack trace for each LWP in the process.
  • pfiles: Reports fstat, fcntl information for all open files.
  • pwdx: Prints each process's working directory.
  • pstop: Stops process.
  • prun: Starts stopped process.
  • pwait: Wait for specified processes to terminate.
  • ptree: Prints process tree for process.
  • ptime: Times the command using microstate accounting; does not time children.

Refering site.

15 Apr 2008

GUI Logon

To disable: /usr/dt/bin/dtconfig -d
To enable: /usr/dt/bin/dtconfig -e

Using SMF Ref:

svccfg -s cde-login listprop dtlogin/args
svccfg -s cde-login setprop dtlogin/args = astring: \” \”
svcadm restart cde-login

Other references. [1] [2] [3] [4]

12 Nov 2007

VIM: Slow to startup

Vim takes a long time to start.

Check your $DISPLAY variable is pointing to a valid X-Host.

08 Oct 2007

smbclient 2 Windows 2003 server. Quicky

1.) Update smb.conf file: Global section.
# Global parameters
[global]
workgroup = DOMAIN-NT
security = DOMAIN
server string = Samba %v on %h - Wacky
max log size = 65536
preferred master = No
local master = No
domain master = No
wins server = 192.167.0.4, 192.168.0.6
password server = 192.168.0.4, 192.168.0.6
idmap uid = 20000-29999
idmap gid = 20000-29999
template homedir = /dev/null
winbind enum users = Yes
winbind enum groups = Yes

restrict anonymous = 2
syslog = 1

;client schannel = no
;winbind use default domain = Yes

msdfs proxy = no

2.) Join the domain.

/usr/local/samba/bin/net RPC join -U username
And then
/usr/local/samba/bin/net rpc testjoin

3.) Connect.

smbclient //server/share -U username%password -W DOMAIN-NT
Domain=[DOMAIN-NT] OS=[Windows Server 2003 3790] Server=[Windows Server 2003 5.2]
smb: \>

Done.

20 Jul 2007

Mount an ISO image

lofiadm -a /export/temp/software.iso /dev/lofi/1
mount -F hsfs -o ro /dev/lofi/1 /mnt
mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mnt

mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mnt



Source: http://www.tech-recipes.com/solaris_system_administration_tips218.html

10 Jul 2007

Cron log: Bad user

This happend on Solaris 10 when the user account is locked out.
Change the entry in the shadow file from LK to NP

30 Apr 2007

Performance Tuning

iostat -xnc 10


     cpu
us sy wt id
25 12 14 49
extended device statistics
r/s w/s kr/s kw/s wait actv wsvc_t asvc_t %w %b device
0.3 0.9 3.2 7.9 0.0 0.0 6.0 16.6 1 1 d1
16.3 102.6 3011.8 960.0 0.5 1.0 4.3 8.3 0 48 c4t600C0FF000d0



I/O-Bound System

Field Value sar Option

%busy (% time disk is busy) >85 sar -d

%rcache (reads in buffer cache) low, <85>30 sar -u
fileserver >80

Excessive Swapping/Paging

bswot/s (ransfers from memory to disk swap area) >200 sar -w

bswin/s (transfers to memory) >200 sar -w

%swpocc (time swap queue is occupied) >10 sar -q

rflt/s (page reference fault) >0 sar -t

freemem (average pages for user processes) <100>2 sar -q

%runocc (% run queue occupied and processes not executing) >90 sar -q


Good reference site.


02 Jan 2007

OK Prompt

OK Prompt

Get to the OK prompt from Solaris.

Enter "~ctrl_b"

From the Lom> prompt type "break" and enter.

07 Nov 2006

Can't mount/eject cdrom

The CD is in the drive. You can't see it. you can't mount it, you can't eject it.

Restart vold. Kill -9 does a good job.

Start vold with /etc/init.d/volmgt start