Bug 546622 - parted no longer works properly with loop devices
Summary: parted no longer works properly with loop devices
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: parted
Version: 12
Hardware: All
OS: Linux
urgent
medium
Target Milestone: ---
Assignee: Hans de Goede
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 525900
TreeView+ depends on / blocked
 
Reported: 2009-12-11 13:33 UTC by Josef Bacik
Modified: 2009-12-28 20:05 UTC (History)
5 users (show)

Fixed In Version: 1.9.0-17.2.fc12
Clone Of:
Environment:
Last Closed: 2009-12-18 09:56:21 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Josef Bacik 2009-12-11 13:33:18 UTC
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>
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 18:27:32 UTC
Thanks for the report.  I pushed a patch to fix that from Hans De Goede:

http://git.debian.org/?p=parted/parted.git;a=commitdiff;h=1983b7b517604aade6a317e8384bd5a58f8e20f5

Comment 2 Hans de Goede 2009-12-18 09:56:21 UTC
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 10:11:31 UTC
Hans,

Will be this patch also included in F12 (it's a blocker for 525900)?

Comment 4 Hans de Goede 2009-12-18 10:23:53 UTC
(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 10:32:33 UTC
Thanks, it would be awesone!

Comment 6 Fedora Update System 2009-12-18 10:37:51 UTC
parted-1.9.0-17.1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/parted-1.9.0-17.1.fc12

Comment 7 Jared Smith 2009-12-19 20:50:23 UTC
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:

	http://ftp.gnu.org/gnu/parted/

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:

	http://www.gnu.org/software/parted

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 12:05:55 UTC
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 12:06:54 UTC
parted-1.9.0-17.2.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/parted-1.9.0-17.2.fc12

Comment 10 Jared Smith 2009-12-22 23:22:14 UTC
Thanks!  That appears to have solved the problem for me.

Comment 11 Fedora Update System 2009-12-28 20:05:37 UTC
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.