HP-UX FAQs/How-Tos

PrevUp [ Backup | Disks | Tapes | Programming | Miscellaneous | Trouble Shooting ]


Backup


Tape Backup

with Ignite-UX (10.x,11.x)

 
make_tape_recovery -I -x inc_entire=vg00 
saves the "rootvg".

HP-UX 9.x

Create a minimum recovery tape allowing to boot the system, plus a full backup of the root disk:
mkrs -v -q -tdat -f /dev/rmt/... -r /dev/dsk/...       # make a bootable tape
mkrs -v -q -tdat -f /dev/rmt/... -r /dev/dsk/... -m700 # make a bootable tape, force series 700
fbackup -0 -i / -f /dev/rmt/...

Backup w/ Copyutil

  1. Boot from Support CD (press ESC to interrupt normal boot)
  2.  
    ISL> ODE 
    
  3.  
    ODE> COPYUTIL 
    

Using fbackup/frecover

frecover -V /tmp/fb.volhd -N -v -f /dev/rmt/0m     # read backup volume header
frecover -r -N -v -f /dev/rmt/0m >/tmp/fb.log 2>&1 # lists backup
frecover -r -X -v -f /dev/rmt/0m                   # restores backup tree into local directory  
frecover -x -X -i /bin+ -v -f /dev/rmt/0m          # extract a specific object into local directory 

Disks

Adding a new disk (filesystem)

HP-UX 9.x

Maximum size: 4GB-1k = 4194303.
  1. Connect the disk and use SAM or ioscan to check if it's properly recognized. If not, check jumper settings.
  2. Format and verify the disk, query some info. For example assume a disk at ID=1 in a 9000/715:
    mediainit /dev/rdsk/c201d1s0
    /etc/diskinfo -v /dev/rdsk/c201d1s0
    
  3. If the disk does not appear in /etc/disktab, add the appropriate entries, as explained in that file. For SCSI disks the most important one is s0#, the size (in kB) taken from diskinfo. Formally required are also ns#,nt#,nc#,, but in my experience they can be faked, so that their product yields s0#.
    If the disk should also serve as a boot disk, further entries should be made with s0# reduced by the amount foreseen for swap and boot area (combined). Example:
    QUANTUM_FIREBALL1280S_noswap|QUANTUM_FIREBALL1280S_noreserve|QU_FIREBALL1280S_noswap|QU_FIREBALL1280S_noreserve:\
            :No swap or boot:ns#32:nt#16:nc#2445:\
            :s0#1251840:b0#8192:f0#1024\
            :se#512:rm#3600:
    QUANTUM_FIREBALL1280S_150MB|QU_FIREBALL1280S_150MB:\
            :150 MB swap:ns#32:nt#16:nc#2145:\
            :s0#1098240:b0#8192:f0#1024\
            :se#512:rm#3600:
    
  4. Create the new filesystem:
    newfs -v -L /dev/rdsk/c201d1s0 QUANTUM_FIREBALL1280S_150MB
    
    You may wish to protocol some of the listed superblock numbers, for emergency use with fsck.
  5. Alternatively, /etc/disktab may be bypassed by using /etc/mkfs, in this case some parameters (e.g. the size) have to be specified on the command line:
    /etc/mkfs /dev/rdsk/c201d1s0 1098240
    
    Anyway, /etc/mkfs is called by /etc/newfs

Cloning a disk

HP-UX 9.x

e.g. onto a larger one. Note however, that boot disks have to be below 2GB (exactly), otherwise an IPL bad address error will occur on boot.
Firstly, perform the steps necessary to add a new disk. Then:
  1. mount the target disk and copy the contents of the source disk:
    mount /dev/dsk/c201d1s0 /mnt   # example for SCSI ID=1 in an 9000/715
    fbackup -0 -i / -e /mnt -f - | (cd /mnt; frecover -Xrf -)
    
  2. If the new disk should be bootable:
    mkboot -v /dev/dsk/c201d1s0
    
    and check bootability:
    lifls /dev/rdsk/c201d1s0
    
    A bootable disk reports something like:
    FS           SWAP         ISL          AUTO         HPUX         
    EST          ODE          MAPFILE      SYSLIB       MAPPER       
    IOTEST       PERFVER      XDIAG        PAD          
    
    while a non bootable disk reports an error message.
    In addition modify
    /mnt/etc/checklist
    
    to reflect the new filesystem to be fsck'ed on boot.

More references:

Tapes

9144 tape handling

Some info is collected here

Duplicating HP install/support/update DAT tapes

Install and support tapes contain at least two files, a LIF header with 2kByte records and a tar file with 10kByte records (512 bytes times default blocking factor 20). Thus it is indispensable to specify the blocksize.
Recipe to copy to disk first, then to tape:
 
dd if=/dev/rmt/0mn of=install.lif bs=2k          # note: 0mn to suppress rewind 
dd if=/dev/rmt/0m  of=install.tar bs=10k         # note: 0m  to allow rewind
                                                 # insert copy tape
dd if=install.lif of=/dev/rmt/0mn bs=2k          # note: 0mn to suppress rewind      
dd if=install.tar of=/dev/rmt/0m  bs=10k         # note: 0m  to allow rewind
If you have two tape drives:
 
dd if=/dev/rmt/0mn of=/dev/rmt/1mn bs=2k         # note: 0mn to suppress rewind         
dd if=/dev/rmt/0m  of=/dev/rmt/1m  bs=10k        # note: 0m  to allow rewind     
Sometimes such tapes have a third file, a "pseudo-tar", which serves as an extra indicator of the end-of-tape. I think it can be ignored.
Tapes in "update" format are plain tar files. To be copied e.g. with:
 
dd < /dev/rmt/0m > scratchfile ibs=10240 obs=512 # source tape, mind the blocksizes ! 
tar tf scratchfile                                     # verify proper tar format 
dd < scratchfile > /dev/rmt/0m ibs=512 obs=10240 # target tape, mind the blocksizes ! 
tar tf /dev/rmt/0m                                     # verify proper tar format 

After copying, an integral number of records should be reported, e.g.:

19742+0 records in
394840+0 records out
Otherwise the blocksize is incorrect or the tapes are not in the HP format.

Programming

Query HP-UX version on the shell level

HP-UX version in reasonable format:
echo $(uname -r | sed -e 's/..//' -e 's/\.//')

Query HP-UX version at cpp level

#if defined(__hpux)
#include <sys/privgrp.h>
#if defined(PRIV_PSET)
#define _hpux_11i
#elif defined(PRIV_SPUCTL)
#define __hpux_11x
#define OSMAJORVERSION 11
#elif defined(PRIV_SERIALIZE)
#define __hpux_10x
#elif defined(PRIV_SETRUGID)
#define __hpux_9x
#endif
#endif

Generating 64-bit programs

Use the native cc compiler's +DD64 option for compilation. On 32-bit systems the 64-bitDevLibs (Cross Platform Development Kit) must be installed to create executables. Of course 64-bit executables can't be executed on 32-bit systems.
The native cc compiler implements the 4/8/8 model for (int/long/ptr).

Shared vs archive libraries

Create shared libraries, HP-UX 10.20:
cc -Aa +z
ld -o libxxx.sl -b *.o
Force linking against archive libraries, HP-UX 10.20:
cc
cc ... -Wl,-a,archive_shared
ld ... -a archive_shared ...

pstat interfaces et al.

PSTAT Interfaces (May 2000)
Memory Windows in HP-UX 11.0. White Paper (Version 98-1.4)

Miscellaneous

Running SAM through a telnet session

A situation which might occur with ancient boxes lacking ssh. SAM requires specific terminal characteristics. One may use a VT220 emulation:
export TERM=vt220   # for ksh

Updating the kernel

mv /stand/build/System.SAM /stand/system  # list of kernel parameters
/usr/sbin/kmupdate 
shutdown -r -y now 

Setup a netdist server

A netdist server is particular convenient to store codeword protected software (provided one has codeword and proper license, of course), since it can be copied (unprotected) once and for all times from CD to a server disk.
Prerequisites: CD media, HP-ID-Module, HP license codeword(s) appropriate for the combination of hardware ID, CD Part number and product number. A more versatile SYSKOMP-ID-BOX may be used in place of the HP-ID-Module.
  1. Prepare a local target directory with enough disk space behind it. Default would be /netdist, possibly on an extra disk.
    Note, however, that this directory name will enter into the steering file, MAIN.pkg, and all paths have to be consistently named when the server daemon is started (place softlinks if necessary).
  2. If software is to be loaded from CD, mount it:
    mount -r -t cdfs /dev/dsk/c201d3s0 /UPDATE_CDROM   # example for SCSI ID=3 at an 9000-715
    
    Or use SAM for that.
  3. Run the menu driven /etc/updist
       Change Source or Destination
          From CD-ROM to local system
             Destination /netdist
             Codeword    .... .... .... .... # from the HP license sheet, exactly as written (don't forget e.g. trailing hyphen's) !
             Hardware ID ddddAnnnnn          # defined via ID box, don't enter. Echoed by system.
             Select all Filesets
    
    The installer might ask for the architecture (300/700/800), only one of these can be installed in a single updist run. Messages on missing target directories (300/700/800) can be ignored.
    Once updist has finished, the contents of the netdist directory (300,700,800,MAIN.*) may be transferred elsewhere.
  4. Start the server daemon with e.g.
    /etc/netdistd -f /netdist/MAIN.pkg -v -c /tmp
    
    which says that caching should go into /tmp and verbose logging will go into /usr/adm/netdist.log. It might be necessary to allow netdistd service in /usr/adm/inetd.sec and /etc/services.
More info with man netdistd

List software on media

HP-UX 9 example:
mount -r -t cdfs /dev/dsk/c201d3s0 /cdrom # CD-ROM @ SCSI ID=3, 9000/715
/etc/update -c -s /cdrom
HP-UX 10,11 example:
mount -r /dev/dsk/c2t0d0 /cdrom           #
swlist -s /cdrom
                                          # list with more info 
swlist -a tag -a revision -a path -a is_secure -a title -f /cdrom

Dealing with antique software

Case: old (pre-7.0) Series 300 update media (720kB floppies of 1986 vintage).
Can't be read by "modern" floppy drives.
Can't be handled by /etc/update, swlist, et al., comes in Logical Interchange Format (LIF).
  1. Hardware used:
  2. Ensure good working condition:
    SAM -  Peripheral devices - View all
    
    HP-IB devices should be listed with select code 7
  3. Create a floppy image, e.g.:
    dd if=/dev/dsk/c7d0s0 of=pascal.ddimg            
    
    may report
    dd read error: I/O error
    1544+0 records in
    1544+0 records out
    
    but this is probably just "end-of-floppy"
  4. Access the software:
    lifls -l /dev/dsk/c7d0s0 # list filesets on IB floppy 
    lifcp -r /dev/dsk/c7d0s0:A98518A - | cpio -idumvx # example to extract to current directory
    

Troubleshooting

SAM responds with SAM task controller initialization failed. rc = 1402 message

Further symptom: SAM is very slow and refuses most tasks, leaving it essentially useless.
This problem and its confusing message may be due to the system's date earlier than some SAM files'.
touch /usr/sam/lib/*/*.LL
solved the problem for me. See also SAM's error log, /usr/sam/log/samlog, for more information.

Maximum number of processes per user exceeded

(can't fork etc.).
Use SAM to modify the maxuprc parameter (e.g. to 256). This parameter is dynamic (i.e. doesn't require reboot) on HP-UX 11.x.

Programs running out of memory


Use SAM - Kernel Configuration to modify the maxdsiz parameter (e.g. from 67108864 to 268435456, i.e. from 64 to 256MB). This parameter is static (i.e. a kernel rebuild/reboot will follow) on HP-UX 11.0.

file: table full

Increase kernel parameter nfile.
I chose to change nproc:
(20+8*MAXUSERS) => (20+16*MAXUSERS)

Root password lost

  1. During boot press ESC to get into boot admin menu
  2. Select single user mode (admin, monitor, etc., model dependent)
  3. boot pri isl
  4. ISL> hpux -is
  5. passwd root to change root password

Can't login via VUE/CDE

It might still be possible via VUElite, otherwise use failsafe session or command line login.
Follow the suggestions of the error message(s), then check proper network setup first. In particular IP name resolution defined in /etc/resolv.conf and resolution order, defined in /etc/nsswitch.conf, if applicable for the particular HP-UX version.

Desktop (CDE,VUE) does not start

Check proper network setup first, in particular IP name resolution defined in /etc/resolv.conf and /etc/nsswitch.conf, if applicable for the particular HP-UX version.
Then check whether one of the following line is enabled
*   Local local /usr/bin/X11/X :0
*   Local local@console /usr/bin/X11/X :0  
in one of the following files Maybe this helps too.

Graphics/colour problems

HP 24-bit display: changing default visual to 8 bit
Last updated: 30-Jan-2010, M.Kraemer