Thorsten Glaser
2024-08-21 00:00:01 UTC
(Please d=CC=B2o=CC=B2 Cc me on replies, I don=E2=80=99t subscribe to this =
list. Thanks!)
Hi,
this is a bit curious problem:
I have a setup with swap devices on dmcrypt:
$ cat /etc/crypttab
# <target name> <source device> <key file> <options>
crtpv LABEL=3Dfooclvm none discard,luks,init=
ramfs
cswp1 /dev/vg-foo/lv-swp1 /dev/random discard,cipher=3Dae=
s-xts-plain64,size=3D256,plain,swap
cswp2 /dev/vg-foo/lv-swp2 /dev/random discard,cipher=3Dae=
s-xts-plain64,size=3D256,plain,swap
In a cronjob, I basically do swapoff && cryptdisks_stop && \
cryptdisks_start && swapon for both swaps individually to
throw away the old encryption key regularily (but not too
frequently).
I immediately ran into the problem, when trying this for the
first time, that a =E2=80=9Cswapoff /dev/mapper/cswp1=E2=80=9D returns befo=
re
the device is released, so the subsequent cryptdisks_stop fails.
I found that inserting a =E2=80=9Ccat /proc/swaps=E2=80=9D, funnily enough,
makes those failures less frequent but still present; adding
a =E2=80=9Csleep 3=E2=80=9D as well made it work for months.
Until tonight when it didn=E2=80=99t.
Just adding a =E2=80=9Csleep=E2=80=9D is no proper fix anyway, so the quest=
ion
is, how to wait in a shell script until the swap device is
*really* swapoff=E2=80=99d when the syscall returns too early, and
(someone from the Linux kernel maintainers reading this?) should
I report the latter as a bug against the kernel?
This is on bullseye/amd64, on VMs and bare metal both. Using
direct partitions like /dev/sda3 (or via LABEL=3D to avoid trouble)
makes no difference from using LVs.
Thanks in advance,
//mirabilos
--=20
16:47=E2=8E=9C=C2=ABmika:#grml=C2=BB .oO(mira ist einfach gut....) 23:=
22=E2=8E=9C=C2=ABmikap:#grml=C2=BB
mirabilos: und dein bootloader ist geil :) 23:29=E2=8E=9C=C2=ABmikap:#gr=
ml=C2=BB und ich
finds saugeil dass ich ein bsd zum booten mit grml hab, das muss ich dann
gleich mal auf usb-stick installieren=09-- Michael Prokop =C3=BCber MirOS b=
sd4grml
list. Thanks!)
Hi,
this is a bit curious problem:
I have a setup with swap devices on dmcrypt:
$ cat /etc/crypttab
# <target name> <source device> <key file> <options>
crtpv LABEL=3Dfooclvm none discard,luks,init=
ramfs
cswp1 /dev/vg-foo/lv-swp1 /dev/random discard,cipher=3Dae=
s-xts-plain64,size=3D256,plain,swap
cswp2 /dev/vg-foo/lv-swp2 /dev/random discard,cipher=3Dae=
s-xts-plain64,size=3D256,plain,swap
In a cronjob, I basically do swapoff && cryptdisks_stop && \
cryptdisks_start && swapon for both swaps individually to
throw away the old encryption key regularily (but not too
frequently).
I immediately ran into the problem, when trying this for the
first time, that a =E2=80=9Cswapoff /dev/mapper/cswp1=E2=80=9D returns befo=
re
the device is released, so the subsequent cryptdisks_stop fails.
I found that inserting a =E2=80=9Ccat /proc/swaps=E2=80=9D, funnily enough,
makes those failures less frequent but still present; adding
a =E2=80=9Csleep 3=E2=80=9D as well made it work for months.
Until tonight when it didn=E2=80=99t.
Just adding a =E2=80=9Csleep=E2=80=9D is no proper fix anyway, so the quest=
ion
is, how to wait in a shell script until the swap device is
*really* swapoff=E2=80=99d when the syscall returns too early, and
(someone from the Linux kernel maintainers reading this?) should
I report the latter as a bug against the kernel?
This is on bullseye/amd64, on VMs and bare metal both. Using
direct partitions like /dev/sda3 (or via LABEL=3D to avoid trouble)
makes no difference from using LVs.
Thanks in advance,
//mirabilos
--=20
16:47=E2=8E=9C=C2=ABmika:#grml=C2=BB .oO(mira ist einfach gut....) 23:=
22=E2=8E=9C=C2=ABmikap:#grml=C2=BB
mirabilos: und dein bootloader ist geil :) 23:29=E2=8E=9C=C2=ABmikap:#gr=
ml=C2=BB und ich
finds saugeil dass ich ein bsd zum booten mit grml hab, das muss ich dann
gleich mal auf usb-stick installieren=09-- Michael Prokop =C3=BCber MirOS b=
sd4grml