Bug#916696: initramfs-tools: search for nonexistent resume device
On Sun, 10 Feb 2019 17:32:08 +0000
Ben Hutchings <ben@decadent.org.uk> wrote:
> > I include a patch, tested with and without an ephemeral swap:
> > - the second block (-79,9 +83,10) is the actual fix
> If you would actually send me the log messages I might understand this
> fix, but as it is I don't. I do need to understand it before I will
> apply it.
yes, sorry, you're right
here the log:
Calling hook resume
I: Configuration sets RESUME=
I: Checking swap device /dev/dm-1
I: /dev/dm-1 has device-mapper name sdb5_crypt; checking crypttab
I: Found cryptdev=sda5_crypt keyfile=/dev/urandom
I: Found cryptdev=sdb5_crypt keyfile=/dev/urandom
I: Rejecting /dev/dm-1 since it has no permanent key
I: Checking swap device /dev/dm-0
I: /dev/dm-0 has device-mapper name sda5_crypt; checking crypttab
I: Found cryptdev=sda5_crypt keyfile=/dev/urandom
I: Rejecting /dev/dm-0 since it has no permanent key
I: Found cryptdev=sdb5_crypt keyfile=/dev/urandom
Calling hook thermal
it ends up with the initrd file /main/conf/conf.d/zz-resume-auto
containing:
RESUME=/dev/dm-0
running resume with set -x explain what's going on:
+ report_verbose Rejecting /dev/dm-0 since it has no permanent key
+ test y != y
+ echo I: Rejecting /dev/dm-0 since it has no permanent key
I: Rejecting /dev/dm-0 since it has no permanent key
+ ephemeral=true
+ read -r cryptdev srcdev keyfile junk
+ report_verbose Found cryptdev=sdb5_crypt keyfile=/dev/urandom
+ test y != y
+ echo I: Found cryptdev=sdb5_crypt keyfile=/dev/urandom
I: Found cryptdev=sdb5_crypt keyfile=/dev/urandom
+ [ sdb5_crypt = sda5_crypt ]
+ read -r cryptdev srcdev keyfile junk
+ true
+ [ -n /dev/dm-0 ]
+ true
+ [ = auto ]
+ [ -n /dev/dm-0 ]
+ [ -z /dev/dm-0 ]
+ echo RESUME=/dev/dm-0
basically, it finishes the while-loop
while read -r cryptdev srcdev keyfile junk; do
+ read -r cryptdev srcdev keyfile junk
then it checks the ephemeral variable inside the for-loop
$ephemeral || break
+ true
now the for-loop is finished and it evaluates the first if-construct
if [ -n "$resume_auto" ] && ! $ephemeral; then
+ [ -n /dev/dm-0 ]
+ true
it evaluates the second if-construct (the bug is here, as it doesn't
account for ephemeral)
if [ "$RESUME" = auto ] || [ -n "$resume_auto" ]; then
+ [ = auto ]
+ [ -n /dev/dm-0 ]
then the inner if-construct
if [ -z "$resume_auto" ]; then
+ [ -z /dev/dm-0 ]
and finally it writes the resume file
echo "RESUME=${resume_auto}" > "${DESTDIR}/conf/conf.d/zz-resume-auto"
+ echo RESUME=/dev/dm-0
my fix is to reset the resume_auto variable if the device is ephemeral,
thus removing the need to check the ephemeral variable in the two
if-construct after the for-loop
$ephemeral || break # exit the for-loop if ephemeral=true
resume_auto= # otherwise empty resume_auto
that's it :)
thanks again for your time
ciao!
Reply to: