lkrg
lkrg copied to clipboard
"make install" exits 0 even on failure
As detected on Travis CI (seen on Ubuntu Xenial only):
CC [M] /home/travis/build/openwall/lkrg/src/p_lkrg_main.o
LD [M] /home/travis/build/openwall/lkrg/p_lkrg.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/travis/build/openwall/lkrg/p_lkrg.mod.o
LD [M] /home/travis/build/openwall/lkrg/p_lkrg.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-1077-gcp'
mkdir -p output
cp /home/travis/build/openwall/lkrg/p_lkrg.ko output
++sudo make install
make -C /lib/modules/4.15.0-1077-gcp/build M=/home/travis/build/openwall/lkrg modules_install
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-1077-gcp'
INSTALL /home/travis/build/openwall/lkrg/p_lkrg.ko
At main.c:160:
- SSL error:02001002:system library:fopen:No such file or directory: bss_file.c:175
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: bss_file.c:178
sign-file: certs/signing_key.pem: No such file or directory
DEPMOD 4.15.0-1077-gcp
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-1077-gcp'
depmod -a
/home/travis/build/openwall/lkrg/scripts/bootup/lkrg-bootup.sh install
[*] Executing LKRG's bootup installation script
[+] Systemd detected
Installing lkrg.service file under /usr/local/lib/systemd/system folder
cp: cannot create regular file '/usr/local/lib/systemd/system/lkrg.service': No such file or directory
Enabling lkrg.service on bootup
Failed to execute operation: No such file or directory
To start lkrg.service please use: systemctl start lkrg
[+] Done!
+result=0
As you can see, systemd service installation failed because /usr/local/lib/systemd/system was apparently returned by systemctl show -p UnitPath (that's what our script uses), yet that directory was missing.
If we fix our script to propagate errors to its exit code (and assuming that sudo does so as well), that CI build will start failing, and we'll need to add a workaround in there (would an mkdir be sufficient?) or better yet fix #95.
I'm not sure what we actually want to do on this issue, if anything. Maybe we want to propagate some errors - e.g., failing to install the service should result in non-zero exit code from make install, but failing to stop the service (maybe already stopped) on uninstalling it should probably let the script continue to deleting the file and returning zero.
I open this issue mostly to record the above. We might or might not "fix" it.
We need to consider that make install might be used by packages of LKRG installing it into a DESTDIR / "buildroot" directory (do we support that?) for subsequently including the target pathnames in the binary package. If so, having make install exit 0 even when it fails may result in a broken package instead of a package build failure, which is a bug.
I had this same problem with make install (version 0.9.1) on centos 7/8:
[root@repo lkrg-0.9.1]# make install make -C /lib/modules/3.10.0-1160.25.1.el7.x86_64/build M=/root/lkrg-0.9.1 modules_install make[1]: Wejście do katalogu /usr/src/kernels/3.10.0-1160.25.1.el7.x86_64'
INSTALL /root/lkrg-0.9.1/p_lkrg.ko
Can't read private key
DEPMOD 3.10.0-1160.25.1.el7.x86_64
make[1]: Opuszczenie katalogu /usr/src/kernels/3.10.0-1160.25.1.el7.x86_64' depmod -a /root/lkrg-0.9.1/scripts/bootup/lkrg-bootup.sh install [*] Executing LKRG's bootup installation script [+] Systemd detected Installing lkrg.service file under /usr/local/lib/systemd/system directory install: nie można utworzyć zwykłego pliku „/usr/local/lib/systemd/system/lkrg.service”: Nie ma takiego pliku ani katalogu To start lkrg.service please use: systemctl start lkrg To enable lkrg.service on bootup please use: systemctl enable lkrg.service Installing lkrg.conf file under /etc/sysctl.d directory [+] Done!
On centos 7/8 path /usr/local/lib/systemd/system doesn't exists but, but this says otherwise:
[root@repo system]# systemctl show -p UnitPath UnitPath=/run/systemd/generator.early /etc/systemd/system /run/systemd/system /run/systemd/generator /usr/local/lib/systemd/system /usr/lib/systemd/system /run/systemd/generator.late
I had this same problem
Not quite. This GitHub issue is specifically about the exit code - whether it is zero or non-zero on whatever problem might occur during make install. Your "this same problem" is just similar to the example I used to illustrate the exit code issue. You don't actually care about the exit code. So what you report is unsuitable for this GitHub issue.
Edit: opened #95 for the systemd unit directory issue.
Oh, right sorry. Thanks for separating this to new issue :)