diff mbox series

[v2,1/1] Dockerfile: provide kernel for libguestfs-tools

Message ID 20200714061856.4487-1-xypron.glpk@gmx.de
State New
Headers show
Series [v2,1/1] Dockerfile: provide kernel for libguestfs-tools | expand

Commit Message

Heinrich Schuchardt July 14, 2020, 6:18 a.m. UTC
The libguestfs-tools use QEMU to mount an image file. This requires a Linux
kernel.

On Ubuntu the kernel (/boot/vmlinuz*) is not readable for normal users
(chmod 600), cf.
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725

Install a kernel and make it readable for all users (chmod 644).

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2:
	add link to Ubuntu bug report
---
 Dockerfile | 4 ++++
 1 file changed, 4 insertions(+)

--
2.27.0

Comments

Tom Rini July 14, 2020, 9:28 p.m. UTC | #1
On Tue, Jul 14, 2020 at 08:18:56AM +0200, Heinrich Schuchardt wrote:

> The libguestfs-tools use QEMU to mount an image file. This requires a Linux
> kernel.
> 
> On Ubuntu the kernel (/boot/vmlinuz*) is not readable for normal users
> (chmod 600), cf.
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
> 
> Install a kernel and make it readable for all users (chmod 644).
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>

This causes the tests to fail now that they're trying to use
libguestfs-tools:
https://gitlab.denx.de/u-boot/u-boot/-/jobs/124872

I did a quick change to pass in the KVM group to useradd as well, but
that didn't catch.  I suspect that changing /dev/kvm inside the
container won't stick either.  But that shouldn't be fatal as it's still
fast enough.
Heinrich Schuchardt July 14, 2020, 10 p.m. UTC | #2
Am 14. Juli 2020 23:28:21 MESZ schrieb Tom Rini <trini at konsulko.com>:
>On Tue, Jul 14, 2020 at 08:18:56AM +0200, Heinrich Schuchardt wrote:
>
>> The libguestfs-tools use QEMU to mount an image file. This requires a
>Linux
>> kernel.
>> 
>> On Ubuntu the kernel (/boot/vmlinuz*) is not readable for normal
>users
>> (chmod 600), cf.
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
>> 
>> Install a kernel and make it readable for all users (chmod 644).
>> 
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>
>This causes the tests to fail now that they're trying to use
>libguestfs-tools:
>https://gitlab.denx.de/u-boot/u-boot/-/jobs/124872
>
>I did a quick change to pass in the KVM group to useradd as well, but
>that didn't catch.  I suspect that changing /dev/kvm inside the
>container won't stick either.  But that shouldn't be fatal as it's
>still
>fast enough.

KVM requires docker --privileged according to what I read.

Tests failing that were not excercised before seems to be a step into the right direction. - But a lot of work before us.

Thanks for the update.

Best regards

Heinrich
Tom Rini July 14, 2020, 10:10 p.m. UTC | #3
On Wed, Jul 15, 2020 at 12:00:25AM +0200, Heinrich Schuchardt wrote:
> Am 14. Juli 2020 23:28:21 MESZ schrieb Tom Rini <trini at konsulko.com>:
> >On Tue, Jul 14, 2020 at 08:18:56AM +0200, Heinrich Schuchardt wrote:
> >
> >> The libguestfs-tools use QEMU to mount an image file. This requires a
> >Linux
> >> kernel.
> >> 
> >> On Ubuntu the kernel (/boot/vmlinuz*) is not readable for normal
> >users
> >> (chmod 600), cf.
> >> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
> >> 
> >> Install a kernel and make it readable for all users (chmod 644).
> >> 
> >> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> >
> >This causes the tests to fail now that they're trying to use
> >libguestfs-tools:
> >https://gitlab.denx.de/u-boot/u-boot/-/jobs/124872
> >
> >I did a quick change to pass in the KVM group to useradd as well, but
> >that didn't catch.  I suspect that changing /dev/kvm inside the
> >container won't stick either.  But that shouldn't be fatal as it's
> >still
> >fast enough.
> 
> KVM requires docker --privileged according to what I read.
> 
> Tests failing that were not excercised before seems to be a step into the right direction. - But a lot of work before us.

It's not progress as they do pass when I apply the patch I posted the
other day to fix sudo'ing the tests.  And we may need to have an
off-list chat to make sure everyone with a runner is configured
consistently.
diff mbox series

Patch

diff --git a/Dockerfile b/Dockerfile
index bc3cdee..aac7f01 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -68,6 +68,7 @@  RUN apt-get update && apt-get install -y \
 	libssl-dev \
 	libudev-dev \
 	libusb-1.0-0-dev \
+	linux-image-kvm \
 	lzma-alone \
 	lzop \
 	mount \
@@ -94,6 +95,9 @@  RUN apt-get update && apt-get install -y \
 	zip \
 	&& rm -rf /var/lib/apt/lists/*

+# libguestfs-tools runs the kernel via QEMU. Give normal users access.
+RUN chmod 644 /boot/vmlinu*
+
 # Manually install libmpfr4 for the toolchains
 RUN wget http://mirrors.kernel.org/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.4-1_amd64.deb && dpkg -i libmpfr4_3.1.4-1_amd64.deb && rm libmpfr4_3.1.4-1_amd64.deb