Bug 1099475

Summary: sfdisk: BLKRRPART: Device or resource busy
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: leiwang, ptoscano, wshi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1099292 Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1099292    
Attachments:
Description Flags
log.txt none

Description Richard W.M. Jones 2014-05-20 12:02:40 UTC
Created attachment 897549 [details]
log.txt

+++ This bug was initially created as a clone of Bug #1099292 +++

Description of problem:

Run this command (all on a single line)

while guestfish -v -x -N fs sfdisk /dev/sda 0 0 0 "1,100,83" > /tmp/log 2>&1; do echo -n . ; done

After a very few iterations it will fail with some kind of udev problem.
I believe this is actually a bug in sfdisk or udev.

Version-Release number of selected component (if applicable):

libguestfs-1.27.11-2.fc21.x86_64
systemd-208-16.fc20.x86_64
util-linux-2.24.2-1.fc20.x86_64
kernel 3.14.3-200.fc20.x86_64

How reproducible:

Unknown, not 100%, but the above test will see the problem after a few
iterations.

Comment 1 Richard W.M. Jones 2014-05-20 12:04:06 UTC
The full error is:

sfdisk /dev/sda
sfdisk: Checking that no-one is using this disk right now ...
[    1.872241]  sda: sda1
sfdisk: OK

Disk /dev/sda: 1024 cylinders, 4 heads, 50 sectors/track
Old situation:
sfdisk: Warning: The partition table looks like it was made
  for C/H/S=*/189/49 (instead of 1024/4/50).
For this listing I'll assume that geometry.
Units: cylinders of 4741632 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          0+     22-     23-    102272+  83  Linux
\t\tstart: (c,h,s) expected (0,2,31) found (0,2,3)
\t\tend: (c,h,s) expected (22,18,49) found (12,188,49)
/dev/sda2          0       -       0          0    0  Empty
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
New situation:
Units: cylinders of 102400 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1          1     100     100      10000   83  Linux
/dev/sda2          0       -       0          0    0  Empty
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
sfdisk: Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table ...
sfdisk: BLKRRPART: Device or resource busy
sfdisk: The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs
sfdisk: If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)