You are not logged in.

#1 2019-06-07 15:37:29

zawz
Member
Registered: 2019-06-07
Posts: 9

Custom systemd services discarded after reboot

At some point systemd decided to discard newly created custom services, systemd just answers "Unit foo.service could not be found.".
Enabling it or doing a daemon-reload makes it visible to systemd again; however since this happens at every reboot, I have no way to make any new service start automatically.
This started happening out of nowhere, I know for sure it used to work, and it even still works with any service created before the bug started happening, but any new service will be subject to this.

Here's an example of a service subject to this

[Unit]
Description=Fan curve daemon for AMD gpus
ConditionPathExists=/etc/zoc/zfanc

[Service]
Type=simple
ExecStart=/etc/zoc/zfanc start
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

I don't know much about systemd so I have absolutely no clue if this is a misconfig or something. I've tried to search for this but only ended up more confused

Last edited by zawz (2019-06-07 15:39:19)

Offline

#2 2019-06-07 15:46:40

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

Welcome to the arch linux forums zawz.  Where is the service file located.

zawz wrote:

systemd just answers "Unit foo.service could not be found.".

What command produces this output?
What is the journal contents for a boot with the issue?  Also the output of pacman -Q systemd.

Offline

#3 2019-06-07 16:04:53

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

Files are in /etc/systemd/system
Any command regarding the service in question will cause the unit not found error ("systemctl start/status/stop/restart foo")
Output of "pacman -Q systemd":

systemd 242.29-1

As for the journal, I didn't find any single mention of any of the subject services

Last edited by zawz (2019-06-07 16:05:17)

Offline

#4 2019-06-07 16:08:37

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

What about if you boot with the option systemd.log_level=debug ?

Offline

#5 2019-06-07 16:23:57

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

Jun 07 18:16:33 WCG systemd[1]: zfanc.service: Collecting.

Nothing else

Offline

#6 2019-06-07 16:44:28

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: Custom systemd services discarded after reboot

Dumb question just cause I'm curious, where is zfanc putting what it's collecting?

Offline

#7 2019-06-07 16:57:48

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

Is there a link in /etc/systemd/system/multi-user.target.wants/ for zfanc.service
What is the output of systemd enable zfanc.service ? (is a link present after executing the command?)

Offline

#8 2019-06-07 16:57:52

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

Zod wrote:

Dumb question just cause I'm curious, where is zfanc putting what it's collecting?

This is a systemd operation, zfanc hasn't done anything here

Last edited by zawz (2019-06-07 17:00:33)

Offline

#9 2019-06-07 17:00:15

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

And yes there is a link, enabling the service doesn't provide any output because the link is already present; if i delete the link and re-enable it, it will say it creates the link as it should

Created symlink /etc/systemd/system/multi-user.target.wants/zfanc.service → /home/zawz/code/sh/zoc/zfanc.service.

But this doesn't yield any different result, the service is still ignored at boot until either daemons are reloaded or the service is manually enabled.

Last edited by zawz (2019-06-07 17:01:20)

Offline

#10 2019-06-07 17:24:21

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

Is /home/zawz/code/sh/zoc/zfanc.service available at boot?
If you move the service file to /etc/systemd/system then update the symlink does that work?

Offline

#11 2019-06-07 17:34:29

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

loqs wrote:

Is /home/zawz/code/sh/zoc/zfanc.service available at boot?
If you move the service file to /etc/systemd/system then update the symlink does that work?

I have tested and no this doesn't give any different outcome

Last edited by zawz (2019-06-07 17:36:14)

Offline

#12 2019-06-07 18:13:55

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

Please post the output of journalctl -b from a boot with the option systemd.log_level=debug.

Offline

#13 2019-06-07 18:30:55

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

Where can i put it? I can't find any site that will accept this 2MB log

Offline

#14 2019-06-07 19:03:05

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

I forgot how verbose debug level is reducing the log level by one should greatly reduce the size,
journalctl -p6 -b -# (where # is the number of the boot of interest  (the one systemd.log_level=debug) 0 for the current boot, -1 for the last boot e.t.c)

Offline

#15 2019-06-07 19:10:15

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

Offline

#16 2019-06-07 19:58:18

loqs
Member
Registered: 2014-03-06
Posts: 19,101

Re: Custom systemd services discarded after reboot

cat /etc/systemd/system/trivial.service
[Unit]
Description=A test service
           
[Service]
Type=simple
ExecStart=/usr/bin/true
RemainAfterExit=true
           
[Install]
WantedBy=multi-user.target
stat /etc/systemd/system/trivial.service 
  File: /etc/systemd/system/trivial.service
  Size: 162       	Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d	Inode: 9568836     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)

Does the above service file work on your system?

Offline

#17 2019-06-09 16:41:00

zawz
Member
Registered: 2019-06-07
Posts: 9

Re: Custom systemd services discarded after reboot

I managed to solve the problem. Turns out it was that it really was that the service file was not available at boot, but when I tested copying putting the file instead of linking, I didn't realize that when enabling the service the link in multi-user.target.wants was still linking to the old file and was not refreshed to the new file.
So deleting and recreating this link making sure it linked to the local file solved the issue

Thanks for the help

Offline

Board footer

Powered by FluxBB