Bug 31925 - pvcreate fails if partition has been removed but PV signature has not been removed
pvcreate fails if partition has been removed but PV signature has not been re...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCS Installer
UCS 2.3
Other Linux
: P5 normal (vote)
: UCS 3.2
Assigned To: Sönke Schwardt-Krummrich
Erik Damrose
: interim-2
: 29279 (view as bug list)
Depends on: 18771
Blocks: 33494
  Show dependency treegraph
 
Reported: 2013-07-09 09:56 CEST by Sönke Schwardt-Krummrich
Modified: 2013-11-20 17:21 CET (History)
4 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2013-07-09 09:56:30 CEST
From Bug 18771 Comment 2:
> Die beiden Partitionierungsmodule 65_partition.py und 66_gpt_partition.py 
> wurden um den Aufruf "pvremove -ff <device>" direkt vor dem pvcreate erweitert, 
> welcher noch existierende PV-Signaturen entfernen soll.

"pvremove --force --force $DEVICE" asks interactively for confirmation which fails. If "yes | pvremove --force --force $DEVICE" is called, the removals works without interaction.

This happens often and should be fixed for UCS 3.2.
Comment 1 Philipp Hahn univentionstaff 2013-08-29 08:16:06 CEST
*** Bug 29279 has been marked as a duplicate of this bug. ***
Comment 2 Sönke Schwardt-Krummrich univentionstaff 2013-09-09 15:50:58 CEST
A wrapper script for pvremove has been added:
---[/sbin/wrapper-yes-pvremove]---
#!/bin/sh
yes | pvremove "$@"
---

In 65_partition.py and 66_gpt_partition.py the corresponding pvremove calls have been replaced with a call of the wrapper script.

univention-installer (9.0.19-1) unstable; urgency=low

Entry in changelog-3.2.xml has been added.

QA:
→ use autopartitioning layout
→ remove LVMPV partition
→ create 2 new partition at disk space used by the prior LVMPV partition 
  via gdisk
→ partprobe /dev/sda
→ call "pvcreate /dev/$PARTITION" on both partitions
→ call "vgcreate vgfoo /dev/$PART1 /dev/$PART2"
→ jump back to installer terminal
→ press F5
→ use autopartitioning
→ write partitioning layout to disk
→ check logfile /tmp/installer.log

PARTITION-GPT:3310: waiting for udev to settle down
PARTITION-GPT:3305: running ['/sbin/wrapper-yes-pvremove', '-ff', '/dev/sda4']
PARTITION-GPT:3309: ===(exitcode=0)====> ['/sbin/wrapper-yes-pvremove', '-ff', '/dev/sda4']
STDERR:
=> File descriptor 3 (pipe:[5013]) leaked on pvremove invocation. Parent PID 2566: /bin/sh
=>   Couldn't find device with uuid 67yjDS-dzMf-1ca2-jrQl-4GQ7-SiNG-LN8Lf0.
=>   WARNING: Wiping physical volume label from /dev/sda4 of volume group "vgfoo"
=> yes: Broken pipe
=> 
STDOUT:
=> Really WIPE LABELS from physical volume "/dev/sda4" of volume group "vgfoo" [y/n]?   Labels on physical volume "/dev/sda4" successfully wiped
=> 
PARTITION-GPT:3310: waiting for udev to settle down
PARTITION-GPT:3305: running ['/sbin/pvcreate', '/dev/sda4']
PARTITION-GPT:3309: ===(exitcode=0)====> ['/sbin/pvcreate', '/dev/sda4']
STDERR:
=> File descriptor 3 (pipe:[5013]) leaked on pvcreate invocation. Parent PID 1282: /bin/python2.6
=> 
STDOUT:
=>   Physical volume "/dev/sda4" successfully created
=> 
PARTITION-GPT:3310: waiting for udev to settle down
Comment 3 Erik Damrose univentionstaff 2013-09-18 15:37:00 CEST
PV signatures are removed noninteractive: OK
Changelog: OK
Comment 4 Philipp Hahn univentionstaff 2013-09-27 16:19:53 CEST
(In reply to Sönke Schwardt-Krummrich from comment #2)
> A wrapper script for pvremove has been added:

I use that for Ticket #2013090221002951, because the previous PV was not over-written and the file-system was not re-created, which caused the installation to fail, since the file-system still contained the data of a previous failed installation.

diff --git univention-installer/installer/modules/66_gpt_partition.py univention-installer/installer/modules/66_gpt_partition.py
index d71ba39..84197e1 100644
--- a/branches/ucs-3.2/ucs-3.2-0/base/univention-installer/installer/modules/66_gpt_partition.py
+++ b/branches/ucs-3.2/ucs-3.2-0/base/univention-installer/installer/modules/66_gpt_partition.py
@@ -1297,10 +1297,10 @@ class object(content):
 				return '%sp%s' % (dev_match.group(), number)
 			return '%s%s' % (device, number)
 
-		def run_cmd(self, cmd, log_stdout=True, log_stderr=True):
+		def run_cmd(self, cmd, log_stdout=True, log_stderr=True, stdin=None):
 			self.parent.debug('(profile) run_cmd(%r)' % (cmd,))
 			proc = subprocess.Popen(cmd, bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-			(stdout, stderr) = proc.communicate()
+			(stdout, stderr) = proc.communicate(stdin)
 			self.parent.debug('===(exitcode=%d)====' % proc.returncode)
 			if stdout and log_stdout:
 				self.parent.debug('stdout of %r:\n=> %s' % (cmd, '\n=> '.join(stdout.split('\n'))))
@@ -1391,7 +1391,7 @@ class object(content):
 						if PARTFLAG_LVM in flaglist:
 							self.parent.debug('%s: lvm flag' % device)
 							ucsvgname = self.parent.container['lvm']['ucsvgname']
-							self.run_cmd(['/sbin/pvcreate', device])
+							self.run_cmd(['/sbin/pvcreate', '-ff', device], stdin='y\n')
 							if not vgcreated:
 								self.run_cmd(['/sbin/vgcreate', '--physicalextentsize',
 											  '%sk' % B2KiB(self.parent.container['lvm']['vg'][ ucsvgname ]['PEsize']),
Comment 5 Stefan Gohmann univentionstaff 2013-11-19 06:43:05 CET
UCS 3.2 has been released:
 http://docs.univention.de/release-notes-3.2-en.html
 http://docs.univention.de/release-notes-3.2-de.html

If this error occurs again, please use "Clone This Bug".