jotta / jotta-cli-issues

45 stars 1 forks source link

Jottad systemd service file not created #165

Closed jcookin closed 2 years ago

jcookin commented 2 years ago

Make sure you are running the latest version of jotta-cli before reporting an issue.

jotta-cli release (jotta-cli version): 0.12.50392

Description of problem: Per https://docs.jottacloud.com/en/articles/2932989-jottacloud-cli-and-permissions-on-linux, Installing on debian-based machines (linux mint and Ubuntu specifically) fails to create the systemd file in /etc/systemd/system/jottad.service which is needed to manage the daemon with systemd/systemctl command. I am trying to manage user groups and permissions to allow all files in a particular directory to be read. I am running jotta-cli as the user who's group owns all of the directories (different users own some of the directories however). The System Init (service) file should have been created at install time. Note that jottad is running and producing logs.

After running run_jottad and then running jottad the jottad daemon breaks and run_jottad must be re-run to get functionality back.

upstart and sysvinit files should not be created anymore per the version 0.12 release notes

Expected: jottad service is created and can be managed by systemctl/systemd.

jotta-cli status (jotta-cli status): Nominal

Relevant logs for the issue (~/.jottad/jottabackup.log or /var/lib/jotta/jottabackup.log )

pid:764670 2021/10/31 20:07:31 jottad.init.excludes.patch =>  v2 simpleGlob
pid:764670 2021/10/31 20:07:31 Loading settings from /home/oasis/.jottad/settings.dat
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.downloadrate => 0B/s
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.uploadrate => 0B/s
pid:764670 2021/10/31 20:07:31 jottad.init.user => [617c69566bf8c00134051bc6] on [<dev-name>] @ [0c23cf4a0d5e74868fb865e27e2d9857]
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.scaninterval =>  1h0m0s
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.backupmode => Interval
pid:764670 2021/10/31 20:07:31 jottad.init.done => ok
pid:764670 2021/10/31 20:07:31 jottad.startup
pid:764670 2021/10/31 20:07:31 api.grpc.tls.active => /run/user/1000/jottad/jottad.socket
pid:764670 2021/10/31 20:07:31 jottad.startup.update-userinfo => <user-ID> Jottacloud <id-code>
pid:764670 2021/10/31 20:07:32 jottad.startup.confirm-remote => ok
pid:764670 2021/10/31 20:07:32 jottad.startup => ok
pid:764670 2021/10/31 20:07:32 GET https://repo.jotta.us/archives/VERSION 200
pid:764670 2021/10/31 20:07:32 running 4 delayed startup tasks
pid:764670 2021/10/31 20:09:06 ok stat with 0 got filesystem info id[912332eea8f8c19b] type[ext2/ext3] for path /mnt/data
pid:764670 2021/10/31 20:09:06 Added /mnt/data
pid:764670 2021/10/31 20:09:06 Started scheduler for /mnt/data
pid:764670 2021/10/31 20:09:06 Requested full scan at /mnt/data
pid:764670 2021/10/31 20:09:06 Starting full scan at /mnt/data
pid:764670 2021/10/31 20:09:06 ok stat with 0 got filesystem info id[912332eea8f8c19b] type[ext2/ext3] for path /mnt/data
pid:764670 2021/10/31 20:09:06 Running full scan at /mnt/data [912332eea8f8c19b/912332eea8f8c19b]
pid:764670 2021/10/31 20:09:06 Unable to readdir <data/path/needing/backup>: open <data/path/needing/backup>: permission denied
pid:764670 2021/10/31 20:09:07 remote mkdir -p <data/path>
pid:764670 2021/10/31 20:09:08 remote mkdir -p <data/path>
pid:764670 2021/10/31 20:09:09 remote mkdir -p <data/path>
pid:764670 2021/10/31 20:09:15 remote mkdir -p <data/path>
pid:764670 2021/10/31 20:09:15 Unable to readdir <data/path/needing/backup>: lstat<data/path/needing/backup>: permission denied

Traceback

Additional info: additional logs relevant to jottad daemon conflict with commands (cannot capture newer/more precise logs currently since I want to avoid stopping a current backup in progress):

pid:764476 2021/10/31 20:03:49 jottad.init
pid:764476 2021/10/31 20:03:49 jottad.init.appdata => /home/<user>/.jottad
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/cldb (1635710307|16384)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/db (1635710395|32768)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/downloads
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/downloads/history (1635710307|16384)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/jottabackup.log (1635710629|2739)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/localfiles (1635710307|32768)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/nstore - (0cf386d8419a46b6e87010239e16748c|1635710381|65536)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/obj
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/obj/5b296082 (1635710382|827)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/settings.dat (1635710382|240)
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/uploads
pid:764476 2021/10/31 20:03:49 jottad.appdata   /home/<user>/.jottad/uploads/history (1635710307|16384)
pid:764490 2021/10/31 20:04:00 Starting /usr/bin/jottad version 0.12.50392 as 1000(<user>)/1000 (linux:amd64)
pid:764490 2021/10/31 20:04:00 unix-socket.remove OK [/run/user/1000/jottad/jottad.socket]
pid:764490 2021/10/31 20:04:00 jottad.init
pid:764490 2021/10/31 20:04:00 jottad.init.appdata => /home/<user>/.jottad
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/cldb (1635710307|16384)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/db (1635710395|32768)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/downloads
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/downloads/history (1635710307|16384)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/jottabackup.log (1635710640|4239)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/localfiles (1635710307|32768)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/nstore - (0cf386d8419a46b6e87010239e16748c|1635710381|65536)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/obj
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/obj/5b296082 (1635710382|827)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/settings.dat (1635710382|240)
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/uploads
pid:764490 2021/10/31 20:04:00 jottad.appdata   /home/<user>/.jottad/uploads/history (1635710307|16384)
pid:764670 2021/10/31 20:07:31 Starting /usr/bin/jottad version 0.12.50392 as 1000(<user>)/1000 (linux:amd64)
pid:764670 2021/10/31 20:07:31 unix-socket.remove OK [/run/user/1000/jottad/jottad.socket]
pid:764670 2021/10/31 20:07:31 jottad.init
pid:764670 2021/10/31 20:07:31 jottad.init.appdata => /home/<user>/.jottad
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/cldb (1635710307|16384)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/db (1635710395|32768)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/downloads
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/downloads/history (1635710307|16384)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/jottabackup.log (1635710851|5739)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/localfiles (1635710307|32768)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/nstore - (0cf386d8419a46b6e87010239e16748c|1635710381|65536)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/obj
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/obj/5b296082 (1635710382|827)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/settings.dat (1635710382|240)
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/uploads
pid:764670 2021/10/31 20:07:31 jottad.appdata   /home/<user>/.jottad/uploads/history (1635710307|16384)
pid:764670 2021/10/31 20:07:31 jottad.init.excludes.patch =>  v2 simpleGlob
pid:764670 2021/10/31 20:07:31 Loading settings from /home/<user>/.jottad/settings.dat
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.downloadrate => 0B/s
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.uploadrate => 0B/s
pid:764670 2021/10/31 20:07:31 jottad.init.user => [617c69566bf8c00134051bc6] on [<device-name>] @ [0c23cf4a0d5e74868fb865e27e2d9857]
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.scaninterval =>  1h0m0s
pid:764670 2021/10/31 20:07:31 jottad.init.cfg.backupmode => Interval
pid:764670 2021/10/31 20:07:31 jottad.init.done => ok
pid:764670 2021/10/31 20:07:31 jottad.startup
pid:764670 2021/10/31 20:07:31 api.grpc.tls.active => /run/user/1000/jottad/jottad.socket
pid:764670 2021/10/31 20:07:31 jottad.startup.update-userinfo => <username> Jottacloud <user-id>
pid:764670 2021/10/31 20:07:32 jottad.startup.confirm-remote => ok
pid:764670 2021/10/31 20:07:32 jottad.startup => ok
pid:764670 2021/10/31 20:07:32 GET https://repo.jotta.us/archives/VERSION 200
existemi commented 2 years ago

Hi!

I do not entirely understand what you mean by:

After running run_jottad and then running jottad the jottad daemon breaks and run_jottad must be re-run to get functionality back.

Are you trying to respawn jottad because you did not find any service with systemctl?

With release 0.12, the service is now being created in user-slice and not system-slice. This means there the systemd-unit is written to /usr/lib/systemd/user/jottad.service and not /etc/systemd/system/jottad.service.

When you run run_jottad you can check the status of the systemd unit with systemctl --user status jottad as the user you ran run_jottad with. Please report back if this works for you

jcookin commented 2 years ago

@existemi To your first question

Are you trying to respawn jottad because you did not find any service with systemctl?

I did not actually mean to run this command, I accidentally hit enter when trying out some commands and that is when I noticed the behavior. So no, I was not intentionally trying to respawn the jottad daemon.

With release 0.12, the service is now being created in user-slice and not system-slice. This means there the systemd-unit is written to /usr/lib/systemd/user/jottad.service and not /etc/systemd/system/jottad.service

This is exactly what I was looking for, I am not familiar with user-slice setups like is now being run with v0.12. This will allow me to configure permissions differently, so thank you.

When you run run_jottad you can check the status of the systemd unit with systemctl --user status jottad as the user you ran run_jottad with. Please report back if this works for you

This command works for me and am able to see the service status and logs as expected. I have learned something new today, thank you!

My one recommendation would be to update the posting I originally linked (https://docs.jottacloud.com/en/articles/2932989-jottacloud-cli-and-permissions-on-linux) to align better with the the newest release of the CLI toolkit. Thank you!