Akamit Blog

Enterprise sysadmin's blog

  • You are here: 
  • Home
  • Solaris

Disable ftpaccess in Solaris 10

Posted on April 8th, 2011

You want to get rid of annoying ftp security. Ok. Just tell ftpd not to use /etc/ftp/ftpaccess

# inetadm -m ftp exec="/usr/sbin/in.ftpd -A"

Filed under Solaris | No Comments »

How to determine disk Solaris booted from

Posted on December 18th, 2010

The script parses prconf -pv output to get bootpath variable and converts it to cXtXdX format

#!/bin/sh
BOOTPATH=`prtconf -pv | grep bootpath | tr -d "'" | awk '{print $2}'`
 
if [ -n "`echo $BOOTPATH | grep "/disk"`" ] ; then
   # The bootpath contains "disk," but the /devices block device contains
   # either "sd" or "ssd"
   BOOTPATH=`echo $BOOTPATH | sed 's/disk@//'`
   BOOT_DISK=`ls -l /dev/dsk | sed -e 's/ssd@//' -e 's/sd@//' \
   | grep "$BOOTPATH" 2>/dev/null | awk '{print $9}' | sed 's/s[0-7]//'`
else
   BOOT_DISK=`ls -l /dev/dsk | grep "$BOOTPATH" 2>/dev/null | \
   awk '{print $9}' | sed 's/s[0-7]//'`
fi
 
if [ -n "$BOOT_DISK" ] ; then
   echo "Your boot disk is ${BOOT_DISK}."
else         
   echo "Unable to determine logical boot disk."
fi

Filed under HowTo, Solaris | 1 Comment »

Solaris 10 zone boot problems after global zone patch

Posted on December 15th, 2010

After patching global zone I’ve discovered boot problems in local zones with errors related to local filesystem mounts.

ash-3.00# svcs -x
svc:/system/filesystem/local:default (local file system mounts)
 State: maintenance since Wed Dec 15 10:08:51 2010
Reason: Start method exited with $SMF_EXIT_ERR_FATAL.
   See: http://sun.com/msg/SMF-8000-KS
   See: /var/svc/log/system-filesystem-local:default.log
Impact: 31 dependent services are not running.  (Use -v for list.)

Log file tells that there is some zfs mount issue.

[ Dec 15 10:08:50 Executing start method ("/lib/svc/method/fs-local") ]
Abort - core dumped
WARNING: /usr/sbin/zfs mount -a failed: exit status 134
[ Dec 15 10:08:51 Method "start" exited with status 95 ]

Eventually it was revealed that the zone upgrade was not done, so it can’t boot normally. After detach/attach with upgrade options zone was booted as usual.

bash-3.00# zoneadm -z rtest halt
bash-3.00# zoneadm -z rtest detach 
bash-3.00# zoneadm -z rtest attach -u
Getting the list of files to remove
Removing 1189 files
Remove 24 of 24 packages
Installing 14351 files
Add 142 of 142 packages
Installation of these packages generated warnings: VRTSodm VRTSvxfs
Updating editable files
The file </var/sadm/system/logs/update_log> within the zone contains a log of the zone update.

Filed under Solaris | No Comments »

So, you have a tar file with absolute paths…now what?

Posted on November 11th, 2010

Don’t do it again. :-)
After you have already created one, the easiest way to “un-absolute it” is to use GNU tar. This is the default behavior when creating or extracting files with GNU tar.

You can find GNU tar.

You are welcome.

Another tip came in from Gregory L. White who suggested using pax:

# tar tvf export_home.tar
tar: blocksize = 3
drwxr-x--- 201/1        0 Sep  5 10:16 2003 /export/home/gwhite/x/
 
# pax -r -s ',^/,,' -f export_home.tar
 
# ls
export  export_home.tar

Thanks.

Filed under Solaris | 1 Comment »

Connecting SL500 Library robot to emulex HBA port

Posted on October 25th, 2010

I was managed to setup netbackup server using Sun Enterprise 5120 and SL500 library. The problem was that the robot connection became broken after server reboot and I have to power cycle the library to get the robot appear again. After doing some investigation it was revealed that the robot connection is unstable due to automatic configuration of FC link with Emulex adapter port.
The port instance the robot connected to is 2. We configure the port to force loop topology and 2Gb/s port speed by specifying parameters in emulex driver configuration file /kernel/drv/emlxs.conf

emlxs2-topology=4;
emlxs2-link-speed=2

After reboot we got library connected and not loosing link.

Solaris version:

SunOS backup-machine 5.10 Generic_139555-08 sun4v sparc SUNW,SPARC-Enterprise-T5120

and FC port

HBA Port WWN: 10000000c978d630
        OS Device Name: /dev/cfg/c4
        Manufacturer: Emulex
        Model: LPe11002-S
        Firmware Version: 2.80a4 (Z3F2.80A4)
        FCode/BIOS Version: Boot:5.03a0 Fcode:3.01a1
        Serial Number: 0999BG0-08350000K2
        Driver Name: emlxs
        Driver Version: 2.31t (2009.04.05.14.10)
        Type: L-port
        State: online
        Supported Speeds: 1Gb 2Gb 4Gb 
        Current Speed: 2Gb 
        Node WWN: 20000000c978d630

Filed under Enterprise Backup, Solaris, Sun Hardware, Tape Libraries | No Comments »

Zabbix agent package for Solaris 10

Posted on September 10th, 2010

Hi there!
We are going to create zabbix agent package and use it for installing large number of zabbix clients.
First, download the source package, unpack it and install to some location.
Let’s suppose the location would be /soft/build/zabbix-agent

gunzip -cd zabbix-1.8.3.tar.gz | tar xf -
cd zabbix-1.8.3
./configure --enable-agent --disable-server --prefix=/soft/build/zabbix-agent
make &amp;&amp; make install

Now, copy Zabbix Solaris 10 package source files somewhere, for example to /soft/build/pkgsrc and execute make from there.

bash-2.05# make
echo "i pkginfo" &gt; prototype
echo "i preinstall" &gt;&gt; prototype
echo "i postinstall" &gt;&gt; prototype
echo "i preremove" &gt;&gt; prototype
echo "i postremove" &gt;&gt; prototype
echo "i request" &gt;&gt; prototype
echo PKG=ZABagent &gt; pkginfo
echo NAME=Zabbix agents &gt;&gt; pkginfo
echo ARCH=sparc &gt;&gt; pkginfo
echo VERSION=1.8.2 &gt;&gt; pkginfo
echo CATEGORY=system &gt;&gt; pkginfo
echo BASEDIR=/usr/local &gt;&gt; pkginfo
echo PSTAMP=\"`date '+%m/%d/%Y'`\" &gt;&gt; pkginfo
echo ZABBIX_SERVERS= &gt;&gt; pkginfo
echo SUNW_PKG_ALLZONES=false &gt;&gt; pkginfo
echo SUNW_PKG_THISZONE=true &gt;&gt; pkginfo
pkgproto /soft/build/zabbix-agent=/usr/local &gt;&gt; prototype
pkgmk -o -b /usr/local -r /
## Building pkgmap from package prototype file.
## Processing pkginfo file.
WARNING: missing directory entry for 
WARNING: parameter  set to "none"
## Attempting to volumize 14 entries in pkgmap.
part  1 -- 3784 blocks, 19 entries
## Packaging one part.
/var/spool/pkg/ZABagent/pkgmap
/var/spool/pkg/ZABagent/pkginfo
/var/spool/pkg/ZABagent/root/usr/local/bin/zabbix_get
/var/spool/pkg/ZABagent/root/usr/local/bin/zabbix_sender
/var/spool/pkg/ZABagent/root/usr/local/sbin/zabbix_agent
/var/spool/pkg/ZABagent/root/usr/local/sbin/zabbix_agentd
/var/spool/pkg/ZABagent/root/usr/local/share/man/man1/zabbix_get.1
/var/spool/pkg/ZABagent/root/usr/local/share/man/man1/zabbix_sender.1
/var/spool/pkg/ZABagent/root/usr/local/share/man/man8/zabbix_agentd.8
/var/spool/pkg/ZABagent/install/postinstall
/var/spool/pkg/ZABagent/install/postremove
/var/spool/pkg/ZABagent/install/preinstall
/var/spool/pkg/ZABagent/install/preremove
/var/spool/pkg/ZABagent/install/request
## Validating control scripts.
## Packaging complete.
pkgtrans /var/spool/pkg  Zabbix-agent-sol10-sparc.pkg ZABagent
Transferring  package instance
bash-2.05#

The package will be sitting in /var/spool/pkg. It made zone aware by defining 2 variables in pkginfo file:

SUNW_PKG_ALLZONES=false
SUNW_PKG_THISZONE=true

And will be installed only in zone you are running pkgadd from.

Install it. Example log output follows:

bash-3.00# pkgadd -d /var/tmp/Zabbix-agent-sol10-sparc.pkg 
 
The following packages are available:
  1  ZABagent     Zabbix agents
                  (sparc) 1.8.2
 
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 
 
Processing package instance  from 
## Installing package  in global zone
 
Zabbix agents(sparc) 1.8.2
Enter a zabbix server ip address [no more]:
This is not an IP address.
Enter a zabbix server ip address [no more]: 10.50.2.199
Enter a zabbix server ip address [no more]:
## Processing package information.
## Processing system information.
   1 package pathname is already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
 
The following files are already installed on the system and are being
used by another package:
  /usr/local 
  /usr/local/bin 
  /usr/local/sbin 
  /usr/local/share 
  /usr/local/share/man 
  /usr/local/share/man/man1 
 
Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.
 
This package contains scripts which will be executed with super-user
permission during the process of installing this package.
 
Do you want to continue with the installation of  [y,n,?] y
 
Installing Zabbix agents as 
 
## Executing preinstall script.
## Installing part 1 of 1.
/usr/local/bin/zabbix_get
/usr/local/bin/zabbix_sender
/usr/local/sbin/zabbix_agent
/usr/local/sbin/zabbix_agentd
/usr/local/share/man/man1/zabbix_get.1
/usr/local/share/man/man1/zabbix_sender.1
/usr/local/share/man/man8/zabbix_agentd.8
[ verifying class  ]
## Executing postinstall script.
 
Installation of  was successful.
bash-3.00#

Package will create smf service and start it automatically. Check this out.

bash-3.00# svcs -a | grep zab
online         12:54:10 svc:/application/zabbix-agent:default
bash-3.00#

Next, we are going to automate installation process to avoid asking questions completely. We will use pkgask(1) command for that. First, we create response file which we can use later for automated install.

bash-3.00# pkgask -r /tmp/zab.ask -d /var/tmp/Zabbix-agent-sol10-sparc.pkg 
 
The following packages are available:
  1  ZABagent     Zabbix agents
                  (sparc) 1.8.2
 
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 
 
Processing package instance  from 
## Installing package  in global zone
 
Zabbix agents(sparc) 1.8.2
Enter a zabbix server ip address [no more]: 10.50.2.199
Enter a zabbix server ip address [no more]: 
 
Response file  was created.
 
Processing of request script was successful.

Next, create admin file. Copy sample from default to say /tmp and edit it.

cp /var/sadm/install/admin/default /tmp/zab.admin
vi !$

Make it not to ask anything. For example like this:

ail=
instance=unique
partial=ask
runlevel=ask
idepend=ask
rdepend=ask
space=ask
setuid=nocheck
conflict=nocheck
action=nocheck
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=
basedir=default

And, finally, install the package using admin file and response file we just created.

bash-3.00# pkgadd -d /var/tmp/Zabbix-agent-sol10-sparc.pkg -r /tmp/zab.ask -a /tmp/zab.admin all
 
Processing package instance  from 
## Installing package  in global zone
 
Zabbix agents(sparc) 1.8.2
## Processing package information.
## Processing system information.
   7 package pathnames are already properly installed.
## Verifying disk space requirements.
 
Installing Zabbix agents as 
 
## Executing preinstall script.
## Installing part 1 of 1.
/usr/local/bin/zabbix_get
/usr/local/bin/zabbix_sender
/usr/local/sbin/zabbix_agent
/usr/local/sbin/zabbix_agentd
/usr/local/share/man/man1/zabbix_get.1
/usr/local/share/man/man1/zabbix_sender.1
/usr/local/share/man/man8/zabbix_agentd.8
[ verifying class  ]
## Executing postinstall script.
 
Installation of  was successful.

As you can see no questions was asked at all. So you can use the procedure to do mass installs of the package. You could also download Zabbix Solaris 10 binary package

made using using this instructions.

Tags:
Filed under Installation and Upgrade, Packages, Zabbix | 3 Comments »