Creating A System Service for systemd-based Linux Distros

Systemd (System Daemon) is a system and service management mechanism primarily responsible for init processes (i.e. Assisting kernel with starting required services needed at machine bootup), and is the predecessor of SysVinit. Many modern-day Linux distributions have moved to using systemd in place of init.d for system and service management, but there are still as many that are configured to utilize the legacy SysVinit service manager.

As for IBM Automatic Data Lineage, with version R42.3 and newer, systemd is used by

default. For older versions, see Steps for Creating MantaLauncher.service (R42 - R42.2) section.

Steps for Creating MantaLauncher.service (R42.3 and newer):

Clean install

Clean install of Automatic Data Lineage R42.3 and newer works out of the box and if chosen to install Automatic Data Lineage as a service, the new systemd service will be created.

Upgrade

There are two ways how to upgrade Automatic Data Lineage installed as a service.

  1. Run the upgrade as a root user

  2. Run the upgrades as a non-root user and after the installation finishes, run the <installdir>/launcher/bin/reinstall_service.sh.

Possible issues with SELinux

In Linux distributions with SELinux (https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-security-enhanced_linux-introduction ) enabled, the systemd services may fail to run, as executing scripts in home directories is disabled by default. There are two ways how to mitigate this problem:

  1. Create a new SEL rule to allow the service to run

    1. To do this, try to start MantaLauncher service and then follow the instructions on this page: 8.3.8. Allowing Access: audit2allow Red Hat Enterprise Linux 6 | Red Hat Customer Portal

      1. There may be multiple SEL exceptions that you will have to allow
  2. Set SEL to permissive mode (not recommended)

If you are having an issue with creating a SEL rule to allow the service to run, you can try the following steps instead:

  1. Switch SEL to permissive mode

  2. Run the service

  3. Verify the services were started

  4. Shutdown the service

  5. Switch SEL back to enforced mode

  6. Try to start the service

Steps for Creating MantaLauncher.service (R42 - R42.2):

As for Automatic Data Lineage, during installation when wanting to have MantaLauncher installed as a system service so that the service starts automatically during boot-time, the Manta installer may attempt to configure the system service via the SysVinit (init.d) manager, when the OS is actually using systemd, therefore may fail to create the system service. This is due to the way systemd compartmentalizes all of the various run-level services into different resource-based groupings, in which, are defined by “unit” files which tell systemd what/when to do with each service/resource. This kind of behavior seems to be most commonly found on the latest RHEL-based Linux distros. If this is encountered, you may perform the following steps to manually create and enable the MantaLauncher system service.

Important: The following procedure requires root privileges:
  1. Stop the Manta services/applications if they are currently running

  2. Move into the Launcher bin directory

    cd <manta_install_dir>/launcher/bin
    
  3. Edit both startup.sh and shutdown.sh files, and at the top, if SERVICE=false, change to SERVICE=true

  4. Download the service “unit” file MantaLauncher.service found below and update the following directive values under the [Service] section to reflect your environment (Do not use quotations around the values) as per template below:

    Type=forking
    PIDFile=<manta_launcher_home>/manta-launcher-dir/data/launcher.pid
    ExecStart=<launcher_bin_dir>/startup.sh _os_startup
    ExecStop=<launcher_bin_dir>/shutdown.sh
    User=<manta_user>
    Group=<manta_user_group>
    

    Example including full paths:

    Type=forking
    PIDFile=/opt/mantaflow/launcher/manta-launcher-dir/data/launcher.pid
    ExecStart=/opt/mantaflow/launcher/bin/startup.sh _os_startup
    ExecStop=/opt/mantaflow/launcher/bin/shutdown.sh
    User=manta
    Group=users
    

MantaLauncher.service

  1. After being updated and SCP’d/FPT’d onto the Automatic Data Lineage host machine, copy the file (As root user/privileges) into the /usr/lib/systemd/system/ directory

    sudo cp ./MantaLauncher.service /usr/lib/systemd/system/
    
  2. Run following command (Again, with root privileges) so the service starts during system boot:

    sudo systemctl enable MantaLauncher.service
    
  3. Lastly, you may test your work by starting the new system service with following command:

    sudo systemctl start MantaLauncher.service
    

Commands to control the newly created MantaLauncher.service:

# To start the service
sudo systemctl start MantaLauncher.service

# To stop the service
sudo systemctl stop MantaLauncher.service

# To view current information/details for the service (Can be good to use for debugging if the service is failing to start/stop)
sudo systemctl status MantaLauncher.service

# This will disable the service from being started during bootup
sudo systemctl disable MantaLauncher.service