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. Enter:
          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. Enter:
          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 of 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 operating system level as the system. See the document "Booting in Service Mode" if there are any questions about booting your particular machine into Service mode. 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 sequence of commands.

         mount /dev/hd4 /mnt
         mount /dev/hd2 /mnt/usr
         cd /mnt
    

  2. If the symbolic link from /usr/lib/libc.a to /usr/ccs/lib/libc.a 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. Enter:
           cd /mnt/usr/sbin
           ./sync;./sync;./sync
    
  6. Unmount the /usr file system. Enter:
           cd /
           umount /dev/hd2
    
    If that commands fails, turn the key to Normal mode, if applicable, and reboot.

  7. Unmount the / (root) file system. Enter:
           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.




[ Doc Ref: 91132263813142     Publish Date: Feb. 05, 2001     4FAX Ref: 2158 ]