I'm trying to test Wazuh configuration related to half-configured packages. So, I'm trying to create a .deb
package that will end up half configured when installed.
I started by following these instructions for creating a dirt-simple, do-nothing package.
I tried changing the exit code of debian/postinst.ex
to 1, but the package installed successfully anyway.
I tried adding a non-existing file to debian/conffiles
, but debuild
failed.
I've also searched all over for information on the things that can cause a package to be left half configured, without any luck.
Thanks!
First of all, I want to mention that there are two different status for failed installed packages:
Source: https://www.man7.org/linux/man-pages/man1/dpkg.1.html
If you want a half-configured package, then the package must be unpackaged and it is the configuration step the one that should fail.
Now, if you follow the guide you shared with us, you may have missed the part where it says that the
*.ex
files are examples and are not introduced in the package so if you're modifying the filepostinst.ex
, these changes will no take effect.You can remove all the
*.ex
files and create your ownpostinst
file. For example I've used this one:Using this file (with the correct name), your code will be executed after the package installation. And you will get something like this:
Then, you could use the
-s
flag on dpkg to check the package status:As you can see, as the package has no way to handle this kind of error, the package is still installed and its status is
install ok half-configured
I hope this has helped you :)