Bug 54352 - cannot partition /tmp/sdb in %post
cannot partition /tmp/sdb in %post
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: anaconda (Show other bugs)
7.3
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jeremy Katz
Mike McLean
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-10-04 13:30 EDT by Michael E Brown
Modified: 2007-04-18 12:37 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-07-28 18:40:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
kickstart %post section (4.41 KB, text/plain)
2001-10-04 13:31 EDT, Michael E Brown
no flags Details
dmesg output (after first 'fdisk' attempt). Note the last line. (8.61 KB, text/plain)
2001-10-04 13:32 EDT, Michael E Brown
no flags Details
lsof output, from before any partitioning (fdisk) takes place. Note "/tmp/sdb (deleted)" entry. (8.16 KB, text/plain)
2001-10-04 13:33 EDT, Michael E Brown
no flags Details
ps aux output (1.46 KB, text/plain)
2001-10-04 13:34 EDT, Michael E Brown
no flags Details
stderr output from kickstart file. (1.33 KB, text/plain)
2001-10-04 13:34 EDT, Michael E Brown
no flags Details
stdout output from kickstart file. (1.70 KB, text/plain)
2001-10-04 13:35 EDT, Michael E Brown
no flags Details
script that fails in %post (2.42 KB, text/plain)
2002-09-24 14:51 EDT, Michael E Brown
no flags Details
updated script to work around bug. (2.25 KB, text/plain)
2002-09-24 15:59 EDT, Michael E Brown
no flags Details

  None (edit)
Description Michael E Brown 2001-10-04 13:30:56 EDT
Description of Problem:

In our install, we install the OS to sda, and we have a section in %post
that will automatically partition and mke2fs on any remaining disks. This
does not work when you have an uninitialized partition table (eg. 'dd
if=/dev/zero of=/dev/sdb bs=512 count=100' ). Fdisk returns with the error:

Calling ioctl() to re-read partition table.
Re-read table failed with error 16: Device or resource busy.
Reboot your system to ensure the partition table is updated.

And, in the system 'dmesg' output, I see this error: 

Device busy for revalidation (usage=2)

When our 'mke2fs' runs, we get this error:

/sbin/mke2fs: No such device or address while trying to determine
filesystem size

I believe that these errors are due to this (lsof output):

sh      720 root   14u   BLK    8,0              148 /tmp/sda (deleted)
sh      720 root   15u   BLK   8,16              149 /tmp/sdb (deleted)

which corresponds to this 'ps aux' output:


USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root         1  1.4  0.0     0    0 ?        SW   06:11   0:03 [swapper]
root         2  0.0  0.0     0    0 ?        SW   06:11   0:00 [keventd]
root         3  0.0  0.0     0    0 ?        SWN  06:11   0:00 [ksoftirqd_CPU0]
root         4  0.1  0.0     0    0 ?        SW   06:11   0:00 [kswapd]
root         5  0.0  0.0     0    0 ?        SW   06:11   0:00 [kreclaimd]
root         6  0.1  0.0     0    0 ?        SW   06:11   0:00 [bdflush]
root         7  0.1  0.0     0    0 ?        SW   06:11   0:00 [kupdated]
root         8  0.0  0.0     0    0 ?        SW<  06:11   0:00 [mdrecoveryd]
root         9  0.0  0.0    20   20 tty1     S    06:11   0:00 linuxrc
root        10  0.0  0.0    20   20 tty1     S    06:11   0:00 linuxrc
root        11  0.9  2.1  8072 5372 tty1     S    06:11   0:02
/usr/bin/python /
root        24  0.0  0.0     0    0 tty1     SW   06:11   0:00 [khubd]
root        46  0.0  0.0     0    0 tty1     SW<  06:11   0:00 [loop0]
root        47  0.0  0.4  2020 1084 tty2     S    06:11   0:00 -/bin/sh
root        75  6.6  0.8 15440 2088 tty1     S    06:11   0:15
/usr/X11R6/bin/XF
root        77 31.3 17.1 48552 43908 tty1    S    06:11   1:09
/usr/bin/python /
root       106  0.0  0.7  3480 2000 tty1     S    06:12   0:00
/usr/bin/python /
root       720  0.0  0.4  2420 1156 tty1     S    06:15   0:00 /bin/sh
/tmp/ks-s
root       736  0.0  0.2  2632  720 tty1     R    06:15   0:00 ps aux

Note that process ID 720 is the '/bin/sh' process running %post. I am
attaching our kickstart %post section, as well as the lsof, and ps listing.

Please note that this process works perfectly on any disk, except one that
has zeros in the partition table.

Version-Release number of selected component (if applicable): 
Red Hat Linux 7.2 (gold)

How Reproducible:
Use the attached kickstart file on a two-disk scsi system. write zeros to
the partition table of the second disk.
Comment 1 Michael E Brown 2001-10-04 13:31:36 EDT
Created attachment 33378 [details]
kickstart %post section
Comment 2 Michael E Brown 2001-10-04 13:32:35 EDT
Created attachment 33379 [details]
dmesg output (after first 'fdisk' attempt). Note the last line.
Comment 3 Michael E Brown 2001-10-04 13:33:34 EDT
Created attachment 33380 [details]
lsof output, from before any partitioning (fdisk) takes place. Note "/tmp/sdb (deleted)" entry.
Comment 4 Michael E Brown 2001-10-04 13:34:02 EDT
Created attachment 33381 [details]
ps aux output
Comment 5 Michael E Brown 2001-10-04 13:34:42 EDT
Created attachment 33382 [details]
stderr output from kickstart file.
Comment 6 Michael E Brown 2001-10-04 13:35:05 EDT
Created attachment 33383 [details]
stdout output from kickstart file.
Comment 7 Michael E Brown 2001-10-04 14:11:19 EDT
In addition, anaconda gives the following error on VT3 during partitioning (from
memory, may be slightly off):

zeroMBA specified but invalid partition table specified on sdb

I would like to postulate that anaconda is missing a "close" in the error-path,
and all of it's children are inheriting this open file descriptor.
Comment 8 Michael Fulbright 2001-10-11 11:09:02 EDT
Jeremy please look at this report.
Comment 9 Jeremy Katz 2001-10-11 15:26:59 EDT
Yes, the diskset is not getting closed prior to the end of the installation... 
testing a small update to fix this now
Comment 10 Brent Fox 2001-10-18 10:57:54 EDT
katzj, any progress with this?
Comment 11 Jeremy Katz 2001-10-18 11:20:36 EDT
Working on this and a few other things at once.  Original patch still leaves
something with a dangling reference to the disk.
Comment 12 Brent Fox 2001-11-05 10:14:32 EST
Is the patch working now?
Comment 13 Jeremy Katz 2001-11-05 12:35:05 EST
Nope, and still not sure what's holding the reference
Comment 14 Matt Domsch 2001-12-11 11:32:36 EST
Any update on this?
Comment 15 Jeremy Katz 2001-12-12 15:51:36 EST
Nope, still looking off and on when I'm not being pulled in ten other directions
though
Comment 16 Jeremy Katz 2002-02-13 15:07:51 EST
We're currently hitting other areas where partition tables aren't being reread
properly in Hampton, so hopefully cleaning some of those up will help with this
one too.  If not, it should at least be easier to figure out at least where it's
leaking with some of the other cleanups.
Comment 17 Jeremy Katz 2002-03-14 19:31:09 EST
Still doesn't seem to get it.  Matt -- when there's a parted exception, are the
disk references being closed properly?
Comment 18 Michael Fulbright 2002-03-26 12:46:33 EST
Deferring to future release.
Comment 19 Michael E Brown 2002-09-24 14:45:43 EDT
I am hitting this in RH 8.0 -Final-.
Comment 20 Michael E Brown 2002-09-24 14:51:24 EDT
Created attachment 77065 [details]
script that fails in %post
Comment 21 Michael E Brown 2002-09-24 15:58:26 EDT
just created a workaround for this issue. It doesn't address the underlying bug,
but it does work around it nicely.

Instead of using /dev/sdb1 as the PV for the VG, I am just using /dev/sdb directly.

New script will be attached. Please let me know if you know of anything that
will break because of this.
Comment 22 Michael E Brown 2002-09-24 15:59:45 EDT
Created attachment 77067 [details]
updated script to work around bug.
Comment 23 Michael Fulbright 2002-09-24 16:09:40 EDT
There have been no guarantees made about what commands can be run in the %post,
other than the installed system will be available as /mnt/sysimage.

Your only option is to change the way you create your partitions so that you
decide which drives will be used for what filesystems in the %pre, then write
out the appropriate kickstart partitioning commands to a temporary file, and
finally include that temporary file using the kickstart %include mechanism we
added in 7.3 to address this exact type of on-the-fly dynamic kickstart
situations.  This way you don't have to worry about catching this kind of
side-effect as you are now experiencing during the beta cycle when we could do
something about it.

Anyhow, to do this in a %pre you would just have something very similar to your
%post script that would run and detect the available block devices. You then can
write out ks 'part' rules for swap, '/', '/boot', etc as well as rules for the
remaining devices to go into the '/data' LVM mount.

Comment 24 Michael Fulbright 2002-10-24 13:58:35 EDT
This issue report has been quiet for some time and I wanted to check if there
was any further comments before I close it.
Comment 25 Jeremy Katz 2003-07-28 18:40:45 EDT
Assuming based on the lack of response to msf's comment that this isn't a
problem any more.  Please reopen if it is.

Note You need to log in before you can comment on or make changes to this bug.