Post by Dennis Clarkediskread: reading beyond end of ramdisk
start = 0x2000, size = 0x2000
failed to read superblock
I believe this is a new bug, introduced by the fix for:
6344611 create_ramdisk needs to react less poorly to missing files or directories.
http://cvs.opensolaris.org/source/diff/on/usr/src/cmd/boot/scripts/create_ramdisk.ksh?r2=1.7&r1=1.6
Note how the test on line 99 tests for the existence of the wrong file; it is
missing the ${ALT_ROOT} file prefix. This breaks creating ramdisk boot archives
on a server for diskless clients. I guess it also breaks creating the ramdisk boot
archive during CD/Network installation (because the install target HDD is probably
mounted at "/a" and create_ramdisk is run with option "-R /a", and the getsize
shell function computes a bogus ramdisk size estimate - unless it is run from the
"/a" directory).
I've filed the following bug on bugs.opensolaris.org
(Sorry, I've not yet got the CR / bug id):
=================================================================
In snv_27 /boot/solaris/bin/create_ramdisk is badly broken, it cannot build
boot archives for a Solaris installation in an alternate root any more:
Example (diskless client):
# cd /tmp
# pwd
/tmp
# /export/root/moritz/boot/solaris/bin/create_ramdisk -R /export/root/moritz
Creating ram disk on /export/root/moritz
updating /export/root/moritz/platform/i86pc/boot_archive...this may take a minute
Could not seek to offset -1 in /tmp/create_ramdisk.3228.tmp/rd.file: Invalid argument
mount: I/O error
mount: Cannot mount /dev/lofi/1
umount: warning: /tmp/create_ramdisk.3228.tmp/rd.mount not in mnttab
umount: /tmp/create_ramdisk.3228.tmp/rd.mount not mounted
rmdir: directory "/tmp/create_ramdisk.3228.tmp/rd.mount": Directory not empty
Root cause: the getsize shell function in boot/solaris/bin/create_ramdisk
estimates a size of 0 KBytes for the ramdisk.
94 function getsize {
95 # Estimate image size, add %10 overhead for ufs stuff
96 total_size=0
97 for file in $filelist
98 do
99 if [ -e $file ] ; then
100 du -sk ${ALT_ROOT}/${file} | read size name
101 (( total_size += size ))
102 fi
103 done
104 (( total_size += total_size * 10 / 100 ))
105 }
Of cause the test at line 99 must test "${ALT_ROOT}/${file}", not "$file" !
Workaround:
===========
run create_ramdisk with the current directory set to the alternate root
directory; with the example above:
# cd /export/root/moritz
# /export/root/moritz/boot/solaris/bin/create_ramdisk -R /export/root/moritz
Suggested Fix:
==============
--- usr/src/cmd/boot/scripts/create_ramdisk.ksh~ 2005-11-14 22:11:41.000000000 +0100
+++ usr/src/cmd/boot/scripts/create_ramdisk.ksh 2005-11-19 20:32:19.401462000 +0100
@@ -96,7 +96,7 @@
total_size=0
for file in $filelist
do
- if [ -e $file ] ; then
+ if [ -e ${ALT_ROOT}/$file ] ; then
du -sk ${ALT_ROOT}/${file} | read size name
(( total_size += size ))
fi
This message posted from opensolaris.org