Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initramfs: Fix cryptdevice identification #169

Closed
cbiedl opened this issue Feb 24, 2020 · 2 comments
Closed

initramfs: Fix cryptdevice identification #169

cbiedl opened this issue Feb 24, 2020 · 2 comments

Comments

@cbiedl
Copy link

cbiedl commented Feb 24, 2020

Hi there,
when packaging clevis 12 for Debian, I had to change scripts/local-top/clevis line 109:

-        local "$(grep '^CRYPTTAB_SOURCE=' /proc/"$pid"/environ)"
+        local "$(grep -z '^CRYPTTAB_SOURCE=' /proc/"$pid"/environ)"

The environment is zero-terminated, therefore the text-based grep will not find anything, therefore create an emtpy statement which causes script abort.
The strange part is why appearently nobody else encountered that problem.

@jmarcelletti
Copy link
Contributor

I tested this on Ubuntu 18.04 and it didn't work (broke things). To be clear this is just a clean into of 18.04.4 with nothing but default install with encrypted lvm. Here's what I see:
Screen Shot 2020-02-24 at 8 50 11 AM

@cbiedl
Copy link
Author

cbiedl commented Feb 27, 2020

Hmmm, interesting. Ubuntu uses a different busybox flavour for the initrd - something I wanted to adopt for Debian as well but never got a round tuit. And that grep has a different behaviour in that regard:
busybox-static:

 # /usr/bin/busybox grep ^BOOT /proc/1/environ
 #

busybox-initramfs:

# /usr/lib/initramfs-tools/bin/busybox grep ^BOOT /proc/1/environ
BOOT_IMAGE=/vmlinuz-5.4.0-14-generic
#

This explains why we two see a different behaviour, and possibly more people will stumble upon this.
They are many differences in the configurations of these flavours, I'll check in detail on another day.

@cbiedl cbiedl closed this as completed Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants