You are not logged in.

#1 2015-05-11 18:38:27

Aegidius
Member
From: Italy
Registered: 2011-06-29
Posts: 288
Website

[Solved] Systemd in user mode not working properly

Hello.

I wrote this Systemd service that I would like to run as normal user.

[Unit]
Description=Google Drive mount
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/google-drive-ocamlfuse -m '/home/egidio/Google Drive'
ExecStop=/usr/bin/fusermount -u '/home/egidio/Google Drive'

[Install]
WantedBy=default.target

I start it and everything seems fine, but when I try to access the mounted point, I get this error.

[egidio@egidiolaptop user]$ ls -la ~/Google\ Drive 
ls: cannot access /home/egidio/Google Drive: Transport endpoint is not connected

If I run the ExecStart command manually everything works perfectly.

Can you please help me?

Last edited by Aegidius (2015-05-13 18:17:12)

Offline

#2 2015-05-11 19:11:44

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Systemd in user mode not working properly

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2015-05-11 20:34:05

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,803

Re: [Solved] Systemd in user mode not working properly

How (specifically) did you enable the service?
Is there any interesting information left in the journal after it tries to start?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2015-05-11 20:47:16

Aegidius
Member
From: Italy
Registered: 2011-06-29
Posts: 288
Website

Re: [Solved] Systemd in user mode not working properly

I enabled it with

systemctl --user enable googledrive.service

Well, in journalct I can see these lines, but it's starts correctly executing /usr/bin/google-drive-ocamlfuse -m '/home/egidio/Google Drive' directly.

May 11 22:39:19 egidiolaptop systemd[756]: Started Google Drive mount.
May 11 22:39:19 egidiolaptop systemd[756]: Starting Google Drive mount...
May 11 22:39:19 egidiolaptop fusermount[17879]: /usr/bin/fusermount: failed to 
May 11 22:39:19 egidiolaptop systemd[756]: googledrive.service: control process
May 11 22:39:19 egidiolaptop systemd[756]: Unit googledrive.service entered fai
May 11 22:39:19 egidiolaptop systemd[756]: googledrive.service failed.

Offline

#5 2015-05-12 00:11:34

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,803

Re: [Solved] Systemd in user mode not working properly

Okay, there are clues in there, but journalctl truncated the output -- fusermount failed to do something sad   there is a journalctl switch that tells it not to truncate lines, but I am not in front of a linux machine right now, and I don't recall the exact incantation.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#6 2015-05-12 11:52:03

snakeroot
Member
Registered: 2012-10-06
Posts: 164

Re: [Solved] Systemd in user mode not working properly

I think the truncation is a function of the pager rather than journalctl, so maybe run it with -a and --no-pager?

Here are

See the entry for "--no-full, --full, -l" in man journalctl for more details.

Regards,

Offline

#7 2015-05-12 18:58:05

Aegidius
Member
From: Italy
Registered: 2011-06-29
Posts: 288
Website

Re: [Solved] Systemd in user mode not working properly

This is the output of journalctl --all

May 12 20:55:04 egidiolaptop /usr/lib/gdm/gdm-x-session[19552]: Activating service name='org.gnome.Terminal'
May 12 20:55:04 egidiolaptop /usr/lib/gdm/gdm-x-session[19552]: Successfully activated service 'org.gnome.Terminal'
May 12 20:55:26 egidiolaptop gnome-session[19563]: 1431456926458        addons.update-checker   WARN    Update manifest for {972ce4c6-7e08-4474-a285-3208198ce6fd} did not contain an updates property
May 12 20:56:03 egidiolaptop systemd[19544]: [/home/egidio/.config/systemd/user/googledrive.service:2] Unknown lvalue 'Type' in section 'Unit'
May 12 20:56:03 egidiolaptop systemd[19544]: Cannot add dependency job for unit network-online.target, ignoring: Unit network-online.target failed to load: No such file or directory.
May 12 20:56:03 egidiolaptop systemd[19544]: Created slice -.slice.
May 12 20:56:03 egidiolaptop systemd[19544]: Starting -.slice.
May 12 20:56:03 egidiolaptop systemd[19544]: Started Google Drive mount.
May 12 20:56:03 egidiolaptop systemd[19544]: Starting Google Drive mount...
May 12 20:56:03 egidiolaptop fusermount[20547]: /usr/bin/fusermount: failed to unmount /home/egidio/Google Drive: Device or resource busy
May 12 20:56:03 egidiolaptop systemd[19544]: googledrive.service: control process exited, code=exited status=1
May 12 20:56:03 egidiolaptop systemd[19544]: Unit googledrive.service entered failed state.
May 12 20:56:03 egidiolaptop systemd[19544]: googledrive.service failed.

Offline

#8 2015-05-13 18:16:59

Aegidius
Member
From: Italy
Registered: 2011-06-29
Posts: 288
Website

Re: [Solved] Systemd in user mode not working properly

Ian Lee helped my out here. I managed to do it by adding the Type=forking directive.

Offline

#9 2015-05-13 18:47:11

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] Systemd in user mode not working properly

Does it actually fork? Or is it more like a normal mount command that exits after the filesystem has been mounted? In that case Type=oneshot with RemainAfterExit=yes would be more appropriate.

Offline

#10 2015-05-13 19:02:18

Aegidius
Member
From: Italy
Registered: 2011-06-29
Posts: 288
Website

Re: [Solved] Systemd in user mode not working properly

Thank you!

Offline

Board footer

Powered by FluxBB