Ubuntu17.04-Failed to activate (encrypted) Swap Partition

Bug #1668535 reported by bugproxy
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
High
Dimitri John Ledkov
Zesty
Fix Released
High
Dimitri John Ledkov

Bug Description

---Problem Description---
Ubuntu17.04 installation with swap encryption ,Fails to activate Swap Partition.

---uname output---
Linux tuleta4u-lp7 4.9.0-11-generic #12-Ubuntu SMP Mon Dec 12 16:16:45 UTC 2016 ppc64le ppc64le ppc64le GNU/Linux

---boot type---
VDVD installtion

---Steps to reproduce--
1.Install creating a prep boot, swap and root partition.
2.Encrypt swap partition.
3.Installation completes, and after reboot can see the failed messages for activating swap partition.

--Error--
While booting,

[ OK ] Started AppArmor initialization.
[FAILED] Failed to activate swap Swap Partition.
See 'systemctl status dev-sda2.swap' for details.
[FAILED] Failed to start Cryptography Setup for sda2_crypt.
See 'systemctl status systemd-cryptsetup@sda2_crypt.service' for details.
[DEPEND] Dependency failed for Encrypted Volumes.
         Starting Raise network interfaces...

---Logs---

root@tuleta4u-lp7:~# systemctl status systemd-cryptsetup@sda2_crypt.service
? systemd-cryptsetup@sda2_crypt.service - Cryptography Setup for sda2_crypt
   Loaded: loaded (/etc/crypttab; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2017-01-02 01:58:14 EST; 1min 57
     Docs: man:crypttab(5)
           man:systemd-cryptsetup-generator(8)
           man:systemd-cryptsetup@.service(8)
 Main PID: 2023 (code=exited, status=0/SUCCESS)

Jan 02 01:58:14 tuleta4u-lp7 systemd[1]: Starting Cryptography Setup for sda2_cr
Jan 02 01:58:14 tuleta4u-lp7 mkswap[2057]: mkswap: error: /dev/mapper/sda2_crypt
Jan 02 01:58:14 tuleta4u-lp7 systemd[1]: systemd-cryptsetup@sda2_crypt.service:
Jan 02 01:58:14 tuleta4u-lp7 systemd[1]: Failed to start Cryptography Setup for
Jan 02 01:58:14 tuleta4u-lp7 systemd[1]: systemd-cryptsetup@sda2_crypt.service:
Jan 02 01:58:14 tuleta4u-lp7 systemd[1]: systemd-cryptsetup@sda2_crypt.service:

root@tuleta4u-lp7:~# systemctl start systemd-cryptsetup@sda2_crypt.service
Job for systemd-cryptsetup@sda2_crypt.service failed because the control process exited with error code.
See "systemctl status systemd-cryptsetup@sda2_crypt.service" and "journalctl -xe" for details.

root@tuleta4u-lp7:~# journalctl -xe
-- The start-up result is done.
Jan 02 03:17:01 tuleta4u-lp7 CRON[3955]: pam_unix(cron:session): session opened
Jan 02 03:17:01 tuleta4u-lp7 CRON[3956]: (root) CMD ( cd / && run-parts --repo
Jan 02 03:17:01 tuleta4u-lp7 CRON[3955]: pam_unix(cron:session): session closed
Jan 02 03:37:57 tuleta4u-lp7 systemd[1]: Starting Cryptography Setup for sda2_cr
-- Subject: Unit systemd-cryptsetup@sda2_crypt.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit systemd-cryptsetup@sda2_crypt.service has begun starting up.
Jan 02 03:37:57 tuleta4u-lp7 systemd-cryptsetup[3960]: Volume sda2_crypt already
Jan 02 03:37:57 tuleta4u-lp7 mkswap[3962]: mkswap: error: /dev/mapper/sda2_crypt
Jan 02 03:37:57 tuleta4u-lp7 systemd[1]: systemd-cryptsetup@sda2_crypt.service:
Jan 02 03:37:57 tuleta4u-lp7 systemd[1]: Failed to start Cryptography Setup for
-- Subject: Unit systemd-cryptsetup@sda2_crypt.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit systemd-cryptsetup@sda2_crypt.service has failed.
--
-- The result is failed.
Jan 02 03:37:57 tuleta4u-lp7 systemd[1]: systemd-cryptsetup@sda2_crypt.service:
Jan 02 03:37:57 tuleta4u-lp7 systemd[1]: systemd-cryptsetup@sda2_crypt.service:

root@tuleta4u-lp7:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=44e6ba68-4cbb-4978-8d90-6077796b3715 / xfs defaults 0 0

root@tuleta4u-lp7:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 235G 0 disk
??sda1 8:1 0 7M 0 part
??sda2 8:2 0 28G 0 part
? ??sda2_crypt 253:0 0 28G 0 crypt [SWAP]
??sda3 8:3 0 167.7G 0 part /
??sda4 8:4 0 28G 0 part
sdb 8:16 0 235G 0 disk
sr0 11:0 1 631.3M 0 rom
sr1 11:1 1 631.3M 0 rom

== Comment: #12 -
Hi Canonical,

This is the patch (debdiff) for Zesty.
The same patch as submitted to systemd upstream on [1].

[1] https://github.com/systemd/systemd/pull/5480

== Comment: #14 -
With this patch/test packages, the ordering between cryptsetup service (before) and swap target (after) is ensured.

# journalctl -b -x | grep 'crypt\|swap'
Feb 27 18:03:00 ubuntu kernel: zswap: loaded using pool lzo/zbud
Feb 27 18:03:00 ubuntu kernel: Key type encrypted registered
Feb 27 18:03:01 ubuntu kernel: crypto_register_alg 'aes' = 0
Feb 27 18:03:01 ubuntu kernel: crypto_register_alg 'cbc(aes)' = 0
Feb 27 18:03:01 ubuntu kernel: crypto_register_alg 'ctr(aes)' = 0
Feb 27 18:03:01 ubuntu kernel: crypto_register_alg 'xts(aes)' = 0
Feb 27 18:03:01 ubuntu systemd[1]: Found device /dev/mapper/sda3_crypt.
-- Subject: Unit dev-mapper-sda3_crypt.device has finished start-up
-- Unit dev-mapper-sda3_crypt.device has finished starting up.
Feb 27 18:03:02 ubuntu systemd[1]: Starting Cryptography Setup for sda3_crypt...
-- Subject: Unit systemd-cryptsetup@sda3_crypt.service has begun start-up
-- Unit systemd-cryptsetup@sda3_crypt.service has begun starting up.
Feb 27 18:03:02 ubuntu systemd-cryptsetup[2422]: Volume sda3_crypt already active.
Feb 27 18:03:02 ubuntu mkswap[2430]: mkswap: /dev/mapper/sda3_crypt: warning: wiping old swap signature.
Feb 27 18:03:02 ubuntu mkswap[2430]: Setting up swapspace version 1, size = 6.9 GiB (7426998272 bytes)
Feb 27 18:03:02 ubuntu mkswap[2430]: no label, UUID=863f87ca-0228-4b5f-9d01-578d4afcf687
Feb 27 18:03:02 ubuntu systemd[1]: Started Cryptography Setup for sda3_crypt.
-- Subject: Unit systemd-cryptsetup@sda3_crypt.service has finished start-up
-- Unit systemd-cryptsetup@sda3_crypt.service has finished starting up.
Feb 27 18:03:02 ubuntu systemd[1]: Reached target Encrypted Volumes.
-- Subject: Unit cryptsetup.target has finished start-up
-- Unit cryptsetup.target has finished starting up.
Feb 27 18:03:02 ubuntu systemd[1]: Activating swap /dev/mapper/sda3_crypt...
-- Subject: Unit dev-mapper-sda3_crypt.swap has begun start-up
-- Unit dev-mapper-sda3_crypt.swap has begun starting up.
Feb 27 18:03:02 ubuntu kernel: Adding 7252928k swap on /dev/mapper/sda3_crypt. Priority:-1 extents:1 across:7252928k FS
Feb 27 18:03:02 ubuntu systemd[1]: Activated swap /dev/mapper/sda3_crypt.
-- Subject: Unit dev-mapper-sda3_crypt.swap has finished start-up
-- Unit dev-mapper-sda3_crypt.swap has finished starting up.
-- Subject: Unit swap.target has finished start-up
-- Unit swap.target has finished starting up.

Revision history for this message
bugproxy (bugproxy) wrote : logs
  • logs Edit (42.7 KiB, application/x-gzip)

Default Comment by Bridge

tags: added: architecture-ppc64le bugnameltc-150152 severity-high targetmilestone-inin1704
Revision history for this message
bugproxy (bugproxy) wrote : sosreport

Default Comment by Bridge

Revision history for this message
bugproxy (bugproxy) wrote : zesty_systemd_cryptswap.debdiff

Default Comment by Bridge

Changed in ubuntu:
assignee: nobody → Taco Screen team (taco-screen-team)
affects: ubuntu → debian-installer (Ubuntu)
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-03-01 14:31 EDT-------
@taco-screen-team

Please assign this bug to @pitti (Martin Pitt).

This patch has been accepted on systemd upstream [1, 2]
with a minor wording change (s/swap target/swap unit/) due to my error,
which is applied on the upstream commit [2].

Thanks.

[1] https://github.com/systemd/systemd/pull/5480
[2] https://github.com/systemd/systemd/commit/a6f8786a56c0acba5997e2c58d0df6c80ffde7f1

Changed in debian-installer (Ubuntu):
assignee: Taco Screen team (taco-screen-team) → Dimitri John Ledkov (xnox)
affects: debian-installer (Ubuntu) → systemd (Ubuntu)
Changed in systemd (Ubuntu):
importance: Undecided → High
milestone: none → ubuntu-17.03
status: New → Confirmed
Changed in systemd (Ubuntu Zesty):
status: Confirmed → In Progress
Revision history for this message
bugproxy (bugproxy) wrote : zesty_systemd_cryptswap.debdiff

Default Comment by Bridge

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Revision history for this message
Mauricio Faria de Oliveira (mfo) wrote :

Dimitri,

Cool; thank you.

Revision history for this message
Adam Dingle (adam-yorba) wrote :

This looks pretty similar to bug #1670336. Should one of these be marked as a duplicate?

Changed in systemd (Ubuntu Zesty):
status: In Progress → Fix Committed
Changed in systemd (Ubuntu Zesty):
status: Fix Committed → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-04-13 06:45 EDT-------
This is Fix Released as of systemd 232-20 [1].

It just didn't get automatically set because the changelog doesn't include the LP bug number.

"""
systemd (232-20) unstable; urgency=medium
...
* cryptsetup-generator: Run cryptsetup service before swap unit.
"""

The patch file is present on systemd 232-21ubuntu2 in 17.04 as of now
(cryptsetup-generator-run-cryptsetup-service-before-swap-u.patch)

[1] https://launchpad.net/ubuntu/+source/systemd/+changelog

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.