Bug 1195478 - livecd-iso-to-disk appears to hang because parted is requesting input
Summary: livecd-iso-to-disk appears to hang because parted is requesting input
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: livecd-tools
Version: 21
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-23 21:59 UTC by Bob Nolty
Modified: 2015-07-29 01:38 UTC (History)
7 users (show)

Fixed In Version: livecd-tools-21.6-1.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-07-29 01:38:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Bob Nolty 2015-02-23 21:59:24 UTC
Description of problem:

I ran 

livecd-iso-to-disk --format --reset-mbr --efi ISOs/Fedora-20-i386-DVD.iso /dev/sdc

It did a media check and I pressed ENTER to continue.  After a few seconds it printed 'mkfs.fat ...' and then appeared to hang.  After several minutes, the relevant part of ps -faux was:


root      2459  0.0  0.0 113844  3460 pts/0    S+   11:51   0:00  |           \_ /bin/bash /bin/livecd-iso-to-disk --format --reset-
root      2554  0.0  0.0 113844  2140 pts/0    S+   11:52   0:00  |               \_ /bin/bash /bin/livecd-iso-to-disk --format --re
root      2555  0.0  0.1  44584  4008 pts/0    S+   11:52   0:00  |                   \_ /sbin/parted -m /dev/sdc p
root      2556  0.0  0.0 113000  2288 pts/0    S+   11:52   0:00  |                   \_ grep -ic :gpt:

(Note I ran the ps command at 12:01.)

In another terminal, I attached strace to the parted process, and it was hung on a 'read(0,' syscall where, according to /proc/2555/fd, fd 0 was still the terminal where I ran the command, but fd 1 was a pipe (presumably the other end was held by its sibling grep process?).  I typed ENTER in the window where livecd-iso-to-disk was running, and got some action in my strace.  I saw in the strace that parted was writing a prompt to fd 1 that ended with 'OK/Cancel?'.  But that didn't show up in the terminal where livecd-iso-to-disk was running.  I typed "OK<ENTER>" in the terminal running livecd-iso-to-disk, and the process ran to completion (in my case it exited saying that the ISO did not support EFI).

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

Fedora 22 (3.18.5-201.fc21.x86_64)
livecd-tools-21.4-1.fc21.x86_64
parted-3.2-4.fc21.x86_64

How reproducible:

I believe it depends on what the partition table of the target disk looks like.  When I run the command a second time (when the disk is GPT-partitioned with a single EFI-type partition), it runs to completion.  But if I put in a newly-purchased USB stick that is msdos-partitioned and has a single 'W95 Fat32' partition, I get the apparent hang.

Steps to Reproduce:
1.  Insert a USB stick whose partition table reads something like:
...
Disklabel type: dos
...
Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1         712 32767999 32767288 15.6G  b W95 FAT32

2.run 'livecd-iso-to-disk --format --reset-mbr --efi ISOs/Fedora-20-i386-DVD.iso /dev/sdc'

Actual results:

Process appears to hang, though it is really awaiting terminal input that has not been prompted for.


Expected results:

Prompt appears any time terminal input is required.


Additional info:

If, as I presume, the parent process is piping the output of parted to grep, then the fix will be tricky.  Either change the behavior of parted (perhaps to prompt on stderr instead of stdout?) or get rid of grep and have the parent process poll stdout of parted.

Comment 1 Brian Lane 2015-02-25 18:42:09 UTC
What version of livecd-iso-to-disk is this? All calls to parted should have -s or --script passed to them so that they don't prompt and take the safe action when there is a problem.

Comment 2 Bob Nolty 2015-02-27 20:18:57 UTC
Thanks for looking into it -- as I said above, I am using the package

livecd-tools-21.4-1.fc21.x86_64

I don't see a version number in the file itself.

I didn't realize when I was filing that the program is a shell script --

I looked at all the lines that contain parted.*grep, and all but one pass -s or --script.  The one that got me was in checkGPT(), line 545, 

    if [ "$(LC_ALL=C /sbin/parted -m $device p 2>/dev/null |grep -ic :gpt:)" -eq "0" ]; then

Comment 3 Brian Lane 2015-06-08 19:40:02 UTC
This will be fixed in the next build.

Comment 4 Fedora Update System 2015-06-08 21:35:28 UTC
livecd-tools-21.6-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/livecd-tools-21.6-1.fc21

Comment 5 Fedora Update System 2015-06-10 19:11:57 UTC
Package livecd-tools-21.6-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing livecd-tools-21.6-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-9716/livecd-tools-21.6-1.fc21
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2015-07-29 01:38:22 UTC
livecd-tools-21.6-1.fc21 has been pushed to the Fedora 21 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.