mountall silently fails to activate swap if device contains multiple filesystem signatures
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mountall (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
If the swap device (LVM logical volume on an encrypted physical volume in my case) has multiple filesystem signatures (as reported by 'wipefs -n /path/to/
Also, blkid does not list the swap device in its output even though lsblk does. I'm assuming this is related to the mountall problem.
The following script replecates the situation by creating a looback block device with multiple filesystem signatures:
-------------
#!/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 mountall
mountall:
Installed: 2.36
Candidate: 2.36
Version table:
*** 2.36 0
500 http://
100 /var/lib/
$ 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/
Changed in mountall (Ubuntu): | |
status: | New → Confirmed |
tags: | added: precise quantal |
Changed in mountall (Ubuntu): | |
importance: | Undecided → Low |
It looks like mkswap from util-linux 2.21 (which sadly didn't make it into 12.10 quantal) deletes all signatures, which should prevent the multiple signature problem from appearing in the first place.
However, it is still probably worthwhile for mountall to be able to handle this case, perhaps by printing an error message that the user will see.