Qubes 3.2 trim problem

72 views
Skip to first unread message

nunotm...@gmail.com

unread,
Feb 16, 2018, 5:37:54 AM2/16/18
to qubes-users
Hi!
Followed the trim tutorial in https://www.qubes-os.org/doc/disk-trim/
My computer boots through efi, so I did:

1) set issue_discards = 1 in /etc/lvm/lvm.conf
2) added discard to the end of the luks entry in /etc/crypttab. Also tried with allow-discards
3) Added rd.luks.options=discard to both ke dracut -H -frnel entries on /boot/efi/EFI/qubes/xen.cfg. Also tried with rd.luks.allow-discards
4) Rebuild initrd in hostonly mode with dracut -H -f

rebooted the system with each try and every time, the response to command:
sudo fstrim -v /
fstrim: /: the discard operation is not supported

Is there anything wrong?

awokd

unread,
Feb 16, 2018, 6:34:10 AM2/16/18
to nunotm...@gmail.com, qubes-users
First of all, is / on an SSD or hard drive?
Try doing a "cryptsetup status /dev/mapper/luks-UUID#". Look for "flags:
discards".

2) Should be just discard
3) Should be rd.luks.options=discard
4) Please try this longer version of initramfs generation. I think the
short version is OK for GRUB boot but EFI might need the longer one:
sudo /usr/bin/dracut -f
/boot/efi/EFI/qubes/initramfs-4.9.56-21.pvops.qubes.x86_64.img
4.9.56-21.pvops.qubes.x86_64

Let me know if that fixes it (or not) so I can update the doc.




Ivan Mitev

unread,
Feb 16, 2018, 9:03:10 AM2/16/18
to qubes...@googlegroups.com
In case you update the doc, you may add `systemctl enable fstrim.timer`
for setting a periodic job in the configuration section [1].
However:
- the timer is run daily, not weekly (fstrim runs very fast though,
shouldn't be an issue).
- it might be specific to R4.0 - I don't remember if util-linux provided
the timer in R3.2

(FWIW the documentation's instructions worked for me on R4.0rc4, with
grub boot).

Ivan

[1] https://www.qubes-os.org/doc/disk-trim/#configuration

>
>
>
>

nunotm...@gmail.com

unread,
Feb 16, 2018, 9:37:24 AM2/16/18
to qubes-users
Hi!
It fixed my problem! I never thought it could be a problem with dracut's arguments.
You should update the doc.

Thanks for the quick response!!!

awokd

unread,
Feb 16, 2018, 9:50:16 AM2/16/18
to nunotm...@gmail.com, qubes-users
Thanks for being a guinea pig! :)

Will submit an update request (and include Ivan's suggestion too).

Anyone know if there is a shorter version of the above command that works
for EFI without having to specify the kernel version numbers?


awokd

unread,
Feb 16, 2018, 10:02:54 AM2/16/18
to aw...@danwin1210.me, nunotm...@gmail.com, qubes-users
On Fri, February 16, 2018 2:49 pm, 'awokd' via qubes-users wrote:
> On Fri, February 16, 2018 2:37 pm, nunotm...@gmail.com wrote:
>
>> sexta-feira, 16 de Fevereiro de 2018 às 11:34:10 UTC, awokd escreveu:
>>> On Fri, February 16, 2018 10:37 am, nunotm...@gmail.com wrote:
>>>
>
>>> 4) Please try this longer version of initramfs generation. I think
>>> the short version is OK for GRUB boot but EFI might need the longer
>>> one: sudo
>>> /usr/bin/dracut -f
>>> /boot/efi/EFI/qubes/initramfs-4.9.56-21.pvops.qubes.x86_64.img
>>> 4.9.56-21.pvops.qubes.x86_64
>>>

>
> Anyone know if there is a shorter version of the above command that works
> for EFI without having to specify the kernel version numbers?

Looks like:

dracut -f /boot/efi/EFI/qubes/initramfs-$(uname -r).img $(uname -r)

works for a generic version at least. Will go with that unless there's a
better suggestion.

nunotm...@gmail.com

unread,
Feb 16, 2018, 10:13:26 AM2/16/18
to qubes-users
Don't forget that the original doc had the host only option -H.

awokd

unread,
Feb 16, 2018, 10:15:46 AM2/16/18
to Ivan Mitev, qubes...@googlegroups.com
On Fri, February 16, 2018 2:03 pm, Ivan Mitev wrote:


> In case you update the doc, you may add `systemctl enable fstrim.timer`
> for setting a periodic job in the configuration section [1]. However:
> - the timer is run daily, not weekly (fstrim runs very fast though,
> shouldn't be an issue). - it might be specific to R4.0 - I don't remember
> if util-linux provided the timer in R3.2

Looks like it works on R3.2 as well, but when I "systemctl status
fstrim.timer" it is titled:

fstrim.timer - Discard unused blocks once a week

Are you sure R4.0 is daily? I can't really check right now.


awokd

unread,
Feb 16, 2018, 10:22:56 AM2/16/18
to nunotm...@gmail.com, qubes-users
I am intentionally forgetting that. :) Per the man page:

"If you want to create lighter, smaller initramfs images, you may want to
specify the --hostonly or -H option. Using this option, the resulting
image will contain only those dracut modules, kernel modules and
filesystems, which are needed to boot this specific machine. This has the
drawback, that you can’t put the disk on another controller or machine,
and that you can’t switch to another root filesystem, without recreating
the initramfs image. The usage of the --hostonly option is only for
experts and you will have to keep the broken pieces. At least keep a copy
of a general purpose image (and corresponding kernel) as a fallback to
rescue your system."

For a generic recommendation, the tradeoffs don't seem worth saving a few
bytes. I figure if someone really needs those bytes they can add the -H
themselves.

Ivan Mitev

unread,
Feb 16, 2018, 10:29:32 AM2/16/18
to qubes...@googlegroups.com
I'm sorry, it's weekly, I've looked at the wrong timer.

Also, `systemctl start fstrim.timer` will be required if one doesn't
plan to reboot in the next days...

awokd

unread,
Feb 16, 2018, 12:05:55 PM2/16/18
to aw...@danwin1210.me, nunotm...@gmail.com, qubes-users
Submitted https://github.com/QubesOS/qubes-doc/pull/592 ; thank you both.

And if I'm missing some other reason that dracut -H should be included,
please let me know! Might make sense to remove it from the GRUB section as
well.

awokd

unread,
Feb 17, 2018, 1:09:58 PM2/17/18
to aw...@danwin1210.me, nunotm...@gmail.com, qubes-users
On Fri, February 16, 2018 5:05 pm, awokd wrote:

> And if I'm missing some other reason that dracut -H should be included,
> please let me know! Might make sense to remove it from the GRUB section as
> well.

Found this which seems like it might be related:

https://ask.fedoraproject.org/en/question/80389/cannot-open-luks-container-with-rescue-initramfs/

Rescue gets generated without -H by default, and the standard with it. I
never noticed an issue because I'm using the default keyboard layout.

That's good enough for me; going to add -H back in. Thanks for pointing it
out.



Reply all
Reply to author
Forward
0 new messages