Bug 546622 - parted no longer works properly with loop devices
parted no longer works properly with loop devices
Product: Fedora
Classification: Fedora
Component: parted (Show other bugs)
All Linux
urgent Severity medium
: ---
: ---
Assigned To: Hans de Goede
Fedora Extras Quality Assurance
Depends On:
Blocks: 525900
  Show dependency treegraph
Reported: 2009-12-11 08:33 EST by Josef Bacik
Modified: 2009-12-28 15:05 EST (History)
5 users (show)

See Also:
Fixed In Version: 1.9.0-17.2.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-12-18 04:56:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Josef Bacik 2009-12-11 08:33:18 EST
When using the Fedora 12 version of parted, doing a mklabel on a loop device fails, which causes problems for the appliance maker application which does just that.

If you do the following

dd if=/dev/zero of=file.img bs=1M count=1 seek=1024
losetup /dev/loop0 file.img
parted /dev/loop0 -s mkabel msdos

it will fail with

Warning: The kernel was unable to re-read the partition table on /dev/loop0 (Invalid argument).  This means Linux won't know anything about the modifications you made until you reboot.  You should reboot your computer before doing anything with /dev/loop0.

but in Fedora 11 it would work just fine.

I did a git bisect and this commit is to blame

commit 1d8f9bece138e4d8e58f7b059b4195aff6f39deb
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Fri Aug 28 10:29:00 2009 +0200

    linux-commit: remove the use of the BLKPG ioctl
Comment 1 Jim Meyering 2009-12-11 13:27:32 EST
Thanks for the report.  I pushed a patch to fix that from Hans De Goede:

Comment 2 Hans de Goede 2009-12-18 04:56:21 EST
Thanks for the report, I've backported the mentioned patch to the Fedora parted version, this is fixed in parted-1.9.0-24.fc13.
Comment 3 Marek Goldmann 2009-12-18 05:11:31 EST

Will be this patch also included in F12 (it's a blocker for 525900)?
Comment 4 Hans de Goede 2009-12-18 05:23:53 EST
(In reply to comment #3)
> Hans,
> Will be this patch also included in F12 (it's a blocker for 525900)?  

I was not planning on doing any parted changes for F12, but since you ask I'll cherry pick some from the (large) -24 update and do an F-12 build.
Comment 5 Marek Goldmann 2009-12-18 05:32:33 EST
Thanks, it would be awesone!
Comment 6 Fedora Update System 2009-12-18 05:37:51 EST
parted-1.9.0-17.1.fc12 has been submitted as an update for Fedora 12.
Comment 7 Jared Smith 2009-12-19 15:50:23 EST
I downloaded the RPM mention in comment #6 via koji, but now parted is segfaulting on me:

[root@hockey tmp]# dd if=/dev/zero of=file.img bs=1M count=1 seek=1024
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.00204933 s, 512 MB/s
[root@hockey tmp]# losetup /dev/loop0 file.img
losetup: /dev/loop0: device is busy
[root@hockey tmp]# parted /dev/loop0 -s mkabel msdos

You found a bug in GNU Parted! Here's what you have to do:

Don't panic! The bug has most likely not affected any of your data.
Help us to fix this bug by doing the following:

Check whether the bug has already been fixed by checking
the last version of GNU Parted that you can find at:


Please check this version prior to bug reporting.

If this has not been fixed yet or if you don't know how to check,
please visit the GNU Parted website:


for further information.

Your report should contain the version of this release (1.9.0)
along with the error message below, the output of

	parted DEVICE unit co print unit s print

and the following history of commands you entered.
Also include any additional information about your setup you
consider important.

Command History:
Segmentation fault (core dumped)


I also took a look at the backtrace in gdb:

Core was generated by `parted /dev/loop0 -s mkabel msdos'.
Program terminated with signal 11, Segmentation fault.
#0  _dump_history () at ui.c:286
286	        while (all_entries[i]) {
(gdb) bt
#0  _dump_history () at ui.c:286
#1  0x000000000040b5a3 in sa_sigfpe_handler (signum=<value optimized out>, 
    info=0x7fff2d40eb30, ucontext=<value optimized out>) at ui.c:373
#2  <signal handler called>
#3  0x00007f0cc200ae6c in _device_get_length (dev=0x1e8b380)
    at arch/linux.c:673
#4  0x00007f0cc200d8ce in init_file (dev=<value optimized out>)
    at arch/linux.c:1023
#5  linux_new (dev=<value optimized out>) at arch/linux.c:1283
#6  0x00007f0cc20014fb in ped_device_get (path=<value optimized out>)
    at device.c:190
#7  0x000000000040636d in _choose_device (argc_ptr=0x7fff2d40f13c, 
    argv_ptr=<value optimized out>) at parted.c:2419
#8  0x0000000000409fa1 in _init (argc_ptr=<value optimized out>, 
    argv_ptr=0x7fff2d40f130) at parted.c:2469
#9  0x000000000040a07c in main (argc=3, argv=0x7fff2d40f248) at parted.c:2522
Comment 8 Hans de Goede 2009-12-20 07:05:55 EST
Oops, seems like a simple backport of the fix did not suffice, sorry about that.

This is really fixed in parted-1.9.0-17.2.fc12, which will go to the updates repo soon.
Comment 9 Fedora Update System 2009-12-20 07:06:54 EST
parted-1.9.0-17.2.fc12 has been submitted as an update for Fedora 12.
Comment 10 Jared Smith 2009-12-22 18:22:14 EST
Thanks!  That appears to have solved the problem for me.
Comment 11 Fedora Update System 2009-12-28 15:05:37 EST
parted-1.9.0-17.2.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

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