This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1306891 - systemd does not activate crypo swap without an fstab entry
systemd does not activate crypo swap without an fstab entry
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2016-02-11 21:53 EST by Chris Murphy
Modified: 2016-12-20 13:39 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-12-20 13:39:02 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
crypttab (191 bytes, text/plain)
2016-02-11 21:54 EST, Chris Murphy
no flags Details
fstab (321 bytes, text/plain)
2016-02-11 21:54 EST, Chris Murphy
no flags Details
journal (1.85 MB, text/plain)
2016-02-11 21:54 EST, Chris Murphy
no flags Details

  None (edit)
Description Chris Murphy 2016-02-11 21:53:38 EST
Description of problem: Systemd is correctly creating a crypto device, does mkswap on it, but then fails to actually swapon unless there's an fstab entry.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Setup /etc/crypttab  (attached)
2. No entry in fstab
3. GPT partition type GUID for the partition in crypttab is set to the generic Linux partition type (gdisk code 8300); although I did also try setting it to gdisk code 8200, but that also doesn't work.

Actual results:

Fails to activate swap.

[root@f23s ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3872         131        3467           0         273        3681
Swap:             0           0           0

[   36.968788] f23s.localdomain systemd[661]: systemd-cryptsetup@swap.service: Executing: /usr/lib/systemd/systemd-cryptsetup attach swap /dev/disk/by-id/wwn-0xbc4941c003965000-part5 /dev/urandom swap,cipher=aes-xts-plain64,size=256

[   37.160196] f23s.localdomain systemd-cryptsetup[661]: Set cipher aes, mode xts-plain64, key size 256 bits for device /dev/disk/by-id/wwn-0xbc4941c003965000-part5.

[   38.244942] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Child 661 belongs to systemd-cryptsetup@swap.service
[   38.245439] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Main process exited, code=exited, status=0/SUCCESS
[   38.245972] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: About to execute: /sbin/mkswap /dev/mapper/swap

[   38.248467] f23s.localdomain systemd[713]: systemd-cryptsetup@swap.service: Executing: /sbin/mkswap /dev/mapper/swap
[   38.254243] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Changed start -> start-post

[   38.467540] f23s.localdomain mkswap[713]: Setting up swapspace version 1, size = 8 GiB (8589930496 bytes)
[   38.468340] f23s.localdomain mkswap[713]: no label, UUID=7b7e89fb-cd8f-43cd-b2c7-0872cba617b1

[   38.471875] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Child 713 belongs to systemd-cryptsetup@swap.service
[   38.472424] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Control process exited, code=exited status=0
[   38.473230] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Got final SIGCHLD for state start-post.
[   38.474030] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Changed start-post -> exited
[   38.474521] f23s.localdomain systemd[1]: systemd-cryptsetup@swap.service: Job systemd-cryptsetup@swap.service/start finished, result=done
[   38.474996] f23s.localdomain systemd[1]: Started Cryptography Setup for swap.

[   39.513912] f23s.localdomain systemd[1]: dev-mapper-swap.device: Changed dead -> plugged
[   39.514325] f23s.localdomain systemd[1]: dev-mapper-swap.device: Job dev-mapper-swap.device/start finished, result=done
[   39.514721] f23s.localdomain systemd[1]: Found device /dev/mapper/swap.
[   39.515150] f23s.localdomain systemd[1]: dev-disk-by\x2duuid-7b7e89fb\x2dcd8f\x2d43cd\x2db2c7\x2d0872cba617b1.device: Changed dead -> plugged
[   39.515628] f23s.localdomain systemd[1]: dev-disk-by\x2did-dm\x2duuid\x2dCRYPT\x2dPLAIN\x2dswap.device: Changed dead -> plugged
[   39.516147] f23s.localdomain systemd[1]: dev-disk-by\x2did-dm\x2dname\x2dswap.device: Changed dead -> plugged

[  148.929779] f23s.localdomain systemd[1442]: dev-mapper-swap.device: Changed dead -> plugged

Expected results:

swapon should happen after mswap.

The logic has inferred /dev/mapper/swap should have mkswap run on it, and yet doesn't know to swapon the same device? Kinda weird.

Additional Info:

# swapon /dev/mapper/swap
# free -m
              total        used        free      shared  buff/cache   available
Mem:           3872         136        3422           0         313        3675
Swap:          8191           0        8191

So yeah that's really the only thing missing.

If I create an fstab entry for /dev/mapper/swap, it also works. But it seems like this should work without an fstab entry.
Comment 1 Chris Murphy 2016-02-11 21:54 EST
Created attachment 1123332 [details]
Comment 2 Chris Murphy 2016-02-11 21:54 EST
Created attachment 1123333 [details]
Comment 3 Chris Murphy 2016-02-11 21:54 EST
Created attachment 1123334 [details]

Comment 4 Fedora End Of Life 2016-11-24 10:31:08 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 5 Fedora End Of Life 2016-12-20 13:39:02 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.