mkswap does not wipe filesystem signatures
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Util-Linux-ng |
Fix Released
|
Undecided
|
Unassigned | ||
util-linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
The mkswap utility does not always clean up signatures left by other filesystems. This results in multiple signatures reported by 'wipefs -n /path/to/
This bug has apparently been fixed in upstream util-linux 2.21 (which I have not tested). From <https:/
mkswap:
- wipe all old signatures [Karel Zak]
The following script reproduces the problem using a loopback device:
-------------
#!/bin/sh
log() { printf %s\\n "$*"; }
error() { log "ERROR: $*" >&2; }
fatal() { error "$*"; exit 1; }
try() { "$@" || fatal "'$*' failed"; }
# this script's name
myname=$(try basename "$0") || exit 1
# temporary file for storing the swap partition
FS=${myname}.tmpfs
# which loopback device to use for ${FS}
LOOP=/dev/loop0
command -v mkfs.ufs >/dev/null \
|| fatal "mkfs.ufs not found; please install the ufsutils package"
log "creating ${LOOP} using a temporary 128MiB file..."
try dd if=/dev/zero of="${FS}" bs=1M count=128 2>/dev/null
try losetup "${LOOP}" "${FS}"
log "formatting ${LOOP} as UFS2..."
try mkfs.ufs "${LOOP}" >/dev/null
log "formatting ${LOOP} as swap..."
try mkswap "${LOOP}" >/dev/null
log "running 'wipefs -n ${LOOP}'..."
try wipefs -n "${LOOP}"
log "running 'blkid -p ${LOOP}'..."
blkid -p "${LOOP}"
log "cleaning up..."
try losetup -d "${LOOP}"
try rm "${FS}"
-------------
Note how wipefs reports multiple filesystem signatures:
offset type
-------
0x1055c ufs [filesystem]
0xff6 swap [other]
Also note how blkid does not list the UUID of the swap device. It prints this error message instead:
ambivalent result (probably more filesystems on the device, use wipefs(8) to see more details)
$ lsb_release -rd
Description: Ubuntu 12.04.1 LTS
Release: 12.04
$ apt-cache policy util-linux
util-linux:
Installed: 2.20.1-1ubuntu3
Candidate: 2.20.1-1ubuntu3
Version table:
*** 2.20.1-1ubuntu3 0
500 http://
100 /var/lib/
$ apt-cache policy ufsutils
ufsutils:
Installed: 8.2-3
Candidate: 8.2-3
Version table:
*** 8.2-3 0
500 http://
100 /var/lib/
Related branches
Changed in util-linux-ng: | |
status: | New → Fix Released |
Changed in util-linux (Ubuntu): | |
status: | New → Fix Committed |
This bug was fixed in the package util-linux - 2.25-8ubuntu1
---------------
util-linux (2.25-8ubuntu1) utopic; urgency=medium
* Merge with Debian experimental. ssd-trimming) :
need/support trimming, and call fstrim(8) on all of them. fstrim- all.8: Manpage for the above. fstrim- all.cron: Trivial shell script to call fstrim-all,
/etc/cron. weekly/ fstrim. -save}. upstart, and install them in debian/rules. hwclock. rules and hwclock.default. options. patch, see patch header. postinst: Due to the way the uuidd account is created, it
- This is now a non-ancient version. (LP: #1012081)
- No longer uses /etc/blkid.tab by default, but a file in /run/.
(LP: #1244595)
- mkswap wipes fs signatures (LP: #1047666)
- Fix "reatime" manpage typo (LP: #1047666)
- wipefs properly cleans up fs signatures (LP: #1059872)
Remaining Ubuntu changes:
- Regularly trim SSDs automatically (core-1311-
+ Add debian/fstrim-all: Script to detect which mounted partitions
Install into /usr/sbin/.
+ Add debian/
+ Add debian/
so that admins can easily adjust/disable it. Installed as
- Upstart support:
+ Add hwclock{
+ Drop initscripts dependency.
+ Drop debian/
- Add mountall-
- uuid-runtime.
will get a uid/gid allocation for userns use. This isn't needed and is a
waste of uid/gid so always clear uuidd from subuid/subgid.
* Drop /lib/init/fstab parsing fallback in mount. Patch does not apply at
all any more, is specific to mountall (and thus should not be relied
upon), and not very useful; all init systems, schroot, debootstrap etc.
mount /sys, /proc/ and friends by themselves already.
util-linux (2.25-8) experimental; urgency=medium
* Only install linux32/64 manpages on linux-any postinst to skip rmdir when not needed (Closes: #757432)
* Fix uuid-runtime.
* fdisk-udeb: use dh-exec to skip sfdisk install on sparc
util-linux (2.25-7) experimental; urgency=medium
* Mangle installed files on sparc (sfdisk) mountpoint instead of rm
* Fix sparc install mangling
* Use --disable-
* Use dh-exec (>= 0.13)
* Install mips,ppc,s390 setarch symlinks and manpages
util-linux (2.25-6) experimental; urgency=medium
The "Jonno was here" release.
[ Jon Severinsson ]
* Drop changelog file from the ancient mount source package.
[ Andreas Henriksson ]
* util-linux: Drop all (obsolete) Replaces/Conflicts
[ Jon Severinsson ] *-udeb. install files for udeb packages.
* Add Replaces/Breaks bash-completion (<< 1:2.1-3).
* Multiple cleanups in debian/control.
* Minor cleanup of debian/rules.
* Use filter, not findstring, for arch matching
* Simplify linux-only install file handling
* Use debian/
* Fix util-linux lintian override.
[ Andreas Henriksson ] postinst cleanup reenable- cursor- when-quitting. patch (Closes: #755991)
* Minor uuid-runtime.
* Add d/p/cfdisk-
util-linux (2.25-5) experimental; urgency=medium
The "big maintainer-script cleanup" release
* Drop debian/ uuid-runtime. prerm (and related lintian override) libuuid1. postin. ..
- dh_installinit will automatically start and stop services as needed.
* Drop debian/