Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions DC-SAP-systemd-management
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## ----------------------------
## Doc Config File for the DB Assembly test
## ----------------------------
##
## Basics
MAIN="systemd-management.asm.xml"
SRC_DIR="articles"
IMG_SRC_DIR="images"
## Profiling
PROFOS="sles4sap"
#PROFARCH="x86_64;zseries;power;aarch64"

## stylesheet location
STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2022-ns"
FALLBACK_STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2021-ns"

DOCBOOK5_RNG_URI="urn:x-suse:rng:v2:geekodoc-flat"
17 changes: 17 additions & 0 deletions DC-SLES-systemd-management
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## ----------------------------
## Doc Config File for the DB Assembly test
## ----------------------------
##
## Basics
MAIN="systemd-management.asm.xml"
SRC_DIR="articles"
IMG_SRC_DIR="images"
## Profiling
PROFOS="sles"
PROFCONDITION="16.0"

## stylesheet location
STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2022-ns"
FALLBACK_STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2021-ns"

DOCBOOK5_RNG_URI="urn:x-suse:rng:v2:geekodoc-flat"
17 changes: 13 additions & 4 deletions articles/systemd-management.asm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
<resource xml:id="_systemd-manage-troubleshoot" href="../tasks/systemd-manage-troubleshoot.xml">
<description>Troubleshooting systemd management </description>
</resource>

<resource xml:id="_systemd-convert-sysv" href="../tasks/systemd.sysv-convert.xml">
<description>Converting SysV init to systemd </description>
</resource>
</resources>
<!-- References -->
<resources>
Expand Down Expand Up @@ -69,18 +71,18 @@
<merge>
<title>Managing &systemd; Services</title>
<revhistory xml:id="rh-systemd-services">
<revision><date>2025-11-04</date>
<revision><date>2025-12-16</date>
<revdescription>
<para>
Initial version
Added a procedure to convert Sys V init to systemd
</para>
</revdescription>
</revision>
</revhistory>
<!-- TODO: provide a listing of possible and validatable meta entry values. Maybe in our geekodoc repo? -->
<!-- add author's e-mail -->
<meta name="maintainer" content="[email protected]" its:translate="no"/>

<!-- this does not work yet. Use the dm tags listed below for now
<meta name="bugtracker" its:translate="no">
<phrase role="url">https://bugzilla.suse.com/enter_bug.cgi</phrase>
Expand Down Expand Up @@ -170,6 +172,12 @@
Basic understanding of Linux processes, daemons and control groups
</para>
</listitem>
<listitem>
<para>
<link
xlink:href="https://documentation.suse.com/sles/16.0/html/SLES-systemd-basics/index.html#systemctl-commands">Understanding unit files</link>
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
Expand All @@ -181,6 +189,7 @@
<!-- pull in a topic as is -->
<!-- pull in a topic and switch the title -->
<module resourceref="_about-systemd" renderas="section"/>
<module resourceref="_systemd-convert-sysv" renderas="section"/>
<module resourceref="_starting-systemd-services" renderas="section"/>
<module resourceref="_enabling-systemd-services" renderas="section"/>
<module resourceref="_terminal-signals-systemd" renderas="section"/>
Expand Down
101 changes: 101 additions & 0 deletions tasks/systemd.sysv-convert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
[
<!ENTITY % entities SYSTEM "../common/generic-entities.ent">
%entities;
]>
<topic xml:id="systemd-convert-sysv" xml:lang="en"
role="task"
xmlns="http://docbook.org/ns/docbook" version="5.1"
xmlns:its="http://www.w3.org/2005/11/its"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink">
<info>
<meta name="maintainer" content="[email protected]" its:translate="no"/>
<title>Converting SysV init to &systemd; </title>
</info>
<para>
SysV init is the traditional initialization system used by older Linux distributions.
It is often referred to as init. &systemd; is now the default and only initialization system for <phrase os="sles">
&productname; 16</phrase> <phrase os="sle4sap"></phrase>.
</para>
<example>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the procedure more generic and state that the mentioned init files are a must-have conversion (if they are).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this " more generic" as the intent to give an example and jira mentions boot.local so I used that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose there may be more scripts that need to be migrated, hence the more generic while using the boot as an example. Here it seems these two are the only ones that needs to migrated.

<title>Converting <literal>boot.local</literal> and <literal>after.local</literal> to &systemd;</title>
<para>The SysV init script files like <filename>/etc/init.d/boot.local</filename> and <filename>/etc/init.d/after.local</filename>
were used for running custom commands or scripts at the end of the boot process.</para>
<para>In a &systemd; environment, to run your own startup script,it is recommended to create a custom &systemd; service unit file.
The <literal>boot.local</literal> script typically runs very early in the boot process, while <literal>after.local</literal> runs later, after most system services are up.
</para>
<procedure>
<step>
<para><emphasis role="bold">Create the scripts:</emphasis> Create script files with the commands and make it executable.
For example:</para>
<itemizedlist>
<listitem><para>For <literal>boot.local</literal>actions, create <filename>/usr/local/bin/my.early-boot.sh</filename> </para></listitem>
<listitem><para>For <literal>after.local</literal>actions, create <filename>/usr/local/bin/my.late-boot.sh</filename> </para></listitem>
</itemizedlist>
</step>
<step>
<para><emphasis role="bold">Create the &systemd; unit files:</emphasis> Create the <literal>.service</literal> unit files in the <filename>/etc/systemd/system/</filename> directory.
For example:</para>
<itemizedlist>
<listitem><para>For <literal>boot.local</literal>, this service should run before basic system initialization.
Create a service file, <filename>/etc/systemd/system/my-early-boot.service</filename>:</para>
<screen>[Unit]
Description=My early startup script
DefaultDependencies=no
After=basic.target
Before=basic.target sysinit.target shutdown.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/my-early-boot.sh
RemainAfterExit=yes

[Install]
WantedBy=basic.target
</screen>
<itemizedlist>
<listitem><para> <literal>Type=oneshot</literal> is suitable for scripts that run once and then exit.</para></listitem>
<listitem><para> <literal>DefaultDependencies=no</literal> and <literal> After/Before</literal> ensures it runs at an equivalent time to <literal>boot.local</literal>.
</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>For <literal>after.local</literal>, this service should run later, typically when the multi-user environment is ready.
If it depends on the network being up, add <literal>After=network-online.target</literal>. Create <filename>/etc/systemd/system/my-late-boot.service:</filename>:</para>
<screen>[Unit]
Description=My late startup script
# Add After=network-online.target if your script needs network access
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/my-late-boot.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
</screen>
</listitem>
</itemizedlist>
</step>
<step>
<para><emphasis role="bold">Enable and start the services:</emphasis> After creating the files, reload the &systemd; manager configuration and enable your new services to run at boot:
</para>
<screen>&prompt.sudo; systemctl daemon-reload</screen>
<screen>&prompt.sudo; systemctl enable my-early-boot.service</screen>
<screen>&prompt.sudo; systemctl enable my-late-boot.service</screen>
<para>Optionally you can start the services without a reboot.</para>
<screen>&prompt.sudo; systemctl start my-early-boot.service</screen>
<screen>&prompt.sudo; sstemctl start my-late-boot.service</screen>
</step>
<step>
<para><emphasis role="bold">Verification:</emphasis> To verify that your new services are running as expected:</para>
<screen>&prompt.sudo; systemctl status my-early-boot.service</screen>
<screen>&prompt.sudo; systemctl status my-late-boot.service</screen>
<para>The expected output is that both should show <literal>Active: inactive (dead)</literal> with a successful exit code, because they are <literal>Type=oneshot</literal> and execute only once.
</para>
</step>
</procedure>
</example>
</topic>