Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#41287 - [cryptsetup] systemd-cryptsetup-generator / libcryptsetup doesn't pass discard option

Attached to Project: Arch Linux
Opened by Archer (justanarcher) - Monday, 21 July 2014, 17:22 GMT
Last edited by Dave Reisner (falconindy) - Thursday, 30 July 2015, 14:09 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Thomas Bächler (brain0)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
I use sd-encrypt hook provided by cryptsetup package to mount encrypted root. After upgrading to cryptsetup 1.6.5-1 and generating a new initramfs, 'rd.luks.options=discard' in cmdline no longer has any effect (cryptsetup status doesn't show 'flags: discards' and fstrim refuses to work). Downgrading to 1.6.4 an generating a new initramfs solves the issue. From the command line 'cryptsetup open --allow discards' works correctly with both versions.

Additional info:
From /etc/mkinitcpio.conf:
HOOKS="systemd sd-encrypt autodetect keyboard block filesystems sd-shutdown"
/proc/cmdline:
initrd=\initramfs-linux.img rd.luks.uuid=[partition uuid] rd.luks.options=discard root=UUID=[root uuid] rootflags=[..discard..] rw

I think allow-discards option got recently renamed to just discard but both have no effect with the new cryptsetup version and both work correctly the previous one.

Steps to reproduce:
Create full-disk encryption and boot like described above.
This task depends upon

Closed by  Dave Reisner (falconindy)
Thursday, 30 July 2015, 14:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  systemd-223 (despite no changes occuring here between 222 and 223)
Comment by Thomas Bächler (brain0) - Tuesday, 22 July 2014, 18:02 GMT
I am sure this used to work, but I can now reproduce the problem as well. The option was also silently renamed from 'allow-discards' to 'discard'.
Comment by Dave Reisner (falconindy) - Tuesday, 22 July 2014, 19:16 GMT
> The option was also silently renamed from 'allow-discards' to 'discard'.
Where are you seeing this? In cryptsetup, 'allow-discards' is the only supported option. In systemd-crypsetup, 'allow-discards' was added after the fact as a synonym for Debian compat (but 'discard' is still valid).

In any event, I can't see how this is systemd related if the only package change was cryptsetup... And even then, it doesn't make sense to me.
Comment by Thomas Bächler (brain0) - Tuesday, 22 July 2014, 21:57 GMT
Okay, this is a (new) problem in libcryptsetup. Adding the allow_discards option always fails when the dm_crypt module is not loaded already.
Comment by Thomas Bächler (brain0) - Wednesday, 23 July 2014, 17:08 GMT
This is Milan's reply: http://www.saout.de/pipermail/dm-crypt/2014-July/004214.html

We could change the hook to load dm-crypt unconditionally before any activation takes place. Other than that, we need to wait until libcryptsetup fixes this situation.
Comment by Archer (justanarcher) - Friday, 26 June 2015, 15:46 GMT
  • Field changed: Percent Complete (100% → 0%)
The same situation as before. Discard doesn't work from initramfs, but works fine when opening a device manually.
Comment by Dave Reisner (falconindy) - Friday, 26 June 2015, 15:52 GMT
It's clearly not the same situation. Could you provide any amount of context? Is this related to the upgrade from cryptsetup 1.6.6 to 1.6.7? Have you contacted cryptsetup upstream?
Comment by Archer (justanarcher) - Friday, 26 June 2015, 18:35 GMT
Sorry, should've said similar symptoms. I tried downgrading cryptsetup (1.6.7 -> 1.6.6) and device-mapper (2.02.121-1 -> 2.02.120-2) and rebuilding initramfs but to no effect. All I know is that 30 Apr 2015, the last time I used fstrim, it worked fine. No, I haven't contacted anyone.
Comment by Archer (justanarcher) - Friday, 26 June 2015, 19:02 GMT
Can anyone reproduce it? Or does discard work fine for anyone with a similar setup?
Comment by Archer (justanarcher) - Thursday, 30 July 2015, 14:07 GMT
After upgrading to systemd 223 the encrypted partition is once again opened correctly from initramfs, with 'cryptsetup status' showing 'flags: discards'.

Loading...