Systemd: unknown lvalue 'User' in section 'Unit' - systemd

A couple weeks a go I moved from Ubuntu 14.04 to 16.04 and found my Upstart script no longer worked, so feeling adventurous I managed to create a Systemd script that worked instead.
But I'm having a couple issues still.
[/etc/systemd/system/ss13_server.service:3] Unknown lvalue 'User' in section 'Unit'
This is my Systemd Script:
[Unit]
Description=ss13_server
User=ss13
[Service]
WorkingDirectory=/home/ss13/ss13
ExecStart=/usr/local/byond/bin/DreamDaemon /home/ss13/ss13/baystation12.dmb 25565 -trusted
Restart=on-failure
RestartSec=90s
It is meant to run the command
/usr/local/byond/bin/DreamDaemon /home/ss13/ss13/baystation12.dmb 25565 -trusted
within /home/ss13/ss13 as the user ss13
and then rerun that command if the process dies.
As far as I can tell it does that pretty well, except for the error [/etc/systemd/system/ss13_server.service:3] Unknown lvalue 'User' in section 'Unit'
Which leads me to suspect it is not running as the correct user.
I used a website that shows the commands from upstart and the alternatives for systemd and the correct area they go into.
Anyway, any help is useful,
Thanks!

User should be in section [Service].

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 ;-)

Boot hangs: A start job is running

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.

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.

ec2 upstart, what is the `start on` command to wait for network

Firstly this is a double post with serverfault, Please advise what is better site for this type of question.
This is my first time with upstart. I can not get the following script to launch when waiting for the network to initiate. It will work if using standard
start on runlevel [2345]
stop on runlevel [!2345]
I have also tried various combinations of
start on filesystem and net-device-up IFACE=eth0
start on filesystem and net-device-up IFACE!=lo
Any suggestions would be grateful
description "test for on network start"
start on (started network-interface
or started network-manager
or started networking)
stop on (stopping network-interface
or stopping network-manager
or stopping networking)
script
touch /home/ec2-user/myFile.txt
end script
the event that signifies that the network is completely configured is static-network-up. You will most likely also need the file system event for any service that uses /home, /var, and /usr.

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.

Resources