I recently had to start a systemd process without having a user being logged in. The systemd process was starting, but unfortunately the network was not up and running. The issue was that the wifi was linked to the user. In this case I used ArchLinux (Manjaro)
Here are the steps to start a service fully automatically.
Create a service-file in the location /etc/systemd/system/myService.service
[Unit] Description=myService After=network-online.target Wants=network-online.target AssertFileNotEmpty=/opt/myService/config.json [Service] Type=simple SyslogIdentifier=myService WorkingDirectory=/opt/myService ExecStart=/opt/MyService/myexecutable (or script) RemainAfterExit=true Restart=always Nice=-20 [Install] WantedBy=multi-user.target
Once created enable the service. This will enable the service startup of the system.
sudo systemctl enable myService.service sudo systemctl daemon-reload sudo systemctl restart myService.service
In order to check the logs of your service use the following command:
# Just use the journalctl command, as in: journalctl -u service-name.service # Or, to see only log messages for the current boot: journalctl -u service-name.service -b
Adjust the following script /etc/NetworkManager/system-connections
Change the connection of your linux.
[connection] id=MyHotspot uuid=exxxxxxxx-xxxxxxxxx type=wifi permissions= [wifi] mac-address=00:XX:XX:XX:DF:ED mac-address-blacklist= mode=infrastructure ssid=My SSID [wifi-security] auth-alg=open key-mgmt=wpa-psk psk=MYPASSWORD [ipv4] dns-search= method=auto [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto
Important here is thepermissions=
.In a previous version of the file it was mentioning a few users. So the wifi only came up at login time of the users. With permissions= it starts even without anybody logging in.