← Back to team overview

touch-packages team mailing list archive

[Bug 1047666] Re: mkswap does not wipe filesystem signatures

 

** Branch linked: lp:ubuntu/utopic-proposed/util-linux

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to util-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1047666

Title:
  mkswap does not wipe filesystem signatures

Status in The Util-Linux-ng Set of Utilities:
  Fix Released
Status in “util-linux” package in Ubuntu:
  Fix Committed

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/swap/device' and prevents mountall from activating the
  swap device on boot (see bug #1047659).

  This bug has apparently been fixed in upstream util-linux 2.21 (which
  I have not tested).  From <https://www.kernel.org/pub/linux/utils
  /util-linux/v2.21/v2.21-ReleaseNotes>:

      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]
                       UUID: 5ac922dc-3bc5-463f-a2e8-a692ee5c293a

  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://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
          100 /var/lib/dpkg/status
  $ apt-cache policy ufsutils
  ufsutils:
    Installed: 8.2-3
    Candidate: 8.2-3
    Version table:
   *** 8.2-3 0
          500 http://us.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
          100 /var/lib/dpkg/status

To manage notifications about this bug go to:
https://bugs.launchpad.net/util-linux-ng/+bug/1047666/+subscriptions