Bagaimana Cara Mengaktifkan /etc/rc.local di systemd Debian 10 Buster
Mengaktifkan atau Enable /etc/rc.local di systemd
jika kamu menginputkan teks dibawah ini
sudo systemctl status rc-local
maka akan muncul
● rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2015-11-26 23:54:58 CST; 59s ago Process: 1001 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE) Nov 26 23:54:57 vivid rc.local[1001]: File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 920, in require Nov 26 23:54:57 vivid rc.local[1001]: needed = self.resolve(parse_requirements(requirements)) Nov 26 23:54:57 vivid rc.local[1001]: File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 807, in resolve Nov 26 23:54:57 vivid rc.local[1001]: raise DistributionNotFound(req) Nov 26 23:54:57 vivid rc.local[1001]: pkg_resources.DistributionNotFound: shadowsocks==2.8.2 Nov 26 23:54:58 vivid sudo[1008]: pam_unix(sudo:session): session closed for user root Nov 26 23:54:58 vivid systemd[1]: rc-local.service: control process exited, code=exited status=1 Nov 26 23:54:58 vivid systemd[1]: Failed to start /etc/rc.local Compatibility. Nov 26 23:54:58 vivid systemd[1]: Unit rc-local.service entered failed state. Nov 26 23:54:58 vivid systemd[1]: rc-local.service failed.dan jika kamu mencoba mengaktifkan /etc/rc.local untuk menjalankannya saat booting dengan perintah
sudo systemctl enable rc-local
maka munculnya
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
Solusi
Dari perihal tersebut, diketahui bahwa /etc/rc.local tidaklah terinstal dan systemd tidak bisa mengaktifkannya
cara pertama yang harus kita lakukan adalah membuat filenya
sudo nano /etc/systemd/system/rc-local.service
kemudian tambahkan perintah tulisan berikut ini
[Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target
simpan dan tutup nano editor dengan tombol ctrl+x dan y untuk simpan
selanjutnya, berikan hak akses file /etc/rc.local tadi dengan cara
sudo chmod +x /etc/rc.local
setelah itu enable /etc/rc.local saat booting dengan perintah
sudo systemctl enable rc-local
hasilnya
Created symlink from /etc/systemd/system/multi-user.target.wants/rc-local.service to /etc/systemd/system/rc-local.service.
sekarang, jalankan dan lihat statusnya
sudo systemctl start rc-local.service sudo systemctl status rc-local.service
Hasilnya
● rc-local.service - /etc/rc.local Compatibility
Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2015-11-27 00:32:56 CST; 14min ago
Process: 879 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
Main PID: 880 (watch)
CGroup: /system.slice/rc-local.service
Note. bila dalam sistem debian kamu tidak memiliki file rc.local maka masukkan berikut
sudo nano /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
close dengan ctrl+x dan y untuk simpan
Sekian, Semoga Bermanfaat
0 coment�rios:
Posting Komentar