Bug 735398 - parted -s mklabel should not prompt the user for input
Summary: parted -s mklabel should not prompt the user for input
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: parted
Version: 6.1
Hardware: All
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Brian Lane
QA Contact: Release Test Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-02 15:02 UTC by J.H.M. Dassen (Ray)
Modified: 2018-11-27 21:25 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-12 21:18:32 UTC


Attachments (Terms of Use)

Description J.H.M. Dassen (Ray) 2011-09-02 15:02:19 UTC
What is the nature and description of the request?

The customer has identified that the -s scripted option related to parted
becomes interactive under certain circumstances. They would like to request the
introduction of a '--force' option to be used if desired with the -s scripted
option within the 'parted' command. 

The issue they used as an example is as follows. When running parted as part of
a Puppet script in their deployment environment, NYSE intermittently receive
the following warnnigs/errors:

---
//Node[frobdignag.bar.foo.com]/foo_ukd/ukd_utpds::setup/ukd_utpds::filesystems_qa/ukd_utpds::filesystems_qa::create_partitions/Lvm::
Create_partition[c1d3p1]/Exec[create_partition-/dev/cciss/c1d3p1]/returns: Warning: /dev/cciss/c1d3 contains GPT signatures, indicating
that it has a GPT table. However, it does not have a valid fake msdos partition table, as it should. Perhaps it was corrupted --
possibly by a program that doesn't understand GPT partition tables. Or perhaps you deleted the GPT table, and are now using an msdos
partition table. Is this a GPT partition table?
notice:
//Node[frobdignag.bar.foo.com]/foo_ukd/ukd_utpds::setup/ukd_utpds::filesystems_qa/ukd_utpds::filesystems_qa::create_partitions/Lvm::
Create_partition[c1d3p1]/Exec[create_partition-/dev/cciss/c1d3p1]/returns: Error: Unable to satisfy all constraints on the partition.
err:
//Node[frobdignag.bar.foo.com]/foo_ukd/ukd_utpds::setup/ukd_utpds::filesystems_qa/ukd_utpds::filesystems_qa::create_partitions/Lvm::
Create_partition[c1d3p1]/Exec[create_partition-/dev/cciss/c1d3p1]/returns: change from notrun to 0 failed: /sbin/parted -s
/dev/cciss/c1d3 -- mkpart primary 0 -1 returned 1 instead of 0 at /var/puppet/1.7.15/modules-base/lvm/manifests/init.pp:242
notice:
//Node[frobdignag.bar.foo.com]/foo_ukd/ukd_utpds::setup/ukd_utpds::filesystems_qa/ukd_utpds::filesystems_qa::create_partitions/Lvm::
Create_partition[c1d3p1]/Exec[lvm_pvcreate-/dev/cciss/c1d3p1]: Dependency exec[/sbin/parted -s /dev/cciss/c1d3 -- mkpart primary 0 -1]
has 1 failures
warning:
//Node[frobdignag.bar.foo.com]/foo_ukd/ukd_utpds::setup/ukd_utpds::filesystems_qa/ukd_utpds::filesystems_qa::create_partitions/Lvm::
Create_partition[c1d3p1]/Exec[lvm_pvcreate-/dev/cciss/c1d3p1]: Skipping because of failed dependencies
---

When run manually against the same LUN, the following interactivity ensues:

---
# parted /dev/cciss/c1d3
GNU Parted 1.8.1
Using /dev/cciss/c1d3
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel gpt
Warning: The existing disk label on /dev/cciss/c1d3 will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: gpt
Yes/No? no
(parted) quit
Information: Don't forget to update /etc/fstab, if necessary.
#
---

It could be the case that the volumes you are trying to set GPT on, upon which this error is manifesting itself may have been setup previously by a different tool. The tool may not have properly set up the fake msdos partition table (which keeps older tools from clobbering the GPT partitions). 

In this type of scenario, it would be useful to have a '--force' option to
include in the scripted command.

	Why does the customer need this? (List the business requirements here)

To overcome the issue described above. The problem impacts their Puppet
configuration capabilities.

	How would the customer like to achieve this? (List the functional
	requirements here)

To be able to run 'parted -s --force', etc... to overcome warnings such as the
following automatically: 

---
Warning: The existing disk label on /dev/cciss/c1d3 will be destroyed and all data on this disk will be lost. Do you want to continue?
parted: invalid token: gpt
---

	For each functional requirement listed in question 4, specify how Red
	Hat and the customer can test to confirm the requirement is
	successfully implemented.

Through the ability to run the scripted command on a LUN manifesting this type
of error/warning and be able to use --force to automatically continue.

	Is there already an existing RFE upstream or in Red Hat bugzilla?

Not that I can find.

	How quickly does this need resolved? (desired target release)

As soon as possible.

	Does this request meet the RHEL Bug and Feature Inclusion Criteria
	(please review)

Yes.

	List the affected packages

parted

	Would the customer be able to assist in testing this functionality if
	implemented?

Yes.

Comment 1 Brian Lane 2011-09-02 15:44:24 UTC
I don't think that implementing a full --force feature is a good idea. But for this specific case parted really shouldn't be prompting since you are telling it to make a new label anyway. So I'd propose fixing the prompt instead of making wide changes to parted 1.8.x

Also, shouldn't this be against RHEL5? RHEL6 uses parted 2.1

Comment 5 Brian Lane 2011-10-12 17:45:42 UTC
The problem here is that -s mklabel shouldn't be prompting the user. We don't need a --force, but do need to fix whatever is causing it to output the prompt.

Comment 6 Brian Lane 2011-10-12 21:18:32 UTC
I have successfully reproduced most of the described symptoms -- except that when passing -s to parted it does not expect a response to the prompt and it completes it successfully.

The problem is caused by tools, like fdisk, that do not understand GPT. If you have a GPT labeled disk and use something other than parted to make a msdos label it may leave the GPT backup partition table at the end of the disk. On subsequent operations parted sees this and prompts for user input.

I have tested this on RHEL5 and 6 and as long as -s is passed to parted it will successfully create the new label. I don't think it is safe to suppress the exception text, there may be cases where this output is useful. If it causes problems with tools then the output of parted should be redirected and the return code checked.

In the original report the output of 'parted: invalid token: gpt' indicates that -s was not passed and parted is attempting to use the cmdline input to answer the exception prompt.

Also note that parted removes the backup GPT partition table when used to create a msdos label.


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