You are not logged in.
Pages: 1
Hi,
strangly enough, I cannot enable some services during Arch Linux installation. I installed ntp, wicd via pacstrap, e.g. Then,
systemctl enable --now ntpd.service
fails with the error message
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down
same with wicd.service. However, at the end of the installation I am able to start ntp via
systemctl enable --now ntpd.service
But
systemctl enable --now wicd.service
leads to the error message
Failed to enable unit: Unit file wicd.service does nost exist.
though wicd has been installed successfully. I've no idea how to solve that.
Thanks,
mipi
Last edited by mipi (2018-11-17 15:35:59)
Offline
You do it when you have booted into the system.
Offline
You mean after a reboot?
Actually, I would like to have the installation automated as far as possible. Therefore, I do the installation via script. I created a meta package that contains all packages that I want to have installed as dependencies. In the script, the meta package is installed via pacstrap. The corresponding services (for ntp, wicd etc.) are enabled in the post_install() hook - at least that was my idea, but that doesn't seem to work. If the service enablement can only be done after a reboot, is there any possibility to automate that (e.g. by triggering that already somehow during the installation)? As far as I understand the documentation, neither the PKGBUILD hooks nor the pacman hooks support something like that.
Offline
I do the installation via script.
Burying the lede.
Offline
Enabled services are nothing more that soft links under /etc/systemd/... that aim back to /usr/lib/...
Just create them in the script.
ewaller@turing/home/ewaller % ls -l /etc/systemd//system/*wants/
/etc/systemd//system/bluetooth.target.wants/:
total 0
lrwxrwxrwx 1 root root 41 Sep 10 2017 bluetooth.service -> /usr/lib/systemd/system/bluetooth.service
/etc/systemd//system/getty.target.wants/:
total 0
lrwxrwxrwx 1 root root 38 Apr 10 2015 getty@tty1.service -> /usr/lib/systemd/system/getty@.service
/etc/systemd//system/multi-user.target.wants/:
total 0
lrwxrwxrwx 1 root root 37 May 4 2015 acpid.service -> /usr/lib/systemd/system/acpid.service
lrwxrwxrwx 1 root root 39 Jul 17 2015 hddtemp.service -> /usr/lib/systemd/system/hddtemp.service
lrwxrwxrwx 1 root root 38 Aug 28 2015 hpfall.service -> /usr/lib/systemd/system/hpfall.service
lrwxrwxrwx 1 root root 40 Jun 29 2016 iptables.service -> /usr/lib/systemd/system/iptables.service
lrwxrwxrwx 1 root root 42 Sep 27 2015 lm_sensors.service -> /usr/lib/systemd/system/lm_sensors.service
lrwxrwxrwx 1 root root 37 Nov 25 2015 local.service -> /usr/lib/systemd/system/local.service
lrwxrwxrwx 1 root root 43 Apr 13 2015 org.cups.cupsd.path -> /usr/lib/systemd/system/org.cups.cupsd.path
lrwxrwxrwx 1 root root 33 Mar 24 2018 router2.mount -> /etc/systemd/system/router2.mount
lrwxrwxrwx 1 root root 38 Mar 24 2018 router-share.mount -> /etc/systemd/system/router-share.mount
lrwxrwxrwx 1 root root 40 Mar 24 2018 router-storage.mount -> /etc/systemd/system/router-storage.mount
lrwxrwxrwx 1 root root 38 Nov 25 2015 smartd.service -> /usr/lib/systemd/system/smartd.service
lrwxrwxrwx 1 root root 36 May 12 2015 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx 1 root root 48 Oct 23 2015 systemd-networkd.service -> /usr/lib/systemd/system/systemd-networkd.service
lrwxrwxrwx 1 root root 48 Jul 7 2017 systemd-resolved.service -> /usr/lib/systemd/system/systemd-resolved.service
lrwxrwxrwx 1 root root 47 Oct 23 2015 wpa_supplicant@wlo1.service -> /usr/lib/systemd/system/wpa_supplicant@.service
/etc/systemd//system/printer.target.wants/:
total 0
lrwxrwxrwx 1 root root 46 Apr 13 2015 org.cups.cupsd.service -> /usr/lib/systemd/system/org.cups.cupsd.service
/etc/systemd//system/sockets.target.wants/:
total 0
lrwxrwxrwx 1 root root 45 Apr 13 2015 org.cups.cupsd.socket -> /usr/lib/systemd/system/org.cups.cupsd.socket
lrwxrwxrwx 1 root root 38 Feb 28 2016 rpcbind.socket -> /usr/lib/systemd/system/rpcbind.socket
lrwxrwxrwx 1 root root 47 Oct 23 2015 systemd-networkd.socket -> /usr/lib/systemd/system/systemd-networkd.socket
/etc/systemd//system/sysinit.target.wants/:
total 0
lrwxrwxrwx 1 root root 49 Apr 11 2015 systemd-timesyncd.service -> /usr/lib/systemd/system/systemd-timesyncd.service
ewaller@turing/home/ewaller %
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Enabled services are just symlinks in the relevant directories, there's nothing stopping you creating these manually using ln.
Edit - Oops, hadn't realised how long I'd had this page open before replying. See ewallers answer above
Last edited by Slithery (2018-11-16 20:10:18)
Offline
I tried out different approaches, but unfortunately, one of them worked.
I tried jasonwryans proposal. The symlink to /dev/null has been successfully created in /etc/systemd/system-preset, but the services do not start
I put a file named 10_mipi.preset in /usr/lib/systemd/system-preset that contained service enabling statements (as described in the systemd.preset docu:
enable ntpd.service
enable wicd.service
The file is created correctly, but the services do not start.
As ewaller and Slithery proposed, I created symbolic links in /etc/systemd/system:
ln -s /usr/lib/systemd/system/ntpd.service /etc/systemd/system/ntpd.service
ln -s /usr/lib/systemd/system/wicd.service /etc/systemd/system/wicd.service
The links are created correctly (I can see them), but the services do not start
Any idea what went wrong?
Offline
OK. It works with ewallers and Slitherys option if the symlinks are created in /etc/systemd/system/multi-user.target.wants.
But why don't the other options work?
Offline
Solved
systemctl preset-all
in the post_install() hook of PKGBUILD did the trick!
To summarize the approach:
I defined a meta package that contains the packages that I want to have installed
The meta package contains a preset policy file that contains the enable statements for the corresponding services (see man page of systemd.preset).
The PKGBUILD of the meta package contains an install statement that installs the preset file in
$pkgdir/usr/lib/systemd/system-preset
The post_install() hook contains the statement
systemctl preset-all
which executes the preset policies (see man page of systemctl) .
With this approach, the enablement of the required services after reboot can already be specified during the installation.
Thanks to all for the very helpful solution proposals!
Last edited by mipi (2018-11-17 15:38:13)
Offline
For anyone arriving this thread wondering how to enable sshd during the chroot phase of the installation process on a headless server, I did so like this:
After setting sshd configuration and uploading my public keys to ~/.ssh/authorized keys, I ran:
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'
It was interesting to learn that systemctl enable does exactly the same thing... You learn something new every day... thanks ewaller!
Offline
Pages: 1