Thursday 24 July 2014

Editing the /etc/inittab File in Maintenance Mode

Problem(Abstract)

This technote describes a technique for creating a minimal /etc/inittab file if no other tools are available.

Symptom

System hangs or crashes at boot time.

Cause

A bad entry in the /etc/inittab is keeping the system from booting properly.

Resolving the problem

Ordinarily if there is a problem with one or more entries in the /etc/inittab the preferred method of editing it is:

1. Boot into Maintenance Mode off AIX install CDs, mksysb, or NIM
2. Access the rootvg and start a shell with the filesystems mounted.
3. Edit /etc/inittab down to a minimum 3 lines:
init:2:initdefault:
brc::sysinit:/sbin/rc.boot 3 >/dev/console 2>&1 # Phase 3 of system boot
cons:0123456789:respawn:/usr/sbin/getty /dev/console
In cases where the rootvg filesystems cannot be mounted automatically (for example the CD media is a different Technology Level than what exists on hard disk; or the filesystems for some reason won't automatically mount), commands such as the "vi" editor won't be available to edit the inittab.

In this case a hard-luck method can be used to create a minimal inittab.
1. Boot into Maintenance Mode and choose Option 2 "Access rootvg and start a shell before mounting filesystems".

2. Once in Maintenance Mode, fsck all rootvg filesystems necessary:
# fsck /dev/hd1
# fsck /dev/hd2
# fsck /dev/hd3
# fsck /dev/hd4
# fsck /dev/hd9var

3. Mount root on a temporary mount point:
# mount /dev/hd4 /mnt

4. Copy the bad inittab to a backup:
# cd /mnt/etc
# mv inittab inittab.bad

5. Use grep to create a minimal new inittab:
# grep "init:" inittab.bad > inittab (adds both the init: and brc: entries)
# grep "^cons:" inittab.bad >> inittab (adds the cons: entry)

6. Reboot using the new inittab:
# sync; sync; sync
# cd /
# umount /mnt

power cycle the system from the front panel or HMC

0 blogger-disqus:

Post a Comment