Build kernel error while copying bootfs directory
Abstract
This article explain one of the causes for an error copying the bootfs directory when rebuilding a kernel on HP-UX 11i v2 (11.23) and HP-UX 11i v3 (11.31).
Contents
Error while copying bootfs directory
While rebuilding the kernel, for example during an installation of a kernel based product (IPFilter, Auto-Port Aggregation) or a rebuild of the kernel to enable or disable modules, the following error message is displayed:
Installing software:
ERROR: Error while copying bootfs directory
ERROR: The command "/usr/sbin/mk_kernel", which is used to rebuild
the kernel, has failed. Because kernel-related filesets were
installed, this command must be executed by "swinstall",
without failures, before the load can continue. Check the
above output for details about the failure.
Manually rebuilding the kernel:
# kconfig -s testbuild
Error while copying bootfs directory
Review /stand/current directory
When the current kernel is saved previous to perform changes to the modules, a backup copy is take copying the content of /stand/current to /stand/<newkernel>.. Review the /stand/current directory:
# find /stand/current -exec ll -d {} \;
drwxr-xr-x 5 root root 1024 Nov 2 12:06 /stand/current
-rwxr-xr-x 2 root sys 27034904 Nov 1 06:00 /stand/current/vmunix
-rw-r--r-- 1 root root 0 Nov 2 12:06 /stand/current/.config
drwxr-xr-x 2 root root 1024 Nov 4 13:32 /stand/current/mod
-r-xr--r-- 1 bin bin 177856 Sep 14 07:57 /stand/current/mod/pfil
-r-xr--r-- 1 bin bin 562136 Sep 14 08:19 /stand/current/mod/ipf
-r--r--r-- 1 bin bin 69416 Aug 27 2004 /stand/current/mod/rng
-r-xr-xr-x 1 bin bin 2183 Mar 26 2004 /stand/current/mod/rng.prep
drwxr-xr-x 2 root root 1024 Nov 4 13:34 /stand/current/krs
-rw-r--r-- 1 root root 87688 Nov 4 13:34 /stand/current/krs/config.krs
-rw-r--r-- 1 root root 87688 Nov 4 13:26 /stand/current/krs/config.krs.lkg
drwxr-xr-x 3 root root 1024 Nov 2 12:06 /stand/current/bootfs
drwxr-xr-x 3 root root 1024 Nov 2 12:06 /stand/current/bootfs/stand
drwxr-xr-x 4 root root 1024 Nov 2 12:06 /stand/current/bootfs/stand/current
drwxr-xr-x 2 root root 1024 Nov 2 12:06 /stand/current/bootfs/stand/current/krs
lrwxr-xr-x 1 root root 0 Nov 2 12:06 /stand/current/bootfs/stand/current/krs/config.krs ->
lrwxr-xr-x 1 root root 0 Nov 2 12:06 /stand/current/bootfs/stand/current/krs/config.krs.lkg ->
drwxr-xr-x 2 root root 1024 Nov 4 13:32 /stand/current/bootfs/stand/current/mod
lrwxr-xr-x 1 root root 20 Nov 4 13:32 /stand/current/bootfs/stand/current/mod/pfil -> ../../../../mod/pfil
lrwxr-xr-x 1 root root 19 Nov 4 13:32 /stand/current/bootfs/stand/current/mod/ipf -> ../../../../mod/ipf
lrwxr-xr-x 1 root root 0 Nov 2 12:06 /stand/current/bootfs/stand/current/mod/rng ->
-rw-r--r-- 1 root root 3224 Nov 4 13:33 /stand/current/system
-rw-r--r-- 1 root root 0 Nov 2 12:06 /stand/current/README
The previous output show that some soflinks inode size is 0 and do not point to it's source file. An output limited to the softlinks at /stand/current directory:
#find /stand/current -exec ll -d {} \; | grep ^[l]
lrwxr-xr-x 1 root root 0 Nov 2 12:06 /stand/current/bootfs/stand/current/krs/config.krs ->
lrwxr-xr-x 1 root root 0 Nov 2 12:06 /stand/current/bootfs/stand/current/krs/config.krs.lkg ->
lrwxr-xr-x 1 root root 20 Nov 4 13:32 /stand/current/bootfs/stand/current/mod/pfil -> ../../../../mod/pfil
lrwxr-xr-x 1 root root 19 Nov 4 13:32 /stand/current/bootfs/stand/current/mod/ipf -> ../../../../mod/ipf
lrwxr-xr-x 1 root root 0 Nov 2 12:06 /stand/current/bootfs/stand/current/mod/rng ->
Solution
1. Recreate the softlinks.
# cd /stand/current/bootfs/stand/current/krs/
# ls -l ../../../../krs/config.krs
-rw-r--r-- 1 root root 87688 Nov 4 13:34 ../../../../krs/config.krs
# rm config.krs
# ln -s ../../../../krs/config.krs config.krs
# ls -l ../../../../krs/config.krs.lkg
-rw-r--r-- 1 root root 87688 Nov 4 13:26 ../../../../krs/config.krs.lkg
# rm config.krs.lkg
# ln -s ../../../../krs/config.krs.lkg config.krs.lkg
# cd /stand/current/bootfs/stand/current/mod
# rm rng
# ln -s ../../../../mod/rng rng
# cd /
2. Check that each module softlink points to the corresponding module file.
# find /stand/current -exec ll -d {} \; | grep ^[l]
lrwxr-xr-x 1 root sys 26 Nov 4 21:05 /stand/current/bootfs/stand/current/krs/config.krs -> ../../../../krs/config.krs
lrwxr-xr-x 1 root sys 30 Nov 4 21:06 /stand/current/bootfs/stand/current/krs/config.krs.lkg -> ../../../../krs/config.krs.lkg
lrwxr-xr-x 1 root root 20 Nov 4 13:32 /stand/current/bootfs/stand/current/mod/pfil -> ../../../../mod/pfil
lrwxr-xr-x 1 root root 19 Nov 4 13:32 /stand/current/bootfs/stand/current/mod/ipf -> ../../../../mod/ipf
lrwxr-xr-x 1 root sys 19 Nov 4 21:07 /stand/current/bootfs/stand/current/mod/rng -> ../../../../mod/rng
3. Test kernel backup and build. Remove a kernel module, for example schgr for testing purposes only.
# kconfig -s testbuild
* The current configuration has been saved to 'testbuild'.
# kcmodule -c testbuild schgr=unused
* Building a new kernel for configuration 'testbuild'...
* Adding version information to new kernel...
* The requested changes have been applied to configuration
'testbuild'.
Module State Cause
schgr (before) static explicit
(now) unused
# kconfig -d testbuild
WARNING: It is not possible to recover a deleted configuration.
==> Delete the configuration 'testbuild'? y
* The configuration 'testbuild' has been deleted.
Note: On this case, the issue was limited to the softlinks. It's possible that the actual modules pointed by the softlinks where damaged. In that case, recover the modules from a backup of the files, if available or any other suitable file source prior to recreate the softlinks.
Reference
- SAW: HP-UX 11i - Kernel - While building new kernel got "Error while copying bootfs directory" error message
- WFM: 4605841956
- HP Servers and Workstations: Managing Systems and Workgroups HP-UX 11i Version 2) - Chapter 3: Configuring a System Reconfiguring the Kernel
- HP-UX System Administrator's Guide: Configuration Management (HP-UX 11i Version 3) - Chapter 10: Configuring the Kernel