Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-built static binary install script does not detect SLES as systemd OS #4641

Closed
tsingletonacic opened this issue Nov 13, 2018 · 4 comments
Assignees
Labels
area/packaging Packaging and operating systems support bug priority/high Super important issue
Milestone

Comments

@tsingletonacic
Copy link
Contributor

Bug report summary

Using the pre-built static binary on SLES (Suse Linux Enterprise Server) 12.3, I get an error at init file registration

--- Install netdata at system init ---
I don't know what init file to install on system 'sles-12.3'. Open a github issue to help us fix it.
FAILED Cannot install netdata init service.

SLES 12.3 uses /usr/lib/systemd as systemd path instead of /lib/systemd

I have prepared a patch for functions.sh, will submit as soon as I understand how to

OS / Environment

SLES 12.3

# rpm -qa | grep systemd | sort 
grub2-systemd-sleep-plugin-2.02-2.12.noarch
libsystemd0-228-142.1.x86_64
libsystemd0-32bit-228-142.1.x86_64
systemd-228-142.1.x86_64
systemd-32bit-228-142.1.x86_64
systemd-bash-completion-228-142.1.noarch
systemd-presets-branding-SLE-12.2-2.26.noarch
systemd-sysvinit-228-142.1.x86_64
util-linux-systemd-2.29.2-2.2.x86_64
@tsingletonacic
Copy link
Contributor Author

--- functions.sh.original	2018-11-13 15:08:01.589754691 +0100
+++ functions.sh	2018-11-13 15:02:34.901759130 +0100
@@ -441,8 +441,8 @@
 issystemd() {
     local pids p myns ns systemctl
 
-    # if the directory /lib/systemd/system does not exit, it is not systemd
-    [ ! -d /lib/systemd/system ] && return 1
+    # if the directory /lib/systemd/system OR /usr/lib/systemd/system (SLES 12.x) does not exit, it is not systemd
+    [ ! -d /lib/systemd/system -a ! -d /usr/lib/systemd/system ] && return 1
 
     # if there is no systemctl command, it is not systemd
     # shellcheck disable=SC2230
@@ -563,15 +563,25 @@
             NETDATA_START_CMD="systemctl start netdata"
             NETDATA_STOP_CMD="systemctl stop netdata"
 
+            SYSTEMD_DIRECTORY=""
+
             if [ -d "/lib/systemd/system" ]
             then
+                SYSTEMD_DIRECTORY="/lib/systemd/system"
+            elif [ -d "/usr/lib/systemd/system" ]
+            then
+                SYSTEMD_DIRECTORY="/usr/lib/systemd/system"
+            fi
+
+            if [ "${SYSTEMD_DIRECTORY}x" != "x" ]
+            then
                 echo >&2 "Installing systemd service..."
-                run cp system/netdata.service /lib/systemd/system/netdata.service && \
+                run cp system/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" && \
                     run systemctl daemon-reload && \
                     run systemctl enable netdata && \
                     return 0
             else
-                echo >&2 "no '/lib/systemd/system' directory; cannot install netdata.service"
+                echo >&2 "no systemd directory; cannot install netdata.service"
             fi
         else
             install_non_systemd_init

@Ferroin
Copy link
Member

Ferroin commented Nov 13, 2018

Confirmed also on OpenSUSE Leap and Tumbleweed.

@paulfantom paulfantom added area/packaging Packaging and operating systems support and removed OS/installation labels Nov 18, 2018
@paulfantom
Copy link
Contributor

Closing since #4643 is merged. Please reopen if it still doesn't work.

@paulfantom paulfantom self-assigned this Nov 19, 2018
@paulfantom paulfantom added the priority/high Super important issue label Nov 19, 2018
@paulfantom paulfantom added this to the v1.12-rc1 milestone Nov 19, 2018
@paulfantom
Copy link
Contributor

This should be fixed in #4643. Please reopen if it still doesn't work for you.

@cakrit cakrit modified the milestones: v1.12-rc1, v1.12-rc0 Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packaging Packaging and operating systems support bug priority/high Super important issue
Projects
None yet
Development

No branches or pull requests

4 participants