All of lore.kernel.org
 help / color / mirror / Atom feed
* cryptsetup in initramfs causes ~4 MB image size increase
@ 2015-06-23  2:21 Craig McQueen
  2015-06-25  6:30 ` Craig McQueen
  0 siblings, 1 reply; 2+ messages in thread
From: Craig McQueen @ 2015-06-23  2:21 UTC (permalink / raw)
  To: yocto

I'm interested to use an encrypted root filesystem, by using cryptsetup in initramfs.

I'm finding that adding cryptsetup to an initramfs image increases its size by about 4 MB. It seems that cryptsetup depends on openssl and lvm2, and lvm2 depends on bash, and the result of that is that a lot of extra files get dragged in.

Is this all strictly necessary? Perhaps cryptsetup really only needs libraries, not all of openssl and lvm2.

What would be a good way to go about reducing the dependencies that get pulled in for cryptsetup?

I also noticed that libgcrypt could possibly be used instead of openssl (by putting in bbappend, PACKAGECONFIG = ""), saving about 0.5 MB. However libgcrypt isn't used, according to the cryptsetup bb file, because it drops root privileges if it is linked with libcap support. That gives the obscure cryptsetup error "Cannot initialize device-mapper. Is dm_mod kernel module loaded?" when trying to use cryptsetup with libgcrypt. Is there any reasonable work-around for this?

-- 
Craig McQueen



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: cryptsetup in initramfs causes ~4 MB image size increase
  2015-06-23  2:21 cryptsetup in initramfs causes ~4 MB image size increase Craig McQueen
@ 2015-06-25  6:30 ` Craig McQueen
  0 siblings, 0 replies; 2+ messages in thread
From: Craig McQueen @ 2015-06-25  6:30 UTC (permalink / raw)
  To: Craig McQueen, yocto

I earlier wrote:
> 
> I'm interested to use an encrypted root filesystem, by using cryptsetup in
> initramfs.
> 
> I'm finding that adding cryptsetup to an initramfs image increases its size by
> about 4 MB. It seems that cryptsetup depends on openssl and lvm2, and
> lvm2 depends on bash, and the result of that is that a lot of extra files get
> dragged in.
> 
> Is this all strictly necessary? Perhaps cryptsetup really only needs libraries,
> not all of openssl and lvm2.
> 
> What would be a good way to go about reducing the dependencies that get
> pulled in for cryptsetup?
> 
> I also noticed that libgcrypt could possibly be used instead of openssl (by
> putting in bbappend, PACKAGECONFIG = ""), saving about 0.5 MB. However
> libgcrypt isn't used, according to the cryptsetup bb file, because it drops root
> privileges if it is linked with libcap support. That gives the obscure cryptsetup
> error "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"
> when trying to use cryptsetup with libgcrypt. Is there any reasonable work-
> around for this?

I found that I can cut it down significantly, using the following lvm2_2.%.bbappend:

-----------------------------------------------------------
PACKAGES =+ "lvm2-libdevmapper"

# ${base_libdir}/udev ${sbindir}/dmsetup are to get device mapper udev rules,
# to avoid cryptsetup luksOpen hanging.
FILES_lvm2-libdevmapper = "${libdir}/libdevmapper.so.* ${base_libdir}/udev ${sbindir}/dmsetup"

RDEPENDS_lvm2-libdevmapper = "bash"

RDEPENDS_${PN} += " lvm2-libdevmapper"

RPROVIDES_${PN}-dev = "lvm2-libdevmapper-dev"
-----------------------------------------------------------

That cuts out a bunch of unneeded lvm files.

I'm not sure why there needs to be a bash dependency, but it didn't work without it. I'd like to get rid of bash if it's possible.

(After reading more about libgcrypt, I think I'll just stick with openssl. It seems questionable design for the library, to drop an application's capabilities.)

-- 
Craig McQueen



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-25  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-23  2:21 cryptsetup in initramfs causes ~4 MB image size increase Craig McQueen
2015-06-25  6:30 ` Craig McQueen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.