Article jun2006.tar

Questions and Answers

Amy Rich

Q We're finally upgrading from SunOS 4.1.1 to Solaris 9 (Yes, that's really SunOS 4.x to Solaris, don't laugh!), and I'm trying to figure out the new printing system. Is there an easy way to translate my /etc/printcap file to the appropriate /etc/printers.conf format that Solaris 9 seems to want?

A The short answer to your question is that you can convert between /etc/printcap and /etc/printers.conf formats by using the program /usr/lib/print/conv_lpd, part of the SUNWpcu package. The longer answer, though, is that you'll probably need to learn how to use the lpadmin program to actually add printer definitions to your new host, or you can remove the SysV print programs from your machine entirely and go with something like CUPS:

http://cups.org/ 
            
or LPRng:
http://lprng.org/ 
If you want to stick with the Sun-provided software, take a look at the following printing-related packages:

SUNWctlu              Print utilities for CTL locales
SUNWffiltersr         foomatic-filters - Foomatic Print Filters 
                      (root)
SUNWffiltersu         foomatic-filters - Foomatic Print Filters 
                      (user)
SUNWfppd              foomatic_ppds - Foomatic Print PPDs
SUNWgimpprint         gimpprint - Drivers for Canon, Epson, 
                      Lexmark & PCL printers
SUNWgnome-print       GNOME printing technology - platform 
                      dependent files, /usr filesystem
SUNWgnome-print-devel GNOME printing technology - developer 
                      files
SUNWgnome-print-root  GNOME printing technology - platform 
                      dependent files, / filesystem
SUNWgnome-print-share GNOME printing technology - platform 
                      independent files, /usr/share
SUNWippcore           Internet Printing Protocol(IPP) core 
                      libraries, (usr)
SUNWipplr             Internet Printing Protocol(IPP) listener, 
                      (root)
SUNWipplu             Internet Printing Protocol(IPP) listener 
                      module (/usr)
SUNWmp                MP Print Filter
SUNWpapi              Free Standards Group Open Printing API
SUNWpcr               Solaris Print - Client, (root)
SUNWpcu               Solaris Print - Client, (usr)
SUNWppm               Solaris Print Manager
SUNWpsm-lpd           Free Standards Group Open Printing API 
                      RFC-1179 Print Service Module
SUNWpsr               Solaris Print - LP Server, (root)
SUNWpsu               Solaris Print - LP Server, (usr)
SUNWscplp             Solaris Print - Source Compatibility, 
                      (Usr)
Of particular interest are:

  SUNWpcr               SUNWpcu
  SUNWpsr               SUNWpsu
  SUNWppm               SUNWscplp
Also take a look at the System Administration Guide: Advanced Administration from the "Solaris 9 9/04 System Administrator Collection" at:

http://docs.sun.com/app/docs/doc/817-6959 
            
for some detailed information on configuring SysV-style print spools.

Q We provide the email client pine for our users, but some of them have requested that we also install mutt. We configured pine to use our IMAP servers for authentication and mail sending/storage and LDAP for address book lookups. The lines from /usr/local/lib/pine.conf that we've customized are:

user-domain=my.domain
inbox-path={mail.my.domain/ssl}inbox
folder-collections="Mail" {mail.my.domain/ssl}[]
default-fcc=sent
postponed-folder=drafts
speller="/usr/local/bin/aspell --mode=email check"
ldap-servers=ldap.my.domain \
  "/base=dc=my,dc=domain/impl=1/rhs=0/ref=0/nosub=0/ \
   ldap_v3_ok=0/type=name-or-email/srch=contains/time=/ \
   size=/cust=(&(mail=*)(|(cn=*%s*)(mail=*%s*)))/nick=LDAP \
   Address Book/matr=/catr=/satr=/gatr="
            
We'd like to configure mutt similarly, but the exact syntax we want in /usr/local/etc/Muttrc escapes me. Do you have suggestions?

A To provide similar functionality, put the following in your /usr/local/etc/Muttrc file:

set imap_user=$USER
set folder="imaps://mail.my.domain"
set spoolfile="imaps://mail.my.domain/inbox"
set record="imaps://mail.my.domain/sent"
set postponed="imaps://mail.my.domain/drafts"
set ispell="/usr/local/bin/aspell -e -c"
set query_command="/path/to/mutt_ldap_query.pl '%s'"
            
You'll also want to download the script mutt_ldap_query.pl from:

ftp://ftp.mutt.org/mutt/contrib/mutt_ldap_query-3.0.pl.gz
and customize at least the following based on the information you provided above:

my $ldap_server = "ldap.my.domain";
my $search_base = "dc=my,dc=domain";
my $query = join '', map { "($_=$askfor*)" } @fields;
The latter line does a wildcard ldap search instead of a direct match. You may also want to modify the fields on which you perform the ldap search and/or the fields you report to the user as a result of the search. The lines of code you'd change for each are:
my @fields = qw(cn mail sn fn uid);
my $expected_answers = "cn fn sn mail business_group telephonenumber";
push @results, "<$email>\t@name\t($phone) $sector\n";
    
You might also need to change the location of the ldapsearch binary or use the perl-ldap module.

Q We were trying to determine how many functioning CPUs a Sun V440 had while we were at the ok prompt. We couldn't find a good method and wound up booting off the network so we could run prtdiag. For future reference, there must be something at the OBP level we could have used, right?

A If you're at the OBP and wondering what commands are available to you, you can use a nifty program called sifting, which provides a "sifting dump." You provide an argument, and it searches through the OBP forth vocabulary to find instances where that string is mentioned. If you're wondering about commands dealing with CPUs, for example, run:

sifting cpu 
            
This returns the following output on one of my machines:
In vocabulary  asr-dev*
(f004765c) cpu1-bank*   (f004763c) cpu0-bank*

In vocabulary  asr-dev
(f00474c4) cpu1-bank3  (f00474a4) cpu1-bank2  (f0047484) cpu1-bank1
(f0047464) cpu1-bank0  (f0047444) cpu0-bank3  (f0047424) cpu0-bank2
(f0047404) cpu0-bank1  (f00473e4) cpu0-bank0

In vocabulary  magic-device-types
(f0053890) cpu   

In vocabulary  forth
(f005387c) cpu-index  (f0053860) cpu-phandles (f0048cdc) switch-cpu
(f00488f8) xcall-start-cpu  (f00484c0) xcall-cpu
(f0040ab0) >per-cpu-pending-int-adr          (f004097c) .cpu-state
(f00403d4) per-cpu-defer:  (f0040290) >cpu-status!
(f0040268) (cpu-state      (f0040238) >cpu-struct
(f00401c4) mid>logical-cpu#   
(f0040174) /cpu-struct     (f00400a0) >cpu-sp0-fence
(f0040080) >cpu-rp0-fence  (f0040060) >cpu-sp0  (f0040044) >cpu-rp0   
(f0040028) >cpu-status     (f003ff10) >cpu-state
(f003fea0) mp-cpu-state    (f003fe50) release-slave-cpu
(f003d468) .cpu-eccr       (f003cd78) .cpu-afsr (f003b1e4) \
                            enable-cpu-errors   
(f003b1b0) disable-cpu-errors  (f003b014) init-cpu-errs   
(f003ab74) cpu-eccr!       (f003ab5c) cpu-eccr@ (f003ab44) cpu-afar@

(f003ab2c) cpu-afsr!       (f003ab14) cpu-afsr@ (f003aafc) \
                            cpu-error-enable!
(f003aadc) cpu-error-enable@  (f003aabc) cpu-safari-config!
(f003aa98) cpu-safari-config@ (f0027da0) sbus-intr>cpu
(f0023c84) cpu-state

.cpu-state
The .cpu-state command looks promising, so if you run it, you get the following output on a two-processor box:

{1} ok .cpu-state
CPU: 0 logical: 0 idling (not started)
CPU: 1 logical: 1 running OBP (not started)
For additional interesting OBP tricks, read the OpenBoot 4.x Command Reference Manual:

http://sunsolve.sun.com/data/816/816-1177/pdf/816-1177-10.pdf
Another handy bit of information is that the number in curly braces before the ok is actually the CPU on which your command is executing.

Q I realize that this isn't strictly a Unix question, but I thought the answer might be the same as it would in Unix, so I'd ask. We're running Windows XP Pro Service Pack 1 with Microsoft Windows Services for Unix. One of the benefits of this is that we can allow our admins to use tools like sudo. We have a bunch of trusted people in the group Power Users, so I'm trying to hand out privileges by group instead of listing each user individually. According to the sudo man page, I should use visudo to add the following entry:

%Power Users (ALL)=ALL ALL 
            
When I try that, though, visudo gives me the following error:

>>> sudoers file: syntax error, line 1 <<<
What now? 
What syntax should I be using?

A Your issue is that you're using a group name with a space in it, and sudo uses whitespace as a field separator. It's parsing the Users as the next field in the configuration statement. Try escaping the space with a backslash character:

%Power\ Users (ALL)=ALL ALL 
            
Q I'm attempting to set up the alert mailing functionality of our Sun V240 machines. I've followed the documentation, and I ran the following commands on one of these hosts:

sc> setsc netsc_ipaddr 10.0.5.142
sc> setsc netsc_ipnetmask 255.255.255.0
sc> setsc netsc_ipgateway 10.0.5.1
sc> setsc if_emailalerts true
sc> setsc mgt_mailhost 10.0.5.25
sc> setsc mgt_mailalert alom-crit@my.domain 2
sc> setsc mgt_mailalert alom-logs@my.domain 3
            
Just to verify that everything was set as expected, here's the output of showsc:

Advanced Lights Out Manager v1.3

parameter                value
---------                -----
if_network               true
if_modem                 false
if_emailalerts           true
sys_autorestart          xir
sys_xirtimeout           900
netsc_tpelinktest        true
netsc_dhcp               false
netsc_ipaddr             10.0.5.142
netsc_ipnetmask          255.255.255.0
netsc_ipgateway          10.0.5.1
mgt_mailhost             10.0.5.25
mgt_mailalert(1)         alom-crit@my.domain 2
mgt_mailalert(2)         alom-logs@my.domain 3
sc_customerinfo          
sc_escapechars           #.
sc_powerondelay          false
sc_clipasswdecho         true
sc_cliprompt             sc
sc_clitimeout            0
sc_clieventlevel         2
sc_backupuserdata        true
sys_eventlevel           2
ser_baudrate             9600
ser_parity               none
ser_stopbits             1
ser_data                 8
netsc_enetaddr           XX:XX:XX:XX:XX:XX
sys_hostname             myhost.my.domain
sys_enetaddr             XX:XX:XX:XX:XX:XX
When an event that should send mail is triggered, though, the email address doesn't receive the email. Can you see where I might have configured something incorrectly?

A There was a bug in older versions of both ALOM and RSC where they did not provide an RFC 2822-compliant address in the envelope address. When the connection is made, the V240 only transmits the information stored in the sys_hostname variable and not a username@host pair. Reasonably configured MTAs will reject the bare hostname in the envelope address as a spam attempt. The Sunsolve bugid numbers that reference this issue are:

http://sunsolve.sun.com/search/document.do?assetkey=1-1-4674391-1
http://sunsolve.sun.com/search/document.do?assetkey=1-1-4876532-1
http://sunsolve.sun.com/search/document.do?assetkey=1-1-4913025-1
            
This issue was fixed in ALOM 1.4_build4 so if you upgrade to the latest version of the ALOM software, 1.5, your problem should be solved. Be sure you're running Solaris 8 07/03 or later before installing ALOM 1.5. The latest ALOM software is always available for download from:

http://www.sun.com/servers/alom.html
As a side note, you can also configure your ALOM settings from the operating system command line with the scadm command, found in /usr/platform/`/bin/uname -i`/sbin. Once you've installed the new version of ALOM, you can test to make sure it's working by running the following to send a critical warning:

scadm send_event -c "testing ALOM email"
            
See the scadm man page for more options and information.

Amy Rich has more than a decade of Unix systems administration experience in various types of environments. Her current roles include that of Senior Systems Administrator for the University Systems Group at Tufts University, Unix systems administration consultant, author, and charter member of LOPSA. She can be reached at: qna@oceanwave.com.