Restoring a Deleted libc.a System Library


Contents

About This Document
Recovering a Deleted Symbolic Link in /usr/lib
Recovering a Deleted /usr/ccs/lib/libc.a System Library File

About This Document

This procedure documents how to recover the libc.a system library if the link in /usr/lib or file in /usr/ccs/lib has been accidentally removed. This document applies to AIX Versions 4.x.

Recovering a Deleted Symbolic Link in /usr/lib

If the symbolic link from /usr/lib/libc.a to /usr/ccs/lib/libc.a has been removed and a system shell prompt exists, the following steps can be used to recover the symbolic link.

  1. Set the environment variable LIBPATH to point to the /usr/ccs/lib directory.
          LIBPATH=/usr/ccs/lib:/usr/lib
          export LIBPATH
    
  2. You should be able to execute system commands at this point. Run the following command to re-link /usr/lib/libc.a to /usr/ccs/lib/libc.a.
          ln -s /usr/ccs/lib/libc.a /usr/lib/libc.a
    
  3. Unset the LIBPATH environment variable. At this point, commands should run as before.
          unset LIBPATH
    
    If you don't have a shell accessible to execute this command, follow the instructions in the next section.

Recovering a Deleted /usr/ccs/lib/libc.a System Library File

To recover from a deleted /usr/ccs/lib/libc.a system file, the system must be booted off external media, since no commands can run in the machine's current state.

The machine should be booted from a CD-ROM or NON_AUTOINSTALL mksysb tape of the same OSLEVEL as the system. Access the rootvg volume group without mounting the file systems. Use a recent mksysb of the system to retrieve the libc.a file. Afterward, proceed through the following steps.

  1. Execute the following commands.

    1. mount /dev/hd4 /mnt
    2. mount /dev/hd2 /mnt/usr
    3. cd /mnt

  2. If the symbolic link from /usr/lib/libc.a to /usr/ccs/lib/libc.a needs needs to be restored, run the following command and skip to step 5.
          ln -s /usr/ccs/lib/libc.a /mnt/usr/lib/libc.a
    
  3. Insert the mksysb tape in the tape drive and issue the following commands. Replace X with the appropriate number for the tape drive device.

    First you will need to set the block size of the tape drive. By default the device driver in maintenance mode will be set to a block size 512.

    1. tctl -f /dev/rmtX rewind
    2. tctl -f /dev/rmtX.Y fsf 1
    3. restbyname -xvqf /dev/rmtX.Y ./tapeblksz
    4. cat tapeblksz
    5. If the value from step d is not equal to 512, execute: /etc/methods /chggen -l rmtX -a block_size=<value from d>
    6. tctl -f /dev/rmtX rewind
    7. tctl -f /dev/rmtX.1 fsf 3

  4. Now use the restbyname command to restore the missing file. Replace X with the appropriate number for the tape drive device.

    1. Execute tctl -f /dev/rmtX rewind

    2. Execute tctl -f /dev/rmtX.1 fsf 3

    3. IF YOU NEED TO RESTORE /usr/ccs/lib/libc.a, execute:
                       restbyname -xvqf/dev/rmtX.Y ./usr/ccs/lib/libc.a
      
    4. IF YOU NEED TO RESTORE THE /usr/ccs/lib DIRECTORY, execute:
                       restbyname -xvqf/dev/rmtX.Y ./usr/ccs/lib
      
    5. IF YOU NEED TO RESTORE THE /usr/ccs/bin DIRECTORY, execute:
                       restbyname -xvqf/dev/rmtX.Y ./usr/ccs/bin
      
  5. Flush the data to disk.
           cd /mnt/usr/sbin
           ./sync;./sync;./sync
    
  6. Unmount the /usr file system:
           cd /
           umount /dev/hd2
    
    If that commands fails, turn the key to Normal mode, if applicable, and reboot.

  7. Unmount the / file system:
           umount /dev/hd4
    
    If that commands fails, turn the key to Normal mode, if applicable, and reboot.

  8. Boot the system in Normal mode: turn the key to Normal position, if applicable, and power cycle the machine.


Restoring a Deleted libc.a System Library: libc.a.fix.4x.krn ITEM: FAX
Dated: 99/01/08~00:00 Category: krn
This HTML file was generated 99/06/24~12:42:08
Comments or suggestions?
Contact us