SUSE Support

Here When You Need Us

The after.local.service fails to start with exec format error

This document (7017128) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 12
SUSE Linux Enterprise Server 12 Service Pack 1 (SLES 12 SP1)

Situation

After enabling the after.local.service in SLE12, the service does not start at boot or after boot.
ls-boot:~ # systemctl status after.local
after.local.service
   Loaded: loaded (/etc/init.d/after.local)
   Active: failed (Result: exit-code) since Wed 2016-01-06 01:06:07 MST; 7h ago
  Process: 638 ExecStart=/etc/init.d/after.local start (code=exited, status=203/EXEC)

Jan 06 01:06:07 ls-boot systemd[1]: Failed to start after.local.service.
A restart of the service results in the following error:
ls-boot:~ # systemctl restart after.local
Job for after.local.service failed. See "systemctl status after.local.service" and "journalctl -xn" for details.
If you run journalctl and search for after.local, you see the following error:
ls-boot systemd[675]: Failed at step EXEC spawning /etc/init.d/after.local: Exec format error
The content of /etc/init.d/after.local is:
ls-boot:~ # cat /etc/init.d/after.local 
touch /var/log/test.log


Resolution

Add a hashpling to the beginning of /etc/init.d/after.local.

Change /etc/init.d/after.local from this:
ls-boot:~ # cat /etc/init.d/after.local 
touch /var/log/test.log
to this:
ls-boot:~ # cat /etc/init.d/after.local 
#!/bin/bash
touch /var/log/test.log
Reboot the server or restart the systemd processes as follows:
ls-boot:~ # systemctl daemon-reload
ls-boot:~ # systemctl restart after.local
ls-boot:~ # systemctl status after.local
after.local.service
   Loaded: loaded (/etc/init.d/after.local)
   Active: active (exited) since Wed 2016-01-06 09:32:19 MST; 11s ago
  Process: 2594 ExecStart=/etc/init.d/after.local start (code=exited, status=0/SUCCESS)

ls-boot:~ # ls -l /var/log/test.log
-rw-r--r-- 1 root root 0 Jan  6 09:32 /var/log/test.log


Cause

The /etc/init.d/after.local file was missing the hashpling at the beginning of the file. A hashpling is required for any systemd service script.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7017128
  • Creation Date: 06-Jan-2016
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.