Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems trying to enable/start custom target in systemd

i create a target file to group all my personal services in my fedora 18, i tested the services and i can start then individually, but if i try to enable the target i got a error message!

[root@ghostrider system]# systemctl enable developer.target
Failed to issue method call: Invalid argument

And here the target code:

###########################################################################
# Target para ativar servicos de desenvolvimento em Java
###########################################################################
#/etc/systemd/system/developer.target

[Unit]
Description=Processes Java
After=default.target

[Install]
Alias=developer.target

I really don't understand what that message means, any clues?

like image 686
LottaLava Avatar asked Dec 06 '13 13:12

LottaLava


People also ask

How do I enable Systemctl service?

Enabling and Disabling Services To tell systemd to start services automatically at boot, you must enable them. To start a service at boot, use the enable command: sudo systemctl enable application . service.

What is a .service file?

The database server requires a Services file, which contains information about the known services on your network. The Services file is typically located in %windir%\System32\drivers\etc\services.

What does Systemctl get default do?

If you have installed your Red Hat Enterprise Linux using the graphical user interface (GUI), you can use systemctl to change to the regular console. To see your current default, run systemctl get-default. To change back to the command-line interface, execute systemctl set-default multi-user.

How do I boot to systemd?

To boot under systemd, select the boot menu entry that you created for the purpose. If you didn't bother to create one, just select the entry for your patched kernel, edit the kernel command line directly in grub and add init=/lib/systemd/systemd. systemd.


2 Answers

You have an Alias with the same name as the unit (developer.target). This caused the same issue for me while writing a service file. It is completely redundant, so just remove it.

like image 164
Anton Eliasson Avatar answered Oct 11 '22 09:10

Anton Eliasson


systemd will create symlink in /etc/systemd/system/xxx.target.wants, if your /etc/systemd/system/xxx.target.wants/xxx.service is not a symlink, systemd can not create symlink, it will throw this error.

please clean your /etc/systemd/system/xxx.target.wants/ dir.

like image 37
jolestar Avatar answered Oct 11 '22 09:10

jolestar