Hi Philippe, sorry for the late reply.
> FYI, this is the kind of wart this issue is forcing down on me and all my > users: > https://github.com/nexB/extractcode/blob/aa5da29014ce4fbffca53c09689a2623e2b78196/src/extractcode/vmimage.py#L82 > >> def check_linux_kernel_is_readable(): >> """ >> Return True if the kernel executable file can be read. This is required by >> guestfish and libguestfs and this is an oddity mostly on Ubuntu. >> See: >> - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725 >> - https://bugzilla.redhat.com/show_bug.cgi?id=1670790 >> - https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1813662 >> """ Yeah, I am well aware… As far as I can recall, you may well be the first person to come up with somewhat sensible/constructive approach to this mess and I am sorry that I let your mail sit in my inbox for so long. There are just a few implementation details that should be done differntly, I'll comment inline: > I would like to create a package that fix this issue. Why not add the hack in one of the libguestfs packages themselves? I think that libguestfs0 would be the right choice. I'd be happy to include this into the libguestfs package under two conditions: - The changes are Ubuntu-specific. - The changes have been tested. > Is this the correct way: > > 1. As sudo, create the file /etc/kernel/postinst.d/statoverride with this > content, devised by Kees Cook (@kees) in > https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725/comments/3 :: > > #!/bin/sh > version="$1" > # passing the kernel version is required > [ -z "${version}" ] && exit 0 > dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-${version} This looks reasonable. /etc/kernel/postinst.d/statoverride can simply be added to a package (your package or libguestfs0), there's no need for creating a script that does this at install time. And instead of calling the script "statoverride", you should use something that hints at the package name. > 2. Setup the exxecutable permissions:: > > sudo chmod +x /etc/kernel/postinst.d/statoverride This is not necessary if you install that file into the package with the right permissions in the first place. > And if yes, is this enough to create a package that adds this file? There are a few other issues to consider: When a kernel image is removed, you should also remove the corresponding statoverride entry (dpkg-statoverride remove $file), via a prerm or postrm script. The kernel postinst script does not help with kernel images that are already installed when libguestfs0 (or your custom package) is added to the system, so you'll need to call dpkg-statoverride for all kernel images. Similarly, users will expect that removing the package will remove the statoverride entries, so you'll need a postrm script that does that for all kernel images. Cheers, -Hilko -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1813662 Title: Cannot build VM To manage notifications about this bug go to: https://bugs.launchpad.net/libguestfs/+bug/1813662/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs