2

My operating system is Ubuntu Bionic beaver.

I have written a systemd serivce unit:

/etc/systemd/user# ll
total 20
drwxrw-r-x 2 rock64 rock64 4096 Nov 23 15:06 ./
drwxr-xr-x 5 root   root   4096 Nov 20 07:21 ../
-rw-r--r-- 1 rock64 rock64   74 Nov 23 14:30 photon_uploader.env
-rwxr-xr-x 1 rock64 rock64  463 Nov 23 14:50 photon_uploader.service*
-rw-r--r-- 1 rock64 rock64  175 Nov 23 14:57 photon_uploader.socket

but if I try enabling it I get error:

 systemctl enable photon_uploader
Failed to enable unit: Unit file photon_uploader.service does not exist.

I couldnt think of where to systematically put the service file , so I put it under user folder, and since I install service from a remote location , I rsync, and I have given the user folder ownership to non-root user. I

4

1 Answer 1

1

For my userspace systemd service, I put my files in $HOME/.config/systemd/user. Then, I ran systemctl enable --user my_service.

8
  • well I created a symlink of photon_uploader.service in /etc/systemd/system from /etc/systemd/user/photon_uploader.service then I did systemctl daemon-reload and enabled it, and started it worked. But when I disabled it and try to reenable it, I again got error, service not found, so I had to manually create the symlink again. Nov 23, 2019 at 17:44
  • If you move your files to the directory I posted, you won't need to use symlinks. Nov 23, 2019 at 18:05
  • gives me permission denied error while trying to rsync Nov 23, 2019 at 18:10
  • Run mkdir -p $HOME/.config/systemd/user; mv /etc/systemd/user/* $HOME/.config/systemd/user, then systemctl enable --user photon_uploader. Nov 23, 2019 at 18:13
  • didnt worked . the systemd fodler in $HOME/.config didnt existed so I created it. but I got error Failed to enable unit: Unit file photon_uploader.service does not exist. Nov 23, 2019 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .