OpenSolaris

You are not signed in. Sign in or register.

Newbie FAQ

Here are some questions and answers to frequent questions from folks coming from Linux or who haven't played with Solaris in a long time:

How do I find stuff?

When I think of the way SystemV should look, Solaris just seems to be the model. Some basic overview of filesystem layout:

  • /etc, /proc, /devices, /dev: Samo samo, you know what these are
  • /export: More common on Solaris than Linux, typically this is where "everything else" goes. Some people even put local (non-automounted) home directories here.
  • /opt: Applications, just like Linux this is where you'd typically find 3rd Party installed applications
  • /usr/bin, /usr/sbin: Samo samo, user and admin apps
  • /usr/sfw: You wanna look here! This is where the Sun FreeWare applications (GCC, GNU Tar, etc) tools are, including libs, headers, etc.
  • /usr/ucb: UCB standing for University of California Berkeley, these are the BSD version of tools, mostly for compatablity. If you prefer the BSD version of ps (ie: ps aux) you can find it here.
  • /kernel: This is where the modules and their associated configuration files are.
  • /platform: This is where platform specific code is held, namely your kernel (the kernel is named "unix", similar to the Linux "vmunix")
  • /cdrom: Automount point used by the volume management daemon (vold)
  • /home: By default /home is an automount point! If you want to use it locally first comment out /home in /etc/auto_master and then restart the automounter ("svcadm restart autofs")

How do I find out what I've got?

You can determine info about your system using "prtconf" (outputs the device tree, driver attachment information, etc) and "prtdiag" (found in /usr/platform/(platform)/sbin). Wanna check how much memory you have, or CPU, use these.

How do I find out System Statistics?

Most Solaris sysadmins are content with vmstat and iostat for information, we then extend that with truss, lockstat, etc. In Solaris10 we can now go further with DTrace! (Previous to DTrace a lot of us used the SE Toolkit) You might be wondering where "top" is though, the Linux favorite… we don't have it! Instead, Solaris has it's own version: "prstat". We have lots of other ptools that can give us information based on the /proc filesystem (you'll notice that /proc on Solaris doesn't have all the general data provided by Solaris, we get it in diffrent places like "prtconf"). We've got pgrep, pmap, pkill, pargs, and more. For info on the ptools check the "proc" man page.

What about RC Init?

SMF: Ding dong the witch is dead!! The Service Management Facility is the first real replacement of the aging RC Init system used by everyone else. No more doppy scripts! SMF allows services to have dependancies to other service, so for instance if you stop your ethernet device it can also stop all the networking services dependant on it too, and stuff like that. "svcs" can report Service Status, "svcadm" can control services like enable (think start), disable (think stop), restart, put in maintance, etc, "svcprop" can manage service properties, and "svccfg" can configure services. Start out by just running "svcs" and looking at the list. Then try using "svcadm" to restart a couple things or enable and disable services.

What about Apache?

Apache2: Solaris ships with a lot of goodies, including Apache2! Just edit the configuration (rename from sample) in /etc/apache2/, use svcadm to enable the service, and then drop your pages in the /var/apache2/htdocs directory! Apache2 provides a great test for Zones.

What about Dev tools?

Dev Goodies: You can find the bulk of the standard dev tools (as, ld, ld, lex, make, etc) in /usr/ccs/bin. You can interface with the runtime linker by using the "crle" command (Configure Runtime Linking Environment), rather than edit a file like on Linux.

How is the documentation?

This is just the beginning! You can find a ton of information in the docs found at docs.sun.com. Find information about Kernel Tunables, Security Services (IPfiler and IPsec goodies inside!), Solaris's included Volume Manger, Zones and Resource Management, a complete set of development docs, and of course the DTrace guide. Solaris is chop full of goodies, you just need to know how to use them.

What about x86 Hardware support?

Just a little pointer for people coming across to Solaris from other platforms. If you are using it on an X86 platform when you find that you have unsupported hardware (you will) don’t just b*tch & moan. Go to the manufacturers website find an email address and express to them how disappointed you are that they do not support Solaris.

What about /home?

home: By default /home is an automount point! If you want to use it locally first comment out /home in /etc/auto_master and then restart the automounter (“svcadm restart autofs”)

What do you mean by if I want to use it locally?

For example, I plan on using my Solaris box for nothing but personal things, so I’m the only user.

I don’t quite yet understand what the difference between /export/home and /home is and why if it’s automount makes a difference.

Also, something that was rather jarring to me coming from FreeBSD / Linux systems is that root usually has it’s own home directory ”/root” on the filesystem.

Why does the root user not have it’s own home directory? I really don’t like the idea of programs that I run as root, that like to store things in ”.whatever” directories littering themselves all over ”/”.

It’s really lame to have used Linux or FreeBSD for years and years only to feel like an idiot when you try a new platform. It’s not your fault, it’s just diffrent, so no worries! :)

The automounter (autofs) on Solaris is configured by default to manage 2 directories: /home and /net. In a “proper” Solaris enviroment this works out well because NIS will tell the automounter were to find the home directories (NFS mount) and you can connect to network shares via more NIS supplied automount maps. However, if you're just a normal schmoo at home (ie: us) without all these network resources set up this automounter crap just gets in the way. When the automounter is controlling a mount point you can not use it, and you’ll get odd errors that don’t make sense at first, just like if you entered a directory and then NFS mounted to that directory, you’d get a “Mount point Busy” or “Permission Denied” or something. Thus, if you use “useradd” to create an account by default it will try to point to /export/home/(user). Again, in a “proper” network your shared network home directory would be on an NFS server and automounted to /home, and any local (non-NFS mounted) home directories would go into /export. This also explains why when you partition a disk by default the installer wants to put 4G in / (root) and the rest of the disk in /export. You can do one of the following to use /home like you expect to:

1) Simply stop the automounter! You can tell SMF to disable the automounter completely using “svcadm disable autofs”. And, thankfully, unlike the old ”/etc/init.d/autofs stop”, when a service is disabled with SMF it will NOT restart when rebooted! Nice indeed.

2) The proper way is to edit the master automounter map file (/etc/auto_master) and comment out the entry for /home. Once that line is commented out (using a #) you can just restart the automounter (svcadm restart autofs) and you're good to go. Test it by touching a file in /home.

Almost every new Solaris user has been bitten by this one, and it's really confusing if your not familiar with the automounter itself. While almost everyone has heard of automounters, its more and more rare to see them actually used.

As for the root user home directory, ya, it’s kinda lame, but the root user shouldn’t be running things that plop hidden directories into their home directories. Some admins even object to /.profile for the root user. You naturally could create /home/root or even /root yourself and then update the /etc/passwd entry, but I’ve never seen someone do it. On most non-open source UNIX’ it’s uncommon to create a home directory for root.

Where do I get pre-built and easily installable opensource packages?

Go and check out [[http://www.blastwave.org]] for most of the opensource packages prebuilt and easily installable via “pkg-add -i packagename”. Over the Internet. Still blows my mind after a year of using it. Blastwave guys are AMAZING!!!! [1000 Software Packages on Wed Mar 30 09:12 EST 2005 !!!]

How do I observe a program from start to finish?

DTrace Tip: -c option

To observe a program from start to finish, use “-c cmd”.

● $target is set to target process ID

● dtrace exits when command exits

# dtrace -q -c date

  • n 'pid$target::malloc:entry{@ = sum(arg0)}'
  • n 'END{printa(“allocated %@d bytes\n”, @)}'

Fri Feb 11 09:09:30 PST 2007

allocated 10700 bytes

#

How do I get KDE installed?

For those who prefer KDE you can run it easily on Solaris x86. Just install KDE from the Software Companion:

http://www.sun.com/software/solaris/freeware/index.html

Then, as root, go to /opt/sfw/kde/dtlogin and run install-dtlogin. Next time you try to login you'll find that KDE is one of the session types you can choose.

How do I print in Solaris x86?

For those who are wondering how to print in Solaris x86, I find the easiest is to simply use cups. Cups can be found on the Solaris software companion (see above link). Then simply copy the startup scripts into the correct directory, as root:

(cd /opt//sfw/cups/etc;tar cvf – .)|(cd /etc;tar xvf -)

Then just run the startup script to start the daemon (to save a reboot):

/etc/init.d/cups start

Then go to your browser and go to http://localhost:631 and your at the admin page for cups. You add a printer there and from then on use the lpr/lp/lpstat commands in /opt/sfw/bin instead of the normal Solaris commands and printing will work as expected. Cups drivers for various printers can be normally found, just search via google.

Of course I use Cups simply because I'm used to it. The other way to print is simply go to the Launch bar in JDS, then Preferences -> Printer Preferences and you have a simple GUI to add a printer (far easier then in previous versions of Solaris.)

What is an smf(5) milestone?

An smf(5) milestone is really nothing more than a service which aggregates a bunch of service dependencies. Usually, a milestone does nothing useful itself, but declares a specific state of system-readiness which other services can depend upon. One example is the name-services milestone. It simply depends upon the possible name services you might be running:

$ svcs -d name-services STATE STIME FMRI disabled Jan04 svc:/network/rpc/nisplus:default disabled Jan04 svc:/network/dns/client:default disabled Jan04 svc:/network/ldap/client:default online Jan04 svc:/network/nis/client:default

and has no useful actions to perform during the start or stop method:

$ svcprop -p start name-services start/exec astring :true start/timeoutseconds count 3 start/type astring method

$ svcprop -p stop name-services stop/exec astring :true stop/timeoutseconds count 3 stop/type astring method

The name-services milestone is considered online as long as any name services which are enabled are running. There's also nothing different about these milestones to smf(5), it just sees them as yet-another-service.

We've implemented standard Unix system run-levels in smf(5) using milestones. The single-user, multi-user, and multi-user-server milestones correspond to run-levels S, 2, and 3, respectively. In addition to the runlevel milestones, there are the all and none keywords. These aren't actual services, but shorthand for either the graph with no services, or the graph with all services. This set of five special milestones can either be booted directly to (boot -m milestone=) or reached by running svcadm milestone. The way we reach a limited milestone (any special milestone but all) is to temporarily disable all services which aren't part of the milestone's subgraph.

Why is the console-login service disabled if you boot to a milestone that isn't all?

This can easily be determined by looking at console-login's dependents.

$ svcs -D console-login STATE STIME FMRI

As there are no milestones which have console-login as one of their dependencies, it won't be started as part of any milestone but all. Fortunately, we'll always start an sulogin(1M) prompt if a login service can't be reached.

So, why are milestones useful then?

The most useful milestone is none, for the recovery/exploration scenario I described here. The other use is when doing service development. You can use svcadm milestone to transition to limited milestones then back up without rebooting the system.

There's a large omission in my description of milestone use above. I don't mention system maintenance or patching anywhere.

Should I stop using init s, boot -s, and my other standard procedures to change runlevels and perform standard system maintenance?

Emphatically, no! Your old favorite commands continue to work as they always have. There's no need to change procedures. There's no reason to retrain your fingers with a much longer-to-type command when init s works just fine. The init invocations will work just like they always have, where svcadm milestone won't. For example, running svcadm milestone svc:/milestone/single-user:default won't change the run-level of the system (as described by who -r). Running init s will.

This is kool, more more more tips guys! Lots of new folks, lets help them all out with all the tips we can cough up.

What about a new window manager?

For starters, if you'd like to try out a real new window manager, check out my Enlightenment DR16.7.1 packages! There are 4 of them, download each, install, update the runtime linker paths via crle, then reset dtlogin (the login screen, "/etc/init.d/dtlogin reset"), and off you go. Enlightenment isn't for everyone, but if your a hardcore ol' school geek at heart who doesn't like crap all over your desktop but you also want a huge feature set with pretty graphics and lots of eyecandy, then E is for you! Find screenshots of E in action on the Enlightenment website.

Speaking of packages… how do you install them?

Easy, you use the "pkgadd" command. Say you download a package from SunFreeware.com or my Enlightenment packages, you'll generally download a compressed package. *.gz is GNU Zip (use "gunzip"), *.bz2 is BZip2 (use "bunzip2"), and *.Z is Compress (use "uncompress"). Then use the "pkgadd" command, like this: pkgadd -d ./CUDLsomething.pkg. The -d points to the package, but watch out because you must prefix the pkg with a path, relative or absolute! If you say "pkgadd -d CUDLsomething.pkg" the command will fail saying that it wasn't found, but "pkgadd -d ./CUDLsomething.pkg" will work fine.

Why?

The reasons for this are more than most people would care about. Please note however that you must add each package one by one!

Why?

Again, the reasons for this are more than you probly want to hear, namely that there are 2 ways to create packages, one is as a directory structure where you can easily add multiple packages at a time or alternately as a single file which is more portable but not as easy to install.

How do I manage or remove packages?

To manage or remove packages you can use "pkginfo", which will, by default, list every package on the system. If you want to learn more about a package, such as SUNWogg-vorbis, you can get the long pkginfo output via "pkginfo -l SUNWogg-vorbis". If you wanted to remove this package, you could use pkgrm, such as "pkgrm SUNWogg-vorbis". With pkgrm you actually can remove multiple packages at one time, just list one after another. If your interested in learning more about Solaris Packaging take a look at the Application Packaging Developer's Guide.

But what about patches?

You can look at patches in several ways, but the most straight forward is to use the command "showrev -p". The "showrev" command can show you all sorts of information but with the -p flag it outputs a list of all installed patches. You can download patches on Sun's support site SunSolve. On SunSolve you can download patches individually, in a recommended patch cluster (download 'em all and install with one command), sign up for the "Patch Club" or request notifications for critical or security patches, and you can also download (all for free) diffrent patching tools that can automate and simplify the proccess of checking your current patch set, download the new patches, and install them.

Why?

Using tools like "Patch Manager" can really simplify your life because some patches have various dependancies and restrictions which have to be figured out one by one normally, but are all handled seemlessly by Patch Manager. Even better than that, Patch Manager is included in Solariis10 out of the box (well, ISO for now)!

How do I check for any new patches that I need?

Just run "smpatch analyze" (smpatch is the Patch Manager binary) and it will check for patches and tell you what needs to be installed, then you can use smpatch again to download and install them. Easy as can be. Check out the smpatch(1m) man page for all the details on what Patch Manager can do for you. You can read more about patching in the Solaris10 Basic System Administration Guide.

Why can't I get DNS configured? I forgot to enable DNS during the installation and now that it's running I'm screwed?

Don't worry, you need to edit "/etc/nsswitch.conf". There are two easy ways to do this: 1) edit /etc/nsswitch.conf and add "dns" to the "hosts" line, or 2) Even easier is to just use the template by copying "/etc/nsswitch.dns" to "/etc/nsswitch.conf". Once you've got nsswitch.conf set properly just go ahead and edit /etc/resolv.conf like you would on any other system and DNS should work. The nsswitch.conf file on Solaris tells each name service where to look for information. By default all the name services look in "files" (the normal files in /etc), but you could also specify that Solaris should check nis, or nis+, or dns, or ldap in this file.

How do I export NFS filesystems?

There isn't an /etc/exports, so you might wonder just where the thing is… You want to edit /etc/dfs/dfstab. In the header of the file are instructions on how to get things working. To export filesystems we use the "share" command instead of "exportfs" in most cases although the "exportfs" command is avaible on Solaris just like your used to but all it really does is translate normal exportfs arguments into "share"/"unshare" arguments. If you couldn't guess, "share" will share a filesystem via NFS, "unshare" unshares it.

More tips to come. Add your own tips for all our new friends. We all had questions once, lets save them the trouble!

By popular demand we're going to take a whirl-wind tour of Solaris networking and configuration.

Why is it that I've almost just reinstalled Solaris to get the network settings fixed?!

Ya, sometimes you can get a little confused and irritated. Whether it's a new Linux distro, or diffrent UNIX OS, everyone puts their network configuration in diffrent places and learning each systems setup can be a pita.

What if I don't even wanna bother learning all the network configuration stuff and what file does what? Can I just re-run the networking configuration and have it all sorted out?

You can! Solaris has a nifty command that can reset the base networking and configuration to a clean system: "sys-unconfig". If you buy a pre-installed system from Sun or a VAR, what they will generally do is install Solaris, customize the install as need be and then run "sys-unconfig" before putting the system in the box and shipping it out. The command will scratch the networking configuration (most of it anyway), the root password, time zone, etc. Once sys-unconfig finished cleaning out the files it will immediately halt the system (shut it down). Next time you boot the system it will prompt you for all the networking information, time zone, locale and a new root password. This is the "quick-no-hassle" reconfiguration method. Generally we do not recommend this as ideal, but it will do the trick. If you plan on selling a pre-installed system or you are moving your system to a new network where all the info is changing, this is the command to use. Just use it carefully.

I know root shouldn't login remotely, but what if I really want to?

Logging into a system via telnet, ftp, or ssh is just bad… very bad. However, some times people think they need to do this or they simply don't care about security. If you really wanna drop your pants like this, edit: /etc/default/login. In this file, you'll see a line for CONSOLE. To allow root to log in via telnet or ftp just comment out this line and you're done. To allow root login via SSH you need to edit a different file: /etc/ssh/sshd_config. Change the value of PermitRootLogin from "no" to "yes" and restart SSH via "svcadm restart ssh". The SSH configuration file is just the same as Linux since Solaris uses OpenSSH. Please note, that allowing root to log in remotely is a massive security risk and needlessly stupid, don't do this unless you absolutely must.

How do I set and make the default gateway persistant across reboots?

The default gateway is easy to configure, just put the IP address of the default gateway in /etc/defaultrouter. If this file doesn't exist just create it and add the IP. The IP address of the gateway should be the ONLY thing in this file, nothing else. Typically you should just use echo, like this: "echo 10.0.0.255 > /etc/defaultrouter". Once you've changed the file you can restart the physical network interfaces to make the changes effective without a reboot ("svcadm restart physical").

How do I set or change my IP address?

Setting and changing IP addresses on Solaris is a snap. Just add the IP and hostname that you wish to use to /etc/hosts. Then put the hostname (by itself) in the /etc/hostname.(interface) file. Then just restart the physical networking via SMF ("svcadm restart phsyical") and your done!

Example: "echo '10.0.0.25 solarisrox' >> /etc/hosts; echo 'solarisrox' > /etc/hostname.hme0" assuming that hme0 was the interface you wanted to use.

Will this change the hostname for the whole workstation?

Don't worry about this changing the hostname for the whole workstation, the hostname for the system is kept in /etc/nodename. You can add the default gateway as we discussed just above. If you need to specify a non-standard subnet netmask you can add it to /etc/netmasks. You can have as many subnet masks in the /etc/netmasks file as you like, one per line, just follow the instructions at the top of the file.

How do I configure DHCP?

DHCP is pretty easy to configure, just create 2 empty files: /etc/hostname.(interface) and /etc/dhcp.(interface). If you are using HME0 you could do this: "echo "" > /etc/hostname.hme0 > /etc/dhcp.hme0". You might want to wipe out information that might conflict like the /etc/defaultrouter file if you created one. Once you've got these two empty files ready just restart the physical network to make the changes effective without a reboot ("svcadm restart physical"). If you want to customize the properties of the DHCP agent you can check out the "System Administration Guide: IP Services" manual. Remember that DHCP settings take a couple seconds to be retrieved from the server so if you reset the physical interfaces as mentioned above and you notice that nothing happened, just wait a couple seconds (30 secs is the default timeout).

How do I figure out what the network interface is called?

Linux sort of makes network interface naming easy because typically interfaces are named "eth0", "eth1", so on and so forth. In Solaris, however, the name of the interface is decided by the interface driver. For instance, the onboard ethernet of a Sun Ultra workstation uses the HME (Happy Meal Ethernet, also more boringly called Hundred Meg Ethernet) driver and so the first instance is "hme0". You can look at the device mappings to driver names using "prtconf -D". In general, Solaris will find your network device and try to configure it so generally just checking "ifconfig -a" is enough to find it.

Why isn't my l337 workstation's network device frickin' supported!?!

Sadly there are lots of networking devices that aren't officially supported (right now anyway, OpenSolaris hopes to change this). Thankfully there are tons of really kool Solaris developers that have been creating open source drivers! Check out these free NIC drivers by Masayuki Murayama! Grok google for drivers, you just might find your l337 gear really does have drivers avalible, they just aren't in Solaris right now.

There ya go.. some quick Solaris networking tips. As always, check out docs.sun.com's Solaris10 manuals for help and details.

Is there any reason why I shouldn’t change root’s default shell to bash from the default sh?

Regarding the root shell… well, there are differing schools of thought. In an ideal world it doesn’t matter what roots default shell is because any shell script should be written properly to not depend on the default shell. Furthermore, most modern shells (BASH and ZSH, both included by default in Solaris since Solaris9) can handle plain ol’ Borne just fine anyway, which is the default shell for root. So, if we’re talking about your workstation and your just tired of su’ing to root and then immediately starting bash, over and over and over, then sure, have at it. However, on most servers you shouldn’t change the default shell, if for no other reason than in any server enviroment you want to, ideally, change the system as little as possible.

The dhcp default timeout is 30secs. Any hint where to change the timeout?

If you have a laptop/machine that you use dhcp on you can set the dhcp timeout with something similar to

    echo "wait 30" >> /etc/dhcp.INTERFACE

i.e. on my laptop the interface is an iprb, and I'm impatient, so its

    echo "wait 15" >> /etc/dhcp.iprb0

It's all documented in the ifconfig manpage.

MY REALTEK 8139 pci NOT IS RECOGNISED IN soL 10 . AND DRIVERS SAID . NOT COMPATIBLE VERSION . DAMN IT .

IT LOOKS LIKE YOUR CAPS LOCK KEY IS FUBAR AS WELL. DAMN THOSE SOLARIS 10 DRIVERS!