Boot hangs: A start job is running - systemd

In a virtual box I have a Debian that I sometimes want to run without X. So I edited /etc/grub.d/10_linux and added another menu item with a kernel option "nox" appended. Then I added a line to /lib/systemd/system/lightdm.service, Section [Unit]:
ConditionKernelCommandLine=!nox
However, when starting this, it hangs with the message:
A start job is running for Hold until boot process finishes up (56min / no limit)
Thank you, systemd for informing me about that. I wouldn't have noticed. Yet, I would like to know, which job it is that's hanging.
The system allows me to connect via SSH, but none of the systemctl or journalctl commands I tried did tell me the name of the service causing the problem. lightdm.service itself seems to be satisfied.

I known it's a but late, but I just found out that one can use:
systemctl list-jobs
to find out what units are waiting or running at any given moment.
By adding systemd.debug-shell=1 to the kernel command line, a root shell will be available on TTY9 (crlt+alt+F9) to run the command above.
I first tried "systemd-analyze", and that gave me the message about "systemctl list-jobs".
hope this helps someone with similar problems.

Related

systemd - How can you find out whether the service was started on booting or by "systemctl restart ..."?

I wrote a service that has to behave differently, depending on whether it is started after a boot or by the command "systemctl restart ...".
Can I find out that in the daemon itself? Or alternatively set an environment variable in the "daemon.service" file for the daemon?
At the moment I don't see how this can be decided e.g. from the environment.
Thanks in advance,
Poldi
Sorry,
stupid question. I just have to write a temporary file to a ram disk ;-)

VM not restarting automatically when installed with kickstart with --noautoconsole option

I created a Centos 7.3 VM using kickstart using the following command:
virt-install --name=vm1 --disk path=vm1.img,size=20 --vcpus=2 --ram=10240 --os-type=linux --os-variant=rhel7.0 --network bridge=br0 --graphics none --location=http://<IP>/centos7.3 -x "ks=http://<IP>/centos73vm-ks.cfg append ip=<VM IP> netmask=255.255.252.0 gateway=<gw> bootproto=static console=ttyS0"
This works fine. VM is created, rebooted automatically and the node is usable. However, the problem with this is that I cannot use it to automate since I don't get the control back. To do that, I added the --noautoconsole options of the virt-install command at the end of the above command.
After doing so, VM is installed, but after reboot it does not come up automatically. It remains in shut off state. I need to start it manually. There are no errors on logging to the console. May someone give any leads on how to fix this?
Any help would be greatly appreciated. Thanks in advance.
you need to add --wait=-1 so that virt-install waits for the installation to complete before exiting. The vm will then automatically start when the installation completes.
this sure sounds like an issue that was covered on the RedHat customer portal. I'm not sure if that requires a paid license but your company (or you) might have one already?
-- Jonas

What are the systemd dependencies of ntpd?

My ntptime is showing error code 5 when the system starts. Restarting the ntpd through systemctl fixes this. Waiting a few minutes also seems to fix this. I have verified that ntpq shows that ntpd is talking to my intended server. This may be caused by another issue, but I think I'll take this time to ask a more general-purpose question.
Does anybody know which systemd dependencies are required for ntpd to work? I would love to see a minimum working example ntpd.service file from a system whose ntptime shows great success on system start.
Check your dependencies of a systemd unit with:
systemctl list-dependencies ntp
That command was found by reviewing man systemctl.

Starting a application with graphical interface on boot

I have a small question that I havn't found any answers to.
I run a virtual machine on my CentOS server, and I have made a simple script to start the virtual machine. I would like to run the script on boot so that the virtual machine starts up on boot also. So I successfully registered the script with following
chkconfig --add myscript
and enabled it with following
chkconfig --level 2345 myscript on
at last I checked it so its registered and enabled correctly with
$ chkconfig --list | grep myscript
So long, so fine, but when I restart my machine to test it, well nothing happens.
So now I wonder why isn't my script running? I had some thaughts that it cold be because of some missing arguments, myscript requires an argument "start" to run properly, so I think that could be the cause why it's not running, in that case where should I add the argument?
Note also, my script is ok, or at least I can run it manually.
UPDATE
The script is run during boot and is working as it should. Tha application I try to start with a script, my virtal machine, has a graphical interface and it seems like it's that causing the trouble. Does anyone have any experience in starting a graphical application with script on boot, on unix based OS's ofcourse? Or if there are any other clever ways of achieve this?
Thanks!
Make sure that the proper symlinks get created in /etc/rc.?/ and your startup script in /etc/init.d/ should contain start and stop methods.

Apache 2 - reload config on Windows

I have a PHP script that modifies my httpd.conf file, so I need to automatically reload it in Apache.
On Linux, there is graceful restart, but on Windows (I use the restart command) it terminates all the current connections. Is there a command as graceful restart on Windows? Is there a workaround on this?
Yes, you should use the -k switch.
httpd.exe -k restart or apache.exe -k restart
More info here has well. http://www.zrinity.com/developers/apache/usage.cfm
Edit:
It shouldn't that is the point of Graceful. Notice I used the -k. That is not the same as a normal restart. It let's the current sessions complete their task while the config is being reread, so that it will start taking new requests immediately.
From the documentation:
The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.
http://httpd.apache.org/docs/2.2/stopping.html#graceful
It's doing what you are asking for.
Edit 2:
Adding this link and gave both possible versions because some people think you there is only one specific way to do something instead of search themselves.
http://httpd.apache.org/docs/2.4/platform/windows.html#wincons
I think I'm just going to delete this answer because either people can't read or if it doesn't work for someone it gets a DV. There are different windows versions made by different developers. If it doesn't work look for the answer from them. Even Linux has different commands depending on the distro. geez
In the newest Apache 2.4.20 VC10 the "httpd -k restart" command actually DOES do a graceful restart. It won't drop any connections, for example if somebody is downloading something from your server, it WILL NOT interrupt this process. One more proof is that "-k restart" will not reset your server statistics that mod_status provides, won't even alter the "Restart Time" value.
Although "httpd -k graceful" and "httpd -k graceful-stop" commands are available in Windows, but they will not work giving an error "couldn't make a socket".

Resources