← Back to team overview

kernel-packages team mailing list archive

[Bug 1386339] [NEW] cryptswap can fail if random data matches a filesystem magic number

 

Public bug reported:

I noticed that my encrypted swap was not working, and I found that the
randomly generated encrypted filesystem had randomly generated data that
had the magic number of a filesystem type, and hence ever more it
refused to start...

Eg:-

root@hardline:/etc# more /etc/crypttab
cryptswap1 /dev/sda3 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

root@hardline:/etc# cryptdisks_start cryptswap1
 * Starting crypto disk...                                                       * cryptswap1 (starting)..
 * cryptswap1: the precheck for '/dev/sda3' failed:  - The device /dev/sda3 contains a filesystem type hfsplus.
 * cryptswap1 (failed)...                                                [fail] 

Obviosuly this is not a filesystem:-

root@hardline:/etc# mount -t hfsplus /dev/sda3 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sda3,
       missing codepage or helper program, or other error

So I blanked it and restarted, all is now well... perhaps if there's a
force option on cryptsetup this should be used in the setup scripts:-

root@hardline:/etc# dd if=/dev/zero of=/dev/sda3
^C684121+0 records in
684121+0 records out
350269952 bytes (350 MB) copied, 5.96378 s, 58.7 MB/s

root@hardline:/etc# cryptdisks_start cryptswap1
 * Starting crypto disk...                                                       * cryptswap1 (starting)..
 * cryptswap1 (started)...                                               [ OK ]

** Affects: linux (Ubuntu)
     Importance: Undecided
         Status: Incomplete

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1386339

Title:
  cryptswap can fail if random data matches a filesystem magic number

Status in “linux” package in Ubuntu:
  Incomplete

Bug description:
  I noticed that my encrypted swap was not working, and I found that the
  randomly generated encrypted filesystem had randomly generated data
  that had the magic number of a filesystem type, and hence ever more it
  refused to start...

  Eg:-

  root@hardline:/etc# more /etc/crypttab
  cryptswap1 /dev/sda3 /dev/urandom swap,cipher=aes-cbc-essiv:sha256

  root@hardline:/etc# cryptdisks_start cryptswap1
   * Starting crypto disk...                                                       * cryptswap1 (starting)..
   * cryptswap1: the precheck for '/dev/sda3' failed:  - The device /dev/sda3 contains a filesystem type hfsplus.
   * cryptswap1 (failed)...                                                [fail] 

  Obviosuly this is not a filesystem:-

  root@hardline:/etc# mount -t hfsplus /dev/sda3 /mnt
  mount: wrong fs type, bad option, bad superblock on /dev/sda3,
         missing codepage or helper program, or other error

  So I blanked it and restarted, all is now well... perhaps if there's a
  force option on cryptsetup this should be used in the setup scripts:-

  root@hardline:/etc# dd if=/dev/zero of=/dev/sda3
  ^C684121+0 records in
  684121+0 records out
  350269952 bytes (350 MB) copied, 5.96378 s, 58.7 MB/s

  root@hardline:/etc# cryptdisks_start cryptswap1
   * Starting crypto disk...                                                       * cryptswap1 (starting)..
   * cryptswap1 (started)...                                               [ OK ]

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386339/+subscriptions


Follow ups

References