12.10.2007

mailto links to web mail

greasemonkey script that routes all mailto links to web based email such as Yahoo mail and Gmail, and Google Apps mail (your domain)

Mailto 2 Webmail – Userscripts.org

11.08.2007

rename file extensions easily in Unix

In dos you could:
move *.txt *.cvs

but the wildcard characters don't work that way in unix. You must do something like the following, where EXT1 is the original extension and EXT2 is the new one:

for i in *.EXT1
do
mv $i ${i%.EXT1}.EXT2
done

for example: to rename all .txt files to .ascii run the following shell script:
for i in *.txt
do
mv $i ${i%.txt}.ascii
done

5.07.2007

HPUX: lpadmin - can't open member file

problem adding a printer on HPUX (10.20 in my case, but this error occurs on all versions)
lpadmin: can't open member file

one possible cause:
/etc/lp needs to be owned by the 'lp' user id.

# ll -d /etc/lp
drwxr-xr-x   8 root       bin           1024 May  7 15:54 /etc/lp

fix:
chown lp /etc/lp

4.12.2007

Naviagent not responding on unix host

Had two hosts that were not responding to navisphere, "agent is unreachable" or some bable...

on each host there was a /agentID.txt file that the agent reads before re-creating the /etc/log/HostIdFile.txt     The purpose of agentID.txt is to make naviagent bind to a specific IP address on a multi-homed system.  The IP address listed in the file doesn't need to exist on the system, it uses the IP without verification.

I stopped the agent, deleted both HostIdFile.txt and agentID.txt, then started the agent and it now is using the correct IP address in HostIdFile.txt


3.20.2007

rlogin problem - unable to allocate pty

only affected rlogin, not telnet.  Only one concurrent rlogin connection works, others fail with the following:

$ rlogin host
rlogind: Unable to allocate pty on remote host.
Connection closed.

resolution:
$  insf -d pts -s 512

ITRC   DOCID: KBRC00014047   Now I can login multiple times

3.17.2007

make Firefox in Ubuntu look much better

The look and feel of web pages in FireFox in Ubuntu (possibly other Linux distros) by default stinks (in my opinion).  Trying to convert myself from Windows solely to Linux, this has been hard, but I found a way to make the fonts look really good in Firefox (improves the entire experience):
http://www.ubuntuforums.org/archive/index.php/t-91280.html

Change the fonts in preferences:

where it says, serif, select 'Bitstream Vera Serif'
where it says, Sans-serif, select 'Bitsteam Vera Sans
where it says, Monospace, select 'Bitsteam Vers Sans Mono'

how to: switch from Windows to Linux

My switch from Windows XP to Ubuntu Linux:

convert RPM to DPKG for installing:  install the package called 'alien'

http://diveintomark.org/archives/2006/06/26/essentials-2006

powerfail scsi messages in syslog

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=15842&admit=-682735245+1161469244473+28353475

ll /dev/dsk | grep 052200

0x1f052200
The First two hex digits (1f - 31 decimal) denote the major device number. If you do an lsdev, you will note that 31 is the scsi disk block device.

After that it decodes as follows the following hex digits:
05 - c5
2 - t2
2 - d2
00 - the last two minor device digits are driver specific
But yours is: SCSI Block Disk Device, c2t2d2

the last 6 digits are the minor number of the device.

OVO agent: opcagt error on start

hostname.root /$ /sbin/init.d/opcagt start
Error opcctla   (Control Agent)(21829) : Errors occurred during the read of the
ITO subagent registration file. (OpC30-1250)
Error parsing source file /var/opt/OV/conf/OpC/agtreg - syntax error in line 1. (OpC30-2604)
ERROR:   Problems with starting OpC Agent processes or none configured.

hostname.root /$ /var/opt/OV/conf/OpC/agtreg
hostname.root /$ /sbin/init.d/opcagt start
hostname.root /$
hostname.root /$

hostname.root /$ rm /var/opt/OV/conf/OpC/agtreg

hostname.root /$ /sbin/init.d/opcagt start
Error opcctla   (Control Agent)(22144) : Errors occurred during the read of the
ITO subagent registration file. (OpC30-1250)
Can't open configuration file '/var/opt/OV/conf/OpC/agtreg' for reading.
No such file or directory (OpC20-202)
ERROR:   Problems with starting OpC Agent processes or none configured.

hostname.root /$ rm /var/opt/OV/conf/OpC/agtreg
hostname.root /$
hostname.root /$

hostname.root /$ /opt/OV/bin/OpC/opcagtreg -add /opt/OV/bin/OpC/install/itoagt.reg
hostname.root /$ /sbin/init.d/opcagt start
OpC Agent processes successfully started.


lock / unlock account user id on HP-UX trusted system

/usr/lbin/getprpw useraccount
unlock / enable / reactivate:
/usr/lbin/modprpw -k useraccount

lock / expire password:
/usr/lbin/modprpw -e useraccount

Do not use a capital E, as it will expire the password on all user accounts.

nfs / rcp / CDE issue

This problem seems to keep happening since this box was upgraded to 11.11.  The rpc/nfs daemons seem to restart at 00:05.  Killed all fin_wait_2 connections and restarted nfs/rpc daemons.:

stuff=$(/usr/bin/printf "%.2x%.2x%.2x%.2x%.4x%.2x%.2x%.2x%.2x%.4x\n" \
$(/usr/bin/netstat -an -f inet | /usr/bin/grep FIN_WAIT_2 | \
/usr/bin/awk '{print $4,$5}' | /usr/bin/sed 's/\./ /g'))

for x in $stuff
do
/usr/bin/ndd -set /dev/tcp tcp_discon_by_addr $x
done


 /sbin/init.d/nfs.server stop ; /sbin/init.d/nfs.client stop ; /sbin/init.d/nfs.core stop
 /sbin/init.d/nfs.core start ; /sbin/init.d/nfs.client start  ; /sbin/init.d/nfs.server start


solution:  It was being caused by a cronjob stopping and starting rpc, but was not doing it correctly.

3.16.2007

NFS exports to PC clients on EMC Celerra

Doing NFS exports to a PC client normally requires and authentication daemon running on the host system: pcnfsd on unix systems, just referred to as pcnfs on EMC Celerra   So it's more complicated than setting up NFS for Unix clients.

do a powerlink (powerlink.emc.com) search for: pcnfs celerra
look for a pdf document titled: Configuring NFS on Celerra
one of the appendixes: NFS Authentication for PC Clients

There's also a primus article regarding pcnfs: emc43806, below is the gist of the article:

# Set up a user account.
#     Open the /nas/server/server_x/netd file with a text editor, add pcnfs on a separate line, and save the file.
#     Where x is the number of the Data Mover.
#     Reboot the Data Mover.
#     Export a file system for the user(s) to access.
#     On the PC, launch the PC-NFS. Refer to the vendor's respective user manual for details on what is required
          at this point for setup and/or login.
#     Enter the username and password as required by the software package.

3.11.2007

update DST for Linux and BSD (freebsd, openbsd, etc)

Here's a good article on how to update your timezone information files for the new Daylight savings time rules for 2007:  http://articles.techrepublic.com.com/5100-10877_11-6163042.html?part=rss&tag=feed&subj=tr

The proper file to download is tzdata2007 c.tar.gz   not the tzdata2007b.tar.gz noted in the article.

3.03.2007

2.28.2007

remsh - There is no passwd entry for you

Doing an remsh or rlogin and receiving the following message:  "There is no passwd entry for you"   means that something in the local password file is screwed up.   In my case, a daemon was changing it's password entry and kept adding ....,  to the password field until it started to span multiple (10) lines in the password file.  Any system call that would search the passwd file would stop at the screwed up entry.  Removing and fixing the messed up entries solved the problem.

Some other symptoms of this include having a blank user name when doing the 'id' command:
$ id
uid=12345() gid=20(users)

2.26.2007

vi session hung (old IBM version of vi)

$ vi

UNIX Visual Text Editor Front End Utility
Copyright (C) 1996,1997 IBM Global Services
A vi session is already in progress.

fix:
delete /var/adm/vi.lock

HP-UX hangs at boot

Boot problems:
panic: lv_fixrootlv: Stale extent array overflow

cause: volume group header and /etc/lvmtab out of sync when logical volumes are mirrored.
fix:
  • boot into lvm maintenance mode: hpux -lm
  • activate vg00: vgchange -a y vg00
  • vgdisplay vg00 -- shows 3 current PV and 2 Active PV (or whatever the discrepancy is)
  • unmirror logical volumes:
    • for i in 1 2 3 4 5 6 7 8 9
    • do
    • lvreduce -A n -m 0 /dev/vg00/lvol$i
    • done
  • vgreduce -f vg00
  • now vgdisplay vg00 shows the same number of current and active PV

2.25.2007

logname error in rlogin session on particular tty

when you rlogin and your tty is pts/0 (/dev/pts/0) you might get the following message when trying to execute logname:

logname: could not get login name

It appears that rlogind doesn't update /etc/utmp This of course appears to be intermittent if you have several clients doing rlogins, the first one that uses /dev/pts/0 will have the problem, the other will probably be fine. This is more of a problem if you are using the logname command in something like /etc/profile

Only noticed this on 11.23 (both IA and PA platforms). Both had PHNE_32818 installed. A possible fix is PHNE_33792, but I couldn't test it. A workaround is to use the variable $LOGNAME instead of the command logname.

2.15.2007

get the timestamp formatted the way you want

ls in HPUX and most other *nix versions just plain sucks giving the output you need.  see the following section of the HPUX ls(1) man page:
           -l   (ell) List in long format, giving mode, number of links,
                owner, group, size in bytes, and time of last modification
                for each file (see further DESCRIPTION and Access Control
                Lists below).  If the time of last modification is greater
                than six months ago, or any time in the future, the year is
                substituted for the hour and minute of the modification
                time.  If the file is a special file, the size field


get the month day year Hour minute second of timestamp of a file (modification):

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=105260&admit=-682735245+1171602387200+28353475

I believe this uses the stat function.

2.13.2007

finding hard links / hard link count in file systems

link column (second column) in ls -l output (hard link count):
a directory will always have a minimum of 2 links.  One for the directory itself and one for the . (current directory) inside the directory.
any additional subdirectories directly under the directory count as an addition link for the directory because of the .. (parent) directory entries inside each subdirectory.


to find hard links:
ncheck -F vxfs /dev/vg00/lvol6 | sort -n | awk '$1==prev{print last;print $0}{prev=$1;last=$0}'

2.07.2007

HBA part number on HPUX systems

how to tell HBA part number in HP-UX using fcmsutil
fcmsutil /dev/<device>  ( find from ioscan -fnC fc )

Device ID  part number
0x001028   A5158A - 1GB
0x001029   A6795A - 2GB
0x002312   A6826A - 2GB dual port PCI-X

2.04.2007

uncommon serviceguard errors - coredump, IP netmask

cmcheckconf coredumps when "gathering network configuration"

this is because one of the standby lan interfaces on one of the nodes has been plumbed (ifconfig plumb) or is assigned an IP of 0.0.0.0 in netconf.  unplumb the interface (see ifconfig), or remove it from netconf before running cmcheckconf or cmapplyconf.



Error: IP netmasks don't match, interface lan0 on node0
Error: IP netmasks don't match, interface lan0 on node1

but if your netmasks do match properly and currently in netconf, then the cluster binary file needs to be deleted and recreated from the ascii file.

2.01.2007

get serial number of server hardware in Linux

In Redhat Enterprise or maybe other linuxes to poll the serial number of the server or workstation hardware from the bios using dmi:
dmidecode

May have to install the package from repositories.

1.17.2007

HP Itanium systems - EFI ref guide

EFI reference guide: http://docs.hp.com/en/5991-1247/ch04s13.html  and  http://docs.hp.com/en/A5201-90017/index.html

configure IP aliases on AIX

Navigate in smit:
Communications Applications and Services
 TCP/IP
  Further Configuration
   Network Interfaces
    Network Interface Selection
     Configure Aliases

OR
smit inetalias

chdev -l 'en1' -a alias4=x.x.x.x,y.y.y.y

where x.x.x.x is the address and y.y.y.y is the netmask

1.11.2007

fsadm error shrinking file system

HP-UX 11.00  - fsadm:  cannot shrink /dev/vg00/rlvol6 - upgraded fs - inodes are currently in use.

resolution: upgrade to 11.11 to get the new JFS 3.3 and related tools.