Solaris Release
Get the release of your OS by cat /etc/release:OpenSolaris 2009.06 | Example:
OpenSolaris 2009.06 snv_111b X86 Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms. Assembled 07 May 2009 |
Solaris 10 |
Oracle Solaris 10 9/10 s10s_u9wos_14a SPARC Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. Assembled 11 August 2010 |
System administration
SMF
Enable/disable services
Since Solaris 10, the old (but nice ?) start/stop script in rc?.d have been replaced by SMF, the Service Management Facility.
svcs | |
---|---|
svcs -x | lists services encountering problems |
svcs -a | lists all services including disabled ones |
svcs -l <service> | provides information concerning a specific service
Example: svcs -l svc:/network/routing/ndp:default fmri svc:/network/routing/ndp:default name in.ndpd IPv6 neighbour discovery daemon enabled true (temporary) state online next_state none state_time July 20, 2013 07:52:23 PM CEST logfile /var/svc/log/network-routing-ndp:default.log restarter svc:/system/svc/restarter:default contract_id 63 dependency require_all/refresh svc:/network/routing-setup (online) |
svcadm | |
svcadm enable <service> | to enable a service. e.g svcadm enable svc:/network/samba:default |
svcadm disable <service> | to disable a service. |
svcadm enable -t <service> | temporary enabling/disabling a service (won't persist over reboot) |
svcadm refresh <service> | restart the service |
svccfg | |
svccfg -s <service> setprop <options> | set properties. Eg. svccfg -s svc:/application/x11/x11-server setprop options/tcp_listen = true
Or, for example, get the current keymap layout: svc:/system/keymap:default> listprop keymap/layout keymap/layout astring French svc:/system/keymap:default> exit |
svcprop | |
svcprop <service> | list properties for a given service. eg. $ svcprop svc:/application/x11/x11-server options/default_depth integer 24 options/server astring /usr/openwin/bin/Xsun options/server_args astring "" options/stability astring Evolving options/value_authorization astring solaris.smf.manage.x11 options/tcp_listen boolean true |
OpenSolaris uses the SMF too. It (unfortunately ?) ships with many services and will probably need some tuning if your host is a bit slow. A nice reading on that behalf: Solaris 10 Benchmark v4.0.
Creating a manifest for a new service
See for example the SVN manifest I use.Useful services
Name | Service Name | Comments |
---|---|---|
Apache | Solaris: svc:/network/http:apache2, OpenSolaris: svc:/network/http:apache22 | Enable to set up your own web server |
Avahi Daemon Bridge to Bonjour | svc:/system/avahi-bridge-dsd:default | Disabled. Used by DNS Multicast |
CDE | svc:/application/graphical-login/cde-login:default | Disabled on Solaris: I use gdm. Does not exist on OpenSolaris |
DHCP | dhcpagent | disabled: I use static address |
Fiber Channel | svc:/system/device/fc-fabric:default | Keep enabled or the system won't reboot |
GDM | Solaris: svc:/application/gdm2-login:default, OpenSolaris: svc:/application/graphical-login/gdm:default | enabled |
GSS >API | gss:default | Disable. The GSS API is a security abstraction layer that is designed to make it easier for developers to integrate with different authentication schemes. It is most commonly used in applications for sites that use Kerberos for network authentication, though it can also allow applications to interoperate with other authentication schemes (quoted from Solaris 10 Benchmark v4.0). |
IPFilter's service | ipmon | Enabled. used for zones |
IPv6 neighbour discovery daemon | svc:/network/routing/ndp:default | Disabled. I don't use IPv6 at home ! |
Keyboard defaults | svc:/system/keymap:default | Enabled. If needed, set keyboard layout explicitly to fr.
svc:/system/keymap:default> listprop keymap/layout keymap/layout astring French svc:/system/keymap:default> exit |
Kerberos | svc:/network/security/ktkt_warn:default | "While Kerberos can be a security enhancement, if the local site is not currently using Kerberos then there is no need to enable this service" (according to here) |
metainit | svc:/system/metainit:default | disable. SVM initialization |
metasync | svc:/system/metasync:default | disable. SVM initialization |
MySQL | svc:/application/database/mysql:version_51 | if you don't need MySQL you can safely disable |
Multicast DNS and DNS Service Discovery | multicast:default | disable |
N Port ID Virtualization | svc:/network/npiv_config:default | Do not disable or the syste, won't reboot. N_Port_ID Virtualization (NPIV) is a method for virtualizing a FibreChannel Port. With NPIV, one physical FibreChannel port can obtain many N_Port_IDs. |
PPD Cache Update | svc:/application/print/ppd-cache-update:default | disable |
Rlogin | network/login:rlogin | enable this for rlogin |
Samba | Solaris: svc:/network/samba:default, OpenSolaris: svc:/network/smb/client:default | enabled. On OpenSolaris, the Samba client is necessary for smbfs. |
Sendmail | svc:/network/smtp:sendmail | I don't need it. To remove sendmail packages, pkgrm SUNWsndmu and SUNWsndmr. Beware sendmail is required by fetchmail |
Time Slider | svc:/application/time-slider:default | For ZFS Snapshots |
VNC Configuration | svc:/system/xvm/vnc-config:default | disable |
List of online services
STATE STIME FMRI legacy_run 20:36:20 lrc:/etc/rcS_d/S50yukonx legacy_run 20:36:59 lrc:/etc/rc2_d/S20sysetup legacy_run 20:36:59 lrc:/etc/rc2_d/S47pppd legacy_run 20:36:59 lrc:/etc/rc2_d/S72autoinstall legacy_run 20:36:59 lrc:/etc/rc2_d/S73cachefs_daemon legacy_run 20:37:00 lrc:/etc/rc2_d/S81dodatadm_udaplt legacy_run 20:37:00 lrc:/etc/rc2_d/S89PRESERVE legacy_run 20:37:00 lrc:/etc/rc2_d/S98deallocate disabled 20:36:57 svc:/system/xvm/ipagent:default online 20:36:04 svc:/system/svc/restarter:default online 20:36:05 svc:/network/loopback:default online 20:36:05 svc:/network/datalink-management:default online 20:36:06 svc:/system/filesystem/root:default online 20:36:06 svc:/network/physical:nwam online 20:36:07 svc:/system/scheduler:default online 20:36:07 svc:/system/boot-archive:default online 20:36:07 svc:/system/identity:node online 20:36:14 svc:/system/filesystem/usr:default online 20:36:14 svc:/system/device/local:default online 20:36:14 svc:/system/filesystem/minimal:default online 20:36:15 svc:/system/identity:domain online 20:36:15 svc:/system/hostid:default online 20:36:15 svc:/system/name-service-cache:default online 20:36:15 svc:/system/rmtmpfiles:default online 20:36:15 svc:/system/resource-mgmt:default online 20:36:15 svc:/system/cryptosvc:default online 20:36:15 svc:/network/ipfilter:default online 20:36:15 svc:/milestone/network:default online 20:36:15 svc:/system/sysevent:default online 20:36:16 svc:/system/power:default online 20:36:16 svc:/system/picl:default online 20:36:16 svc:/network/npiv_config:default online 20:36:16 svc:/system/device/fc-fabric:default online 20:36:16 svc:/milestone/devices:default online 20:36:17 svc:/system/manifest-import:default online 20:36:17 svc:/system/coreadm:default online 20:36:17 svc:/network/initial:default online 20:36:18 svc:/network/service:default online 20:36:18 svc:/network/dns/client:default online 20:36:18 svc:/milestone/name-services:default online 20:36:19 svc:/network/smb/client:default online 20:36:20 svc:/system/keymap:default online 20:36:20 svc:/milestone/single-user:default online 20:36:24 svc:/network/routing-setup:default online 20:36:24 svc:/network/routing/ndp:default online 20:36:55 svc:/system/filesystem/local:default online 20:36:56 svc:/system/sysidtool:net online 20:36:56 svc:/network/shares/group:default online 20:36:56 svc:/system/boot-archive-update:default online 20:36:56 svc:/system/cron:default online 20:36:56 svc:/network/shares/group:zfs online 20:36:56 svc:/network/rpc/bind:default online 20:36:56 svc:/application/stosreg:default online 20:36:56 svc:/system/sysidtool:system online 20:36:56 svc:/milestone/sysconfig:default online 20:36:56 svc:/system/sac:default online 20:36:57 svc:/system/dbus:default online 20:36:57 svc:/system/utmp:default online 20:36:57 svc:/system/filesystem/autofs:default online 20:36:57 svc:/network/inetd:default online 20:36:57 svc:/system/console-login:default online 20:36:57 svc:/system/filesystem/zfssnap-roleadd:default online 20:36:57 svc:/system/dumpadm:default online 20:36:57 svc:/application/desktop-cache/mime-types-cache:default online 20:36:58 svc:/application/desktop-cache/gconf-cache:default online 20:36:58 svc:/system/postrun:default online 20:36:58 svc:/application/desktop-cache/input-method-cache:default online 20:36:58 svc:/application/desktop-cache/pixbuf-loaders-installer:default online 20:36:58 svc:/application/opengl/ogl-select:default online 20:36:58 svc:/network/rpc/smserver:default online 20:36:58 svc:/network/login:rlogin online 20:36:58 svc:/application/pkg/update:default online 20:36:59 svc:/system/system-log:default online 20:36:59 svc:/network/ssh:default online 20:37:00 svc:/application/desktop-cache/desktop-mime-cache:default online 20:37:00 svc:/milestone/multi-user:default online 20:37:01 svc:/system/intrd:default online 20:37:01 svc:/system/fmd:default online 20:37:01 svc:/milestone/multi-user-server:default online 20:37:03 svc:/system/zones:default online 20:37:03 svc:/application/font/fc-cache:default online 20:37:10 svc:/application/desktop-cache/icon-cache:default online 20:37:12 svc:/system/filesystem/zfs/auto-snapshot:daily online 20:37:13 svc:/system/filesystem/zfs/auto-snapshot:monthly online 20:37:13 svc:/application/graphical-login/gdm:default online 20:37:13 svc:/network/http:apache22 online 20:37:13 svc:/system/filesystem/zfs/auto-snapshot:weekly online 20:37:19 svc:/system/hal:default online 20:37:19 svc:/system/filesystem/rmvolmgr:default online 20:37:28 svc:/system/filesystem/zfs/auto-snapshot:frequent online 20:37:28 svc:/system/filesystem/zfs/auto-snapshot:hourly online 20:37:28 svc:/application/time-slider:default
Inetadm
Get status of an inet service:inetadm | grep ftp disabled disabled svc:/network/ftp:defaultEnable an inet service:
pfexec inetadm -e ftp $ inetadm | grep ftp enabled online svc:/network/ftp:default
System Admin GUIs
The host can be graphically administered using:
- SMC (Solaris Management Console): user management, hosts editing, cron batches, SMF. Launch /usr/sadm/bin/smc. On Solaris only (not OpenSolaris).
- Webmin: web-based administration. Pretty good.
- Visual Panels: this is an additional piece of software. I'm not a fan, but it's there if you want it.
User management
How to add a new user
To add a new user,
- use the graphical Solaris Management Console (smc&)
- or manually:
- make sure the home dir exists and is readable by the group,
- then type:
useradd -d <homedir> -g <group> -s /usr/bin/bash <username>
Allow a user for pfexec
# cat /etc/security/exec_attr | grep "Primary" Primary Administrator:suser:cmd:::*:uid=0;gid=0 # usermod -P'Primary Administrator' testuser
Logs
/var/adm/messages | |
/var/cron/log | Cron's log. Will also log auto snapshot actions. |
/var/adm/sulog | Successful or failed su logins |
/var/log/syslog |
Authentication
Log failed logins
Set SYSLOG_FAILED_LOGINS in /etc/default/login
Password policy
The password policy is configured in /etc/default/passwd. The default settings are reasonable. Several parameters are commented out, but they have a default value. On the contrary, an unsecure setting could be as follows:
MAXWEEKS= MINWEEKS= PASSLENGTH=4 HISTORY=0 MINDIFF=0 MINDIGIT=0
See more information here.
Automatic login
On Solaris 10, to have the host automatically log in as a given user:
# gdmsetup & --> set up for user you wish to log in # vi /etc/X11/gdm/gdm.conf ... SystemMenu=true # /etc/init.d/dtlogin stop # /usr/dt/bin/dtconfig -d # svcadm enable gdm2-login
Now, automatic login is a bit disappointing, because you still have to provide user's password...
On OpenSolaris 2008.11, no such issue ! Use gdmsetup and it works.
Whoami
An alternative to whoami is/usr/xpg4/bin/id -un
System Path
The default path for Solaris 10 should be set in /etc/default/login:
PATH=/usr/sfw/bin:/opt/csw/bin:/usr/sbin:/sbin:/usr/bin:/usr/openwin/bin SUPATH=/usr/sbin:/usr/bin
PATH is the default path for users.
SUPATH is the default path for root when running su.
Both paths are overriden by user's .profile, .login, .cshrc or .bashrc. So, check those files out too.
System Locale
Locales are a complicated matter I haven't completely grasped yet ;) I would recommend using UTF-8 as much as possible as it supports English and French characters, but UTF-8 will only work if the application supports it. For example, xterm do not support UTF-8 (I read there is a workaround using efonts but I haven't tested). Urxvt does.If setting locale to UTF-8 fails, ISO Latin 15 (ISO-8859-15) is a good alternative to display French accents and euro symbol.
The main locale environment variables are:
- LANG: general language specification
- LC_ALL: language setting. If not empty, overrides LANG and other LC_ variables
- LC_MESSAGES: compilation warnings, errors in the specified language
$ locale LANG=C LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_ALL=If a user wishes to customize its locale, he/she should usually set LANG (or individually, each LC_ variable). However, this setting is not persistent: it must be added to user's .bashrc.
Those settings may affect locale-dependant applications. For instance, to launch Thunderbird with English menus but French accents supports, set LANG to en_US.UTF-8. To use Thunderbird with French menus: fr_FR.UTF-8.
To set the system's locale, modify the settings in /etc/default/init and reboot:
LANG="en_US.UTF-8" LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C"
This does not occur any longer once I set all LC_ variables to C except LANG to en_US.UTF-8 in /etc/default/init.
LANG="en_US.UTF-8" LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C"
Setting the System Date
To set/correct time, do:
date -s 1334
to set clock to 13:34.
To set the timezone, use the tzselect utility. Alternatively, it is possible to do:pfexec /usr/sbin/rtc -z Europe/Paris
Networking
To restart the network:svcadm restart svc:/network/physical:nwam
- To add a new computer, use the Solaris Management Console, Computers & Network, Computers, then selection Action / Add Computer. This basically adds an entry to /etc/hosts.
- Check out files /etc/hostname, /etc/hostname.<SOMETHING> (hme0, yukonx...), /etc/nodename, /etc/inet/hosts, /etc/inet/ipnodes.
- List possible interfaces: ifconfig -a plumb, then ifconfig
- List routes: routeadm
- GUI: network-admin
Set a static IP address
Specifying a static IP address consists in:
- ethernet interface: an ether interface must exist and be named. I use the default name for mine: yukonx0
- make sure the networking service is enabled: either physical:default or physical:nwam. The former is the most 'basic' networking service. The latter is a networking daemon that automatically configures your host. It's worth a try: on my OpenSolaris host, it worked straight out of the box and I consequently did not have to configure networking manually. On Solaris u5, however, I had to do it manually.
- configure a few files (with nwam, most of these steps should be automatically done):
- /etc/hostname.<INTERFACE NAME>: specify your host's name:cify your host's name:
$ more /etc/hostname.yukonx0 boureautic
- /etc/hosts: set the loopback address and your static IP address:
$ cat /etc/hosts # # Internet host table # #::1 localhost loghost boureautic 127.0.0.1 localhost loghost 192.168.0.2 boureautic
- /etc/resolv.conf: set the appropriate DNS servers (those are the ones used by Free):
nameserver 212.27.40.240 nameserver 212.27.40.241
- /etc/nsswitch.conf: make sure the line hosts sets "files" before "dns".
hosts: files dns
- for physical:default, set the default gateway: route add default 192.168.0.254. And then, automatically add the route at each reboot writing a script /etc/rc2.d/S99route
- For a manual try, add the network interface with ifconfig:
ifconfig yukonx0 192.168.0.2 netmask 255.255.255.0 up
Eavesdropping network packets
No need to install Ethereal: on Solaris, there's snoop. Example 1:pfexec snoop 192.168.0.2 and 192.168.0.3 and tcp > trace.txtThis will record all TCP packets which mention 192.168.0.2 and 192.168.0.3. Example 2:
pfexec snoop -d yukonx0 -o smbfs.snoop 192.168.0.2 and 192.168.0.3 and tcpThe output is written to smbfs.snoop, and we listen only on network card yukonx0.
Enable Rlogin
To add the rlogin network service:
svcs -l rlogin svcadm enable network/login:rlogin
Note that svcadm enable -t network/login:rlogin only performs a temporary enable of rlogin (won't persist over reboot).
X
Display windows remotely
This is basic on X Window, but from time to time I however encounter problems to do it.
For remote display:
export DISPLAY=:0.0
Also use /usr/openwin/bin/xauth list to list which entities are authorized.
XScreensaver
There's a known bug on Solaris 10 u5: when you log on, a message is displayed: “failed to execute child process “xscreensaver” (no such file or directory) screesaver functionality will not work in this session”.
To get rid of this message, do
ln -s /usr/openwin/bin/xscreensaver /usr/bin/xscreensaver
GDM
To add FVWM to possible sessions, modify /usr/share/xsessions/fvwm.desktop[Desktop Entry] Encoding=UTF-8 Name=FVWM Name[fr]=FVWM 2.5.26 Comment=This session logs you into FVWM 2.5.26 Exec=/usr/local/bin/fvwm Icon= Type=Application
On Solaris 10, stop dtlogin to use gdm:
# /etc/init.d/dtlogin stop # /usr/dt/bin/dtconfig -d # svcadm disable cde-login # svcadm enable gdm2-login
On OpenSolaris 2008.11, gdm refers to the service svc:/application/graphical-login/gdm:default. There is no CDE login.
On OpenIndiana, to add FVWM as a possible session, edit .dmrc:
[Desktop] Session=fvwm Language=C Layout=
XDMCP
To configure XDMCP, launch gdmsetup then click on the remote tabs and activate 'same as local'.
The logs of XDMCP are sent to the console. Make sure that only GDM is launched not also CDE (disable service cde-login for gdm2-login).[xdmcp] Enable=true DisplaysPerHost=2
Fonts
- To display usable fonts, use xfontsel
- To use a given font in a xterm, use -fn:
xterm -fn -*-fixed-medium-*-*-*-14-*-*-*-*-*-*-* &
or create an ~/XTerm file (or in ~/.Xdefaults) and specify the fonts, size (etc) you wish to use:
XTerm*font: 9x15corresponds to:
xterm -font 9x15 &Fonts are typically located in /usr/X11/lib/X11/fonts/misc/
Software Management
Package management | Typical install directories | Local package database | Comments |
---|---|---|---|
pkgadd etc | /usr, /usr/sfw, /opt/sfw | /var/sadm/pkg | Default package management utility on Solaris. Does not handle dependencies. SUN's packages are prefixed by SUNW (eg SUNWvbox). |
pkg-get | /opt/csw | "Old" Blastwave package management. Close to apt-get. Handles dependencies. Blastwave's package are prefixed by CSW (eg CSWperl). | |
pkgutil | /opt/csw | New Blastwave package management. Close to apt-get. Handles dependencies. Install using pkgadd -d http://get.opencsw.org/now, which fetches CSWpkgutil. To install the new PKI: /opt/csw/bin/cswpki --import --force |
|
pkg | New package management of OpenSolaris. I don't like it very much, it takes ages to run. Packages are prefixed with IPS (eg IPSgnutls) |
Commands | Solaris | pkg-get | pkgutil | IPS (OpenSolaris) |
---|---|---|---|---|
Add / Install | pkgadd -d <unzipped-package> 1/ unzip the package (gunzip, bunzip2, unzip...) and 2/ pkgadd. |
pkg-get install <blastwave-package> (automatically downloads and installs dependencies) | pkg install <IPS package> | |
Remove | pkgrm packagename | pkg-get remove packagename | ||
Upgrade | pkg-get upgrade packagenameThis will upgrade all packages for which a new version exists. It consists in uninstalling the old version (remove) and then installing the new version (install). At first, seeing a remove operation may be surprising, but in the end, it works. |
|||
Get package details | pkginfo -l packagename$ pkginfo -l SUNWopenssl-commands PKGINST: SUNWopenssl-commands NAME: OpenSSL Commands (Usr) CATEGORY: system ARCH: i386 VERSION: 11.11,REV=2008.10.30.20.37 VENDOR: Sun Microsystems, Inc. DESC: OpenSSL Commands (Use) HOTLINE: Please contact your local service provider STATUS: completely installed |
pkg info package
$ pkg info -l SUNWxwplt Name: SUNWxwplt Summary: X Window System platform software Category: System/X11 State: Installed Publisher: opensolaris.org Version: 0.5.11 Build Release: 5.11 Branch: 0.111 Packaging Date: Fri May 8 16:45:51 2009 Size: 14.34 MB FMRI: pkg:/SUNWxwplt@0.5.11,5.11-0.111:20090508T164551Z |
||
List contents of a package | pkgchk -l <package> (also lists details) | pkg contents <IPS package> Example: pkg contents xsane/sane-backends usr/lib/sane/libsane-pixma.so.1 usr/lib/sane/libsane-pixma.so.1.0.19 usr/share/man/man5/sane-pixma.5 |
||
Search in which package a command belongs to | grep xxx /var/sadm/install/contents or /usr/sbin/pkgchk -l -p thecommand | pkg search -r <command> | ||
Search for packages starting with a given name | pkgutil -a blah | |||
List all available packages on the server | pkgutil -l | |||
Locate software repositories | pkg publisher | |||
Verify an installation | pkg verify package This will tell you for instance if a link is broken: pkg verify web/browser/firefox PACKAGE STATUS pkg://openindiana.org/web/browser/firefox ERROR link: usr/bin/firefox Target: '/opt/sfw/lib/firefox/firefox' should be '../lib/firefox/firefox' |
There's a nice comparison between Debian's apt-get and IPS or pkgadd / IPS: here.
Patches
I encountered a serious problem with patches: I patched the system with security or recommended patches, some of those patches failed, and then at the next reboot: kernel crash (impossible to boot, except in single user mode). So beware... See Sun's Forums and Google Groups: looks like others encountered the same problem…
pkg-get
To install pkg-get,- Get pkg-get from Blastwave.
- Install it: pkgadd -d pkg_get-3.8.4-SunOS5.8-all-CSW.pkg. The procedure is perfectly described on Blastwave's site. Check its digest with:
digest -v -a md5 pkg_get.pkg
- Then configure it in /opt/csw/etc/pkg-get.conf. Set up the mirror to use, the tree version (stable, unstable, testing), and the download directory (by default: /var/pkg-get/donwloads).
url=http://ibiblio.org/pub/packages/solaris/csw/unstable PKGGET_DOWNLOAD_DIR=/tmp
- Then use pkg-get to install Blastwave packages.
pkgutil
Blastwave has recently replaced pkg-get by pkgutil. To install pkgutil,
- get the package
- do: pkgadd -d <pkgutil-pkg>
- then use pkgutil to handle other packages.
Using other packages
Unpack a debian package:
/usr/xpg4/bin/ar x package.deb gunzip data.tar.gz tar -xvf data.tar
Kernel module
- List which kernel module is installed: modinfo
- Load a kernel module: modload
Developer's corner
Bash
export PATH=/usr/bin/amd64:$PATH:/opt/csw/bin:. export PS1="[\u@\w] "
PS1='${LOGNAME}@$(/usr/bin/hostname):$( [[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " || printf "%s" "${PWD/${HOME}/~}\$ ")' export PATH=$PATH:/usr/local/bin:/usr/share/bin
32-bit vs 64-bit
To know whether your architecture is 32 or 64 bit: isainfo -b
There's a very interesting article on Blog'o thnet.
To summarize, on 64-bit processors, the kernel, device drivers and some key applications (or those with a high performance issue) are 64-bit, but all other applications are usually 32-bit. There are no emulation libraries on Solaris 64 to run 32-bit libraries: there are two different system calls.
To check whether a given application is 32 or 64 bit, run file:
$ file /usr/bin/amd64/ls /usr/bin/amd64/ls: ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, stripped
This also means that on 64-bit hosts, you should set your PATH to locate 64-bit applications before 32-bit ones. For example /usr/bin/amd64 should be set before /usr/bin.
Compilers etc
- no need to install a gcc package (such as CSWgcc) because gcc is usually installed by default in /usr/sfw (mine is version 3.4.3).
- no need to install gmake (3.80) either: it's already installed in /usr/sfw.
- put /usr/sfw/bin at the top of your path, and remove /usr/ucb (or leave it at the end of your path - because it points to an 'old' cc).
- install Sun Studio to get cc (among other things). Actually, cc is said to be better than gcc (faster code), but gcc is perhaps better known by GNU/Free addicts. Anyway, if cc is installed, add /opt/SUNWspro/bin to your path.
For example,
export PATH=/usr/bin/amd64:/usr/sfw/bin:/opt/csw/bin:/usr/ccs/bin:/usr/openwin/bin:/usr/bin:/bin:. export LD_LIBRARY_PATH=/usr/sfw/lib/amd64:/lib/amd64:/usr/lib/amd64:/usr/sfw/lib:/lib:/usr/lib:/opt/csw/lib:. export MAKE=gmake
Library path
According to Rich Teer's article, programs should actually be linked with the -R option. This strategy reduces the need for a LD_LIBRARY_PATH.
However, in situations where the program hasn't been linked that way, there are 2 different ways to configure your library path on Solaris:
- set the common LD_LIBRARY_PATH and LD_LIBRARY_PATH_64 environment variables
- or use the crle (Configuration Runtime Linker Environment) command.
To list your current paths: crle or crle -64 To set new paths: crle -l <a path> -l <another path> …
Typical required paths are: /lib, /usr/lib, /opt/csw/lib, /opt/SUNWspro/lib.