I have found out that in openSUSE 12.3, some startup scripts do not operate due to the usage of systemd. systemd really speeds up system startup by running the many startup processes in parallel and avoids the usage of shell scripts altogether. That is is good for speed, but not good if you are in need of running something in openSUSE as root when the system is restarted. In my case I was trying to run some VirtualBox mount commands in a VM running openSUSE 12.3 and could not get them to work properly. I nominally just add these commands to the /etc/init.d/after.local bash script, but in openSUSE 12.3 I found out that by default, after.local is not being run anymore. First off I have a procedure to make /etc/init.d/after.local run as normal, at least it seemed normal AND, I found out that you can instead just use /etc/init.d/boot.local as if it was after.local and it works just as before.
Now, since I figured out how to make after.local work, lets see how that is done.
- We need to create the text file after-local.service (shown below) in the folder /lib/systemd/system as root (Alt-F2):
kdesu kwrite /lib/systemd/system/after-local.service
This is what you put into this file and save it:
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=/etc/init.d/after.local Compatibility
ConditionFileIsExecutable=/etc/init.d/after.local
[Service]
Type=oneshot
ExecStart=/etc/init.d/after.local
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
- Next, we need to add the after-local.service to systemd. Open up a terminal session and run the following command:
sudo systemctl enable /lib/systemd/system/after-local.service
- Finally, you need to edit the file /etc/init.d/after.local as root and add in the stuff you want to run as root when you startup openSUSE (Alt-F2):
kdesu kwrite /etc/init.d/after.local
The commands shown here assume you are using KDE, which is the default in openSUSE. Please let me know if you have any questions about using this procedure. I have a script called sasi that can install the after-local file and enable it all for you automatically. Open up a terminal session (in openSUSE 12.1) and run the following command (You can copy and paste it in if you like):
wget -nc http://paste.opensuse.org/view/download/15931498 -O ~/bin/make-after-local ; chmod +x ~/bin/make-after-local ; make-after-local
You must enter the root user password once for the process to complete. This does not actually put anything into the after.local script, which you must do if you have something you want to run on your system startup as root.
If the after.local bash script does not exist, it will now be created for you with this new make-after-local bash script. This script has even been tested with Fedora 16, which also uses systemd and it created the after.local bash script and activated it for you, ready to use.
On openSUSE, as long as the after.local script exists, the make-after-local bash script will not over write it, but indicate the file was not written, which is OK.
Thank You,
Blogs: asroot : Bash : Packet Filter : C.F.U. : GPU’s : fewrup : F.S.M. : H.I. : LNVHW : MMCHECK : N.S.F. : S.A.K.C.
S.A.S.I. : S.C.L.U. : S.G.T.B. : S.K.I.M. : S.L.A.V.E. : S.L.R.C. : S.T.A.R.T. : S.U.F.F. : SYSEdit : systemd : YaST Power