Bug#815916: Failure to create empty partition table on s390 DASD

2016-02-25 Thread Viktor Mihajlovski
Package: partman-partitioning
Version: 111
Severity: important
Tags: d-i patch
X-Debbugs-CC: debian-s390@lists.debian.org, brueck...@linux.vnet.ibm.com

Dear Maintainer,

when I try to create an empty partition table on a DASD, the
partitioning code instructs parted to write an msdos label instead of a
dasd label to the disk. This is effectively destroying the volume
metadata rendering the disk unusable. The disk can only be recovered by
low level formatting.

This is caused by the default label determination logic in
partman-partitioning/lib/disk-label.sh which only uses the architecture
to decide which default label to use.
We can't switch that unconditionally to dasd, because we would break
SCSI (and most of virtio) partitioning.

The suggested patches make sure the disk type is respected and the
appropriate label type is used:
Patch 1 is for d-i/partman-base and stores the disk label type in
/var/lib/partman/devices//label, which will be dasd for natively
attached DASDs as well as virtio attached DASDs in KVM.
Patch 2 is a change in d-i/partman-partitioning and uses the stored
label type to determine the proper partition table format (only when
executing on s390).

Thanks for your consideration.

-- 

Kind Regards
   Viktor Mihajlovski

>From 6d71c4fb3eb679a5df4e1aa3028f0e6d6ec5df19 Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski 
Date: Tue, 23 Feb 2016 15:23:21 +0100
Subject: [PATCH] parted_devices: Add disk label type to device directory

At least for s390 the default disk label type is device
dependent. We record the current disk label type in the
/var/lib/partman/devices/ for later retrieval.

Signed-off-by: Viktor Mihajlovski 
---
 init.d/parted| 2 ++
 parted_devices.c | 7 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/init.d/parted b/init.d/parted
index 81cdafc..6f96b07 100755
--- a/init.d/parted
+++ b/init.d/parted
@@ -87,6 +87,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		device=$1
 		size=$2
 		model=$3
+		label=$4
 
 		# Skip mtd (not supported by parted) and mmcblk odities
 		case "${device#/dev/}" in
@@ -130,6 +131,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		printf "%s" "$device" >$dev/device
 		printf "%s" "$size" >$dev/size
 		printf "%s" "$model" >$dev/model
+		printf "%s" "$label" >$dev/label
 
 		# Set the sataraid flag for dmraid arrays.
 		if type dmraid >/dev/null 2>&1 && \
diff --git a/parted_devices.c b/parted_devices.c
index de15355..4fc64c7 100644
--- a/parted_devices.c
+++ b/parted_devices.c
@@ -76,6 +76,7 @@ is_floppy(const char *path)
 void
 process_device(PedDevice *dev)
 {
+	PedDisk *disk;
 	if (dev->read_only)
 		return;
 	if (is_cdrom(dev->path) || is_floppy(dev->path))
@@ -84,10 +85,12 @@ process_device(PedDevice *dev)
 	if (strstr(dev->path, "/dev/ramzswap") != NULL ||
 	strstr(dev->path, "/dev/zram") != NULL)
 		return;
-	printf("%s\t%lli\t%s\n",
+	disk = ped_disk_new(dev);
+	printf("%s\t%lli\t%s\t%s\n",
 	   dev->path,
 	   dev->length * dev->sector_size,
-	   dev->model);
+	   dev->model,
+	   disk->type->name ? disk->type->name : "unknown");
 }
 
 int
-- 
1.9.1

>From 38daa8b0d78607139aa66b225ae9c4ab04daf3be Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski 
Date: Tue, 23 Feb 2016 15:33:45 +0100
Subject: [PATCH] create_new_label: Use correct label for DASDs

Requires an updated partman-base. In case a disk is indentified
as DASD, make sure that the default disk label is "dasd".

Signed-off-by: Viktor Mihajlovski 
---
 lib/disk-label.sh | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/disk-label.sh b/lib/disk-label.sh
index b24f4a8..167f3c3 100644
--- a/lib/disk-label.sh
+++ b/lib/disk-label.sh
@@ -118,7 +118,13 @@ default_disk_label () {
 	ppc64el)
 		echo gpt;;
 	s390|s390x)
-		echo msdos;;
+		if [ -e ./label ]; then
+		disklabel=$(cat label)
+		fi
+		if [ "$disklabel" != dasd ]; then
+		disklabel=msdos
+		fi
+		echo $disklabel;;
 	sh4)
 		echo msdos;;
 	sparc|sparc64)
-- 
1.9.1



Bug#815819: sysconfig-hardware udev rule ignores INTERFACE_NAME property

2016-02-25 Thread Raphael Philipe Mendes da Silva
> Have you tried to create systemd network link file to assign a different
> name?  This should be then the long-term way how to rename interface
> names.  But I agree to correct the behavior in sysconfig-hardware for
> correctness.
Yes, I'm aware of this method. I just wanted to report this bug in case
someone else touch it.
> 
> Thanks and kind regards,
>   Hendrik
>