Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

2014-03-08 Thread Cyril Brulebois
Control: tag -1 patch pending

Steven Chamberlain ste...@pyro.eu.org (2014-02-04):
 Package: ufsutils-udeb
 Version: 9.2-3
 Severity: grave
 Tags: jessie sid d-i
 Affects: debian-installer
 User: debian-...@lists.debian.org
 Usertags: kfreebsd
 X-Debbugs-Cc: k...@debian.org
 
 Image:
 http://d-i.debian.org/daily-images/kfreebsd-amd64/20140203-00:50/netboot-9/mini.iso
 
 Can reproduce this by trying to format an msdos partition on an IDE disk
 as UFS (with kfreebsd-9 9.2-1-amd64):
 
  Feb  4 00:21:34 partman: mkfs.ufs: 
  Feb  4 00:21:34 partman: DIOCGMEDIASIZE
  Feb  4 00:21:34 partman: : 
  Feb  4 00:21:34 partman: Inappropriate ioctl for device
 
 Running `mkfs.ufs /dev/ada0` at an installer shell curiously tells me
 the size of the partition right before it fails with the above error.

As discussed here:
  https://lists.debian.org/debian-bsd/2014/03/msg00045.html
  https://lists.debian.org/debian-bsd/2014/03/msg00046.html
  https://lists.debian.org/debian-bsd/2014/03/msg00049.html

I've prepared an NMU to backport the fix from 10 to 9, which you'll find
attached. Since ufsutils-udeb is fetched from the archive while d-i is
running, I've tested it the following way: go through partitioning, wait
until the error pops up, drop to a shell, replace mkfs.ufs with the
patched one, and resume installation.

That led me to a successful installation, so I should upload in a few
minutes.


That said, building ufsutils in sid led me to a FTBFS due to missing
libutil.h; two solutions: either add a build-dep on libutil-freebsd-dev
which ships it under /usr/include; or adjust 3 files to #include
bsd/libutil.h instead. I haven't seen a difference in dependencies for
both cases. Which one do you want?

Mraw,
KiBi.
diff -Nru ufsutils-9.2/debian/changelog ufsutils-9.2/debian/changelog
--- ufsutils-9.2/debian/changelog	2013-11-30 12:56:40.0 +0100
+++ ufsutils-9.2/debian/changelog	2014-03-08 12:35:01.0 +0100
@@ -1,3 +1,12 @@
+ufsutils (9.2-3.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Steal the following patch from the 10 branch, fixing failures to run
+mkfs.ufs, notably from d-i (Closes: #737580):
+05_wipe_otherfs.patch: Handle DIOCGMEDIASIZE failure gracefully.
+
+ -- Cyril Brulebois k...@debian.org  Sat, 08 Mar 2014 12:32:26 +0100
+
 ufsutils (9.2-3) unstable; urgency=low
 
   * Bump kfreebsd-kernel-headers B-D to 9.2~5.
diff -Nru ufsutils-9.2/debian/patches/05_wipe_otherfs.patch ufsutils-9.2/debian/patches/05_wipe_otherfs.patch
--- ufsutils-9.2/debian/patches/05_wipe_otherfs.patch	2013-10-26 16:17:34.0 +0200
+++ ufsutils-9.2/debian/patches/05_wipe_otherfs.patch	2014-03-08 12:34:57.0 +0100
@@ -8,27 +8,31 @@
  #include sys/mman.h
  #include sys/resource.h
  #include sys/stat.h
-@@ -531,6 +532,24 @@
+@@ -531,6 +532,28 @@
  			}
  		}
  	}
 +	/* Wipe out other file systems. For now we erase first and last 512 kiB
 +	 * (this works for at least UFS1 and ZFS). */
 +	if (!Eflag  !Nflag) {
-+		off_t mediasize;
-+		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, mediasize))
-+			err(1, DIOCGMEDIASIZE);
++		off_t mediasize = 0;
++
 +		printf(Erasing sectors [%jd...%jd]\n,
 +			sblock.fs_sblockloc / disk.d_bsize,
 +			fsbtodb(sblock, sblock.fs_size) - 1);
 +		berase(disk, sblock.fs_sblockloc / disk.d_bsize,
 +			1024 * disk.d_bsize - sblock.fs_sblockloc);
 +
-+		printf(Erasing sectors [%jd...%jd]\n,
-+			(mediasize - 1024 * 512) / disk.d_bsize,
-+			(mediasize / disk.d_bsize) - 1);
-+		berase(disk, (mediasize - 1024 * 512) / disk.d_bsize,
-+			1024 * 512);
++		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, mediasize))
++			warn(DIOCGMEDIASIZE);
++
++		if (mediasize) {
++			printf(Erasing sectors [%jd...%jd]\n,
++(mediasize - 1024 * 512) / disk.d_bsize,
++(mediasize / disk.d_bsize) - 1);
++			berase(disk, (mediasize - 1024 * 512) / disk.d_bsize,
++1024 * 512);
++		}
 +	}
  	if (!Nflag)
  		do_sbwrite(disk);


signature.asc
Description: Digital signature


Processed: Re: Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

2014-03-08 Thread Debian Bug Tracking System
Processing control commands:

 tag -1 patch pending
Bug #737580 {Done: Robert Millan r...@debian.org} [ufsutils-udeb] 
ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device
Added tag(s) pending and patch.

-- 
737580: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737580
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems


--
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

2014-03-08 Thread Robert Millan
On 08/03/2014 12:06, Cyril Brulebois wrote:
 That said, building ufsutils in sid led me to a FTBFS due to missing
 libutil.h; two solutions: either add a build-dep on libutil-freebsd-dev
 which ships it under /usr/include; or adjust 3 files to #include
 bsd/libutil.h instead. I haven't seen a difference in dependencies for
 both cases. Which one do you want?

B-D please. There's no reason not to use the real libutil directly
now that we have it.

Thanks

-- 
Robert Millan


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

2014-03-08 Thread Cyril Brulebois
Robert Millan r...@debian.org (2014-03-08):
 On 08/03/2014 12:06, Cyril Brulebois wrote:
  That said, building ufsutils in sid led me to a FTBFS due to missing
  libutil.h; two solutions: either add a build-dep on libutil-freebsd-dev
  which ships it under /usr/include; or adjust 3 files to #include
  bsd/libutil.h instead. I haven't seen a difference in dependencies for
  both cases. Which one do you want?
 
 B-D please. There's no reason not to use the real libutil directly
 now that we have it.

Alright, filed #741088 for reference, and attaching the new source
debdiff to both reports.

Mraw,
KiBi.
diff -Nru ufsutils-9.2/debian/changelog ufsutils-9.2/debian/changelog
--- ufsutils-9.2/debian/changelog	2013-11-30 12:56:40.0 +0100
+++ ufsutils-9.2/debian/changelog	2014-03-08 14:02:58.0 +0100
@@ -1,3 +1,14 @@
+ufsutils (9.2-3.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Steal the following patch from the 10 branch, fixing failures to run
+mkfs.ufs, notably from d-i (Closes: #737580):
+05_wipe_otherfs.patch: Handle DIOCGMEDIASIZE failure gracefully.
+  * Fix FTBFS due to missing libutil.h by adding a libutil-freebsd-dev
+build-dep (Closes: #741088).
+
+ -- Cyril Brulebois k...@debian.org  Sat, 08 Mar 2014 14:02:51 +0100
+
 ufsutils (9.2-3) unstable; urgency=low
 
   * Bump kfreebsd-kernel-headers B-D to 9.2~5.
diff -Nru ufsutils-9.2/debian/control ufsutils-9.2/debian/control
--- ufsutils-9.2/debian/control	2013-11-29 16:22:34.0 +0100
+++ ufsutils-9.2/debian/control	2014-03-08 13:56:49.0 +0100
@@ -9,6 +9,7 @@
  freebsd-glue (= 0.1.12~),
  libbsd-dev (= 0.3.0),
  libedit-dev,
+ libutil-freebsd-dev,
 Vcs-Browser: http://anonscm.debian.org/viewvc/glibc-bsd/trunk/ufsutils/
 Vcs-Svn: svn://anonscm.debian.org/glibc-bsd/trunk/ufsutils/
 Standards-Version: 3.9.2
diff -Nru ufsutils-9.2/debian/patches/05_wipe_otherfs.patch ufsutils-9.2/debian/patches/05_wipe_otherfs.patch
--- ufsutils-9.2/debian/patches/05_wipe_otherfs.patch	2013-10-26 16:17:34.0 +0200
+++ ufsutils-9.2/debian/patches/05_wipe_otherfs.patch	2014-03-08 12:55:47.0 +0100
@@ -8,27 +8,31 @@
  #include sys/mman.h
  #include sys/resource.h
  #include sys/stat.h
-@@ -531,6 +532,24 @@
+@@ -531,6 +532,28 @@
  			}
  		}
  	}
 +	/* Wipe out other file systems. For now we erase first and last 512 kiB
 +	 * (this works for at least UFS1 and ZFS). */
 +	if (!Eflag  !Nflag) {
-+		off_t mediasize;
-+		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, mediasize))
-+			err(1, DIOCGMEDIASIZE);
++		off_t mediasize = 0;
++
 +		printf(Erasing sectors [%jd...%jd]\n,
 +			sblock.fs_sblockloc / disk.d_bsize,
 +			fsbtodb(sblock, sblock.fs_size) - 1);
 +		berase(disk, sblock.fs_sblockloc / disk.d_bsize,
 +			1024 * disk.d_bsize - sblock.fs_sblockloc);
 +
-+		printf(Erasing sectors [%jd...%jd]\n,
-+			(mediasize - 1024 * 512) / disk.d_bsize,
-+			(mediasize / disk.d_bsize) - 1);
-+		berase(disk, (mediasize - 1024 * 512) / disk.d_bsize,
-+			1024 * 512);
++		if (!ioctl(disk.d_fd, DIOCGMEDIASIZE, mediasize))
++			warn(DIOCGMEDIASIZE);
++
++		if (mediasize) {
++			printf(Erasing sectors [%jd...%jd]\n,
++(mediasize - 1024 * 512) / disk.d_bsize,
++(mediasize / disk.d_bsize) - 1);
++			berase(disk, (mediasize - 1024 * 512) / disk.d_bsize,
++1024 * 512);
++		}
 +	}
  	if (!Nflag)
  		do_sbwrite(disk);


signature.asc
Description: Digital signature


Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

2014-02-04 Thread Robert Millan
On 04/02/2014 00:34, Steven Chamberlain wrote:
 Package: ufsutils-udeb
 Version: 9.2-3
 Severity: grave
 Tags: jessie sid d-i
 Affects: debian-installer
 User: debian-...@lists.debian.org
 Usertags: kfreebsd
 X-Debbugs-Cc: k...@debian.org
 
 Image:
 http://d-i.debian.org/daily-images/kfreebsd-amd64/20140203-00:50/netboot-9/mini.iso
 
 Can reproduce this by trying to format an msdos partition on an IDE disk
 as UFS (with kfreebsd-9 9.2-1-amd64):
 
 Feb  4 00:21:34 partman: mkfs.ufs: 
 Feb  4 00:21:34 partman: DIOCGMEDIASIZE
 Feb  4 00:21:34 partman: : 
 Feb  4 00:21:34 partman: Inappropriate ioctl for device
 
 Running `mkfs.ufs /dev/ada0` at an installer shell curiously tells me
 the size of the partition right before it fails with the above error.
 
 /dev/ada0s1: 510.0MB (1044480 sectors) block size 32768, fragment size 4096
  using 4 cylinder groups of 127.53MB, 4081 blks, 16384 inodes.
 mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device
 
 So this is likely a problem in ufsutils-udeb and may be kernel-specific.

Can this still be reproduced with any of the following?

- ufsutils (the non-udeb version)
- kfreebsd-10
- ufsutils-udeb 10.0

-- 
Robert Millan


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#737580: ufsutils-udeb: mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

2014-02-03 Thread Steven Chamberlain
Package: ufsutils-udeb
Version: 9.2-3
Severity: grave
Tags: jessie sid d-i
Affects: debian-installer
User: debian-...@lists.debian.org
Usertags: kfreebsd
X-Debbugs-Cc: k...@debian.org

Image:
http://d-i.debian.org/daily-images/kfreebsd-amd64/20140203-00:50/netboot-9/mini.iso

Can reproduce this by trying to format an msdos partition on an IDE disk
as UFS (with kfreebsd-9 9.2-1-amd64):

 Feb  4 00:21:34 partman: mkfs.ufs: 
 Feb  4 00:21:34 partman: DIOCGMEDIASIZE
 Feb  4 00:21:34 partman: : 
 Feb  4 00:21:34 partman: Inappropriate ioctl for device

Running `mkfs.ufs /dev/ada0` at an installer shell curiously tells me
the size of the partition right before it fails with the above error.

 /dev/ada0s1: 510.0MB (1044480 sectors) block size 32768, fragment size 4096
   using 4 cylinder groups of 127.53MB, 4081 blks, 16384 inodes.
 mkfs.ufs: DIOCGMEDIASIZE: Inappropriate ioctl for device

So this is likely a problem in ufsutils-udeb and may be kernel-specific.

udeb versions are:

 Feb  4 00:18:12 anna[2082]: DEBUG: retrieving apt-mirror-setup 1:0.85
 Feb  4 00:18:13 anna[2082]: DEBUG: retrieving apt-setup-udeb 1:0.85
 Feb  4 00:18:15 anna[2082]: DEBUG: retrieving base-installer 1.141
 Feb  4 00:18:16 anna[2082]: DEBUG: retrieving bootstrap-base 1.141
 Feb  4 00:18:19 anna[2082]: DEBUG: retrieving clock-setup 0.119
 Feb  4 00:18:20 anna[2082]: DEBUG: retrieving di-utils-mapdevfs 1.102
 Feb  4 00:18:21 anna[2082]: DEBUG: retrieving debootstrap-udeb 1.0.56
 Feb  4 00:18:41 anna[2082]: DEBUG: retrieving e2fsprogs-udeb 1.42.9-2
 Feb  4 00:18:42 anna[2082]: DEBUG: retrieving libc0.1-udeb 2.17-97
 Feb  4 00:18:44 anna[2082]: DEBUG: retrieving finish-install 2.46
 Feb  4 00:18:45 anna[2082]: DEBUG: retrieving libfuse2-udeb 2.9.2-4
 Feb  4 00:18:46 anna[2082]: DEBUG: retrieving grub-installer 1.91
 Feb  4 00:18:48 anna[2082]: DEBUG: retrieving grub-mount-udeb 2.00-22
 Feb  4 00:18:49 anna[2082]: DEBUG: retrieving disk-detect 1.98
 Feb  4 00:18:53 anna[2082]: DEBUG: retrieving ext2-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:18:54 anna[2082]: DEBUG: retrieving isofs-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:18:54 anna[2082]: DEBUG: retrieving loop-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:18:55 anna[2082]: DEBUG: retrieving md-modules-9.2-1-amd64-di 9.2-2
 Feb  4 00:18:56 anna[2082]: DEBUG: retrieving nullfs-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:18:56 anna[2082]: DEBUG: retrieving sata-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:18:58 anna[2082]: DEBUG: retrieving 
 scsi-core-modules-9.2-1-amd64-di 9.2-2
 Feb  4 00:18:59 anna[2082]: DEBUG: retrieving 
 scsi-extra-modules-9.2-1-amd64-di 9.2-2
 Feb  4 00:18:59 anna[2082]: DEBUG: retrieving scsi-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:19:00 anna[2082]: DEBUG: retrieving xfs-modules-9.2-1-amd64-di 9.2-2
 Feb  4 00:19:01 anna[2082]: DEBUG: retrieving zfs-modules-9.2-1-amd64-di 9.2-2
 Feb  4 00:19:02 anna[2082]: DEBUG: retrieving zlib-modules-9.2-1-amd64-di 
 9.2-2
 Feb  4 00:19:03 anna[2082]: DEBUG: retrieving kickseed-common 0.60
 Feb  4 00:19:04 anna[2082]: DEBUG: retrieving ntfsprogs-udeb 2.0.0-1+b2
 Feb  4 00:19:04 anna[2082]: DEBUG: retrieving nobootloader 1.43
 Feb  4 00:19:07 anna[2082]: DEBUG: retrieving os-prober-udeb 1.63
 Feb  4 00:19:07 anna[2082]: DEBUG: retrieving libparted0-udeb 2.3-16
 Feb  4 00:19:08 anna[2082]: DEBUG: retrieving partman-auto 118
 Feb  4 00:19:11 anna[2082]: DEBUG: retrieving partman-auto-raid 24
 Feb  4 00:19:13 anna[2082]: DEBUG: retrieving partman-base 172
 Feb  4 00:19:15 anna[2082]: DEBUG: retrieving partman-utils 172
 Feb  4 00:19:15 anna[2082]: DEBUG: retrieving partman-basicfilesystems 90
 Feb  4 00:19:19 anna[2082]: DEBUG: retrieving partman-basicmethods 58
 Feb  4 00:19:21 anna[2082]: DEBUG: retrieving partman-btrfs 14
 Feb  4 00:19:23 anna[2082]: DEBUG: retrieving partman-ext3 81
 Feb  4 00:19:25 anna[2082]: DEBUG: retrieving partman-iscsi 21
 Feb  4 00:19:27 anna[2082]: DEBUG: retrieving partman-jfs 42
 Feb  4 00:19:29 anna[2082]: DEBUG: retrieving partman-md 67
 Feb  4 00:19:32 anna[2082]: DEBUG: retrieving partman-partitioning 99
 Feb  4 00:19:35 anna[2082]: DEBUG: retrieving partman-target 90
 Feb  4 00:19:37 anna[2082]: DEBUG: retrieving partman-ufs 17
 Feb  4 00:19:38 anna[2082]: DEBUG: retrieving partman-xfs 53
 Feb  4 00:19:40 anna[2082]: DEBUG: retrieving partman-zfs 31
 Feb  4 00:19:42 anna[2082]: DEBUG: retrieving libpcre3-udeb 1:8.31-2
 Feb  4 00:19:45 anna[2082]: DEBUG: retrieving pkgsel 0.41
 Feb  4 00:19:48 anna[2082]: DEBUG: retrieving rdate-udeb 1:1.2-5
 Feb  4 00:19:49 anna[2082]: DEBUG: retrieving tzsetup-udeb 1:0.50
 Feb  4 00:19:52 anna[2082]: DEBUG: retrieving ufsutils-udeb 9.2-3
 Feb  4 00:19:53 anna[2082]: DEBUG: retrieving user-setup-udeb 1.55
 Feb  4 00:19:56 anna[2082]: DEBUG: retrieving libblkid1-udeb 2.20.1-5.6
 Feb  4 00:19:57 anna[2082]: DEBUG: retrieving libuuid1-udeb 2.20.1-5.6
 Feb  4 00:19:58 anna[2082]: DEBUG: retrieving libnvpair1-udeb 9.2-4
 Feb  4 00:19:58 anna[2082]: DEBUG: retrieving