Bug 986344 - Service file installs fine but after reboot it errors out with "Cannot add dependency job for unit"
Service file installs fine but after reboot it errors out with "Cannot add de...
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-19 09:23 EDT by Nelson Benitez
Modified: 2014-06-19 15:07 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-19 15:07:34 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nelson Benitez 2013-07-19 09:23:09 EDT
My Custom service file, located in /home/nelson/mytest.service , is as follows:

>[Unit]
>Description=Test of service file
>After=network.target
>
>[Service]
>ExecStart=/bin/bash -c "/bin/df > /etc/df_kitar.txt"
>
>[Install]
>WantedBy=multi-user.target

I installed it fine by this command:

>systemctl enable /home/nelson/mytest.service

And I checked is well installed this way:

>[root@fedora19 invitado]# systemctl status mytest.service
>mytest.service - Test of service file
>   Loaded: loaded (/home/nelson/mytest.service; enabled)
>   Active: inactive (dead)
>
>[root@fedora19 invitado]# systemctl list-unit-files | grep mytest
>mytest.service                             enabled 


It even runs fine, as we see here:

>[root@fedora19 invitado]# systemctl start mytest4.service
>[root@fedora19 invitado]# cat /etc/df_kitar.txt 
>S.ficheros     1K-blocks   Usados Disponibles Uso% Montado en
>/dev/sda2       20511356  3982616    15480164  21% /
>devtmpfs          501832        0      501832   0% /dev
>tmpfs             509576      148      509428   1% /dev/shm
>tmpfs             509576      828      508748   1% /run
>tmpfs             509576        0      509576   0% /sys/fs/cgroup
>tmpfs             509576       24      509552   1% /tmp
>/dev/sda3       24766080 15389768     8111612  66% /home

But, after a reboot, the service fails to execute, with following error text:

jul 19 14:10:39 fedora19 systemd[1]: Cannot add dependency job for unit mytest.service, ignoring: Unit mytest.service failed to load: No such file or directory. See system logs and 'systemctl status mytest.service' for details.


I presume the bug here may be based that the service file(/home/nelson/mytest.service) resides in another partition different that of / , because I have /home on a different partition, but it executed well when first installed and the symlinks seem well too:

>[root@fedora19 invitado]# ls -l /etc/systemd/system/mytest.service
>lrwxrwxrwx. 1 root root 28 jul 19 13:30 /etc/systemd/system/mytest.service -> /home/nelson/mytest.service
>[root@fedora19 invitado]# ls -l /etc/systemd/system/multi-user.target.wants/mytest.service 
>lrwxrwxrwx. 1 root root 28 jul 19 13:30 /etc/systemd/system/multi-user.target.wants/mytest.service -> /home/nelson/mytest.service

I tried to grep the systemd source code to locate the code responsible for the error message:

>[nelson@fedora19 systemd]$ grep -n -r --include=*.c Cannot\ add\ dependency\ job
>src/core/transaction.c:910:                                                         "Cannot add dependency job for unit %s, ignoring: %s",
>src/core/transaction.c:949:                                                      "Cannot add dependency job for unit %s, ignoring: %s",
>src/core/transaction.c:961:                                                      "Cannot add dependency job for unit %s, ignoring: %s",
>src/core/transaction.c:984:                                                      "Cannot add dependency job for unit %s, ignoring: %s",
>src/core/transaction.c:1007:                                                         "Cannot add dependency job for unit %s, ignoring: %s",

But there are 5 code paths(as seen above) which print the exact error message so I can't distinguish which one is the one I'm hitting..

Thanks for any help,
Comment 1 Michal Schmidt 2013-07-19 09:26:29 EDT
(In reply to Nelson Benitez from comment #0)
> I presume the bug here may be based that the service
> file(/home/nelson/mytest.service) resides in another partition different
> that of / , because I have /home on a different partition, but it executed
> well when first installed and the symlinks seem well too:

That's my suspicion too. Does it work if you store your unit file as /etc/systemd/system/mytest.service directly, without it being a symlink?
Comment 2 Nelson Benitez 2013-07-19 09:51:21 EDT
Ye(In reply to Michal Schmidt from comment #1)
> (In reply to Nelson Benitez from comment #0)
> > I presume the bug here may be based that the service
> > file(/home/nelson/mytest.service) resides in another partition different
> > that of / , because I have /home on a different partition, but it executed
> > well when first installed and the symlinks seem well too:
> 
> That's my suspicion too. Does it work if you store your unit file as
> /etc/systemd/system/mytest.service directly, without it being a symlink?

Yes, that way it works fine.
Comment 3 Lennart Poettering 2014-06-19 15:07:34 EDT
Unit files have to reside on the root disk, otherwise we will not find them this early in the boot process. Sorry. This is simply unsupported.

Note You need to log in before you can comment on or make changes to this bug.