One mistake you did was trying to start sshd by hand.
If you instead start sshd through official means it should just work. The service command knows what the correct way to start a service on your distribution is, and this should work:
service ssh start
In case of sysv init scripts, that's everything you need to do. The reason the directory is missing is ...
One of the major difference is,
After only checks if the unit is activated already, and does not explicitly activate the specified units.
The units listed in Requires are activated together with the unit. If any of the required units fail to start, the unit is not activated.
Consider I have a unit file test-app.service,
So /run (and /var/run symlinked to it) gets recreated every reboot. Except that systemd-tmpfiles isn't doing that for some files including (/var)/run/sshd.
Apparently, this is fixed by a OpenVZ kernel upgrade. But to actually fix it now you edit /usr/lib/tmpfiles.d/sshd.conf and remove /var from the line d /var/run/sshd 0755 root root to read instead:
Apparently, /dev/log was missing, which is created by systemd-journald-dev-log.socket. I had to do systemctl restart systemd-journald.service to fix it.
I can't reboot right now to test if this is permanent, but I'll take it for now.
To use an actual NTP implementation, you need to install and configure one, chrony or maybe ntpd. Do so if you require any monitoring of time performance. I will assume chrony.
Add iburst to your pool or server lines in your config to speed up the initial few packets. It still may take a couple minutes to stabilize, be patient.
chronyc tracking will show ...
It may be better to not configure system services to listen on specific IP addresses, and to control access to them via the host firewall if necessary.
If you really need to be able to bind to specific IP addresses before they are configured on a network interface, you can work around the timing issue by setting the sysctl net.ipv4.ip_nonlocal_bind for IPv4 ...
Probably because you haven't told cron to use root.
* * * * * root /bin/systemctl stop nginx
That will execute the command every minute, regardless of the nginx status (started or not)
So that being said, if the goal is to make sure nginx is never started, why not just disable it?
systemctl disable nginx
Good point made by Aaron Copley in the ...
Details of the naming scheme are in the source code: udev/udev-builtin-net_id.c. Some common schemes are PCI physical, PCI hotplug, and onboard. Your enp interface suggests physical.
Stripping out exotic and irrelevant bits from the comments leaves these rules:
* Two character prefixes based on the type of interface:
* en — Ethernet
* Type of ...
This behaviour is reported on this Debian Bug, you only need to setup correctly the shutdown scripts shiped with the package because, automatically, they aren't copied by default:
cp /usr/share/doc/openssh-client/examples/ssh-session-cleanup.service /etc/systemd/system/
systemctl enable ssh-session-cleanup.service
Some years later and with systemd 232 it dosn't work anymore as described in the question and in the answers from 2016. Option name StartLimitIntervalSec and Sections have changed. Now it has to look like this example:
This will do 5 restarts in ...
Apparently this gets resolved when running an OpenVZ kernel 2.6.32-042stab134.7 or newer. I find it strange that there is no fix possible in the systemd start scripts somehow. Probably an ugly hack like automatically creating /run/sshd/ after starting up and then starting sshd would work.
The output of my systemd-tmpfiles --create:
You're not meant to edit the systemd service files shipped with packages. These can be replaced at any time, e.g. when the package is updated.
Instead, you should create override files containing the changes you want to make. These will be preserved because they are not part of the system package which gets updated.
The simple way to do this is to run ...
Without installing any more packages...
Turn NTP off, manually set the time to be close enough, turn NTP back on:
Set NTP Service inactive
$ timedatectl set-ntp false
Set the time manually
Yeah, that's sad but it works and you don't need to muck around installing anything and make it work. Get the approximate LOCAL time from the wall clock, your phone, ...
systemd-tmpfiles is a systemd's feature that can be configured to clean old files from a directory automatically. Instead of a new service that requires startup every time a directory cleanup is needed, one could create a file under /etc/tmpfiles.d/ with the following content:
d /path/to/dir - - - 7d
In the /etc/fstab entries for your mounts you can add systemd specific options, including the nofail option will instruct systemd that the boot can continue without waiting for the mount unit and regardless whether the mount point can be mounted successfully.
You can add the options x-systemd.device-timeout and or x-systemd.mount-timeout to customize time-...
As I cannot add a comment due to lack of reputation, please take this as a comment to Michael Hampston's answer.
When modifying the systemd service file, use the command systemctl edit redis-server to create an override. In the resulting edit window, type the following:
Save and exit then finish the installation apt install -f.
I ran into this as well. journalctl showed user data stuff running after multi-user and before the target cloud-init was reached.
<timestamp> <ip_addr> systemd: Reached target Multi-User System.
<timestamp> <ip_addr> systemd: Starting Execute ...
A systemd timer can be scheduled for an interval respective to system boot/start time with the OnActiveSec=, OnBootSec=, OnStartupSec=, OnUnitActiveSec= options
Description=Run Something every hour respective to systemd start time
First, your systemctl syntax is wrong: systemctl kill expects a unit name, not a PID, and -s requires a signal name. As written, it won't do anything but give you an error message:
Failed to parse signal string kill.
If you fix that, it will then tell you:
Failed to kill unit 3645.service: Unit 3645.service not loaded.
The correct syntax would be:
I've finally found it! It's of course but a simple kernel parameter, found here https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
The parameter I was specifically looking for is rootdelay, I had already tried rootwait but apparently that wasn't enough, as it still aborted the wait after 10 seconds. Now it actually does not wait the ...
The unit file you posted looks fine. But the unit as you defined it here has no strict dependencies, only weak (Wants= instead of Requires=). That means if network.target is not there or if it fails to start, this unit would be started anyway. After= (and Before=) is used only for ordering, not for dependency management. So if your app needs another service, ...
If you're using NetworkManager, then in order for network-online.target to work as expected, you need to enable service NetworkManager-wait-online.service, which is the one that actually waits for the network to be online to satisy that target.
The network-online.target needs to be "hooked" into your network manager (since NetworkManager is not the only ...
This is a bug in systemd. I have filed a bug report and done analysis of what is wrong here: https://github.com/systemd/systemd/issues/11338
That issue manifests here as the target gains a Wants= on the unit that Requires= a masked unit. The transaction is built and systemd has already added a job for the anchor unit, its Wants= dependency, and does not ...
The logic of it is that Ubuntu has a built in DNS cache, which it checks first when trying to resolve anything.
In this version, by default, NetworkManager is not updating /etc/resolv.conf instead it’s calling application called resolvconf.
service resolvconf disable-updates
update-rc.d resolvconf disable
service resolvconf stop
May not ...
You activate SystemD units permanently with enable:
sudo systemctl enable reboot.timer
Note: start only starts them one time, and enable don't start them right away (only at next boot). You can combine both with the --now option:
sudo systemctl enable --now reboot.timer
will permanently activate the unit and starts it immediately.