Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toshi Search fails in systemd service #722

Open
sempervictus opened this issue Jan 20, 2021 · 4 comments
Open

Toshi Search fails in systemd service #722

sempervictus opened this issue Jan 20, 2021 · 4 comments

Comments

@sempervictus
Copy link

Describe the bug
Commandline invocation of /usr/bin/toshi --config /etc/toshi/config.toml which works from the shell fails in systemd service:

[Unit]
Description=Toshi Search
After=default.target

[Service]
User=toshi
Group=toshi
ExecStart=/usr/bin/toshi --config /etc/toshi/config.toml
Type=simple
Environment=RUST_BACKTRACE=1

[Install]
WantedBy=multi-user.target
Jan 19 23:26:30 unknown systemd[1]: Started Toshi Search.
Jan 19 23:26:30 unknown toshi[197006]: Error: IOError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
Jan 19 23:26:30 unknown systemd[1]: toshi.service: Main process exited, code=exited, status=1/FAILURE
Jan 19 23:26:30 unknown systemd[1]: toshi.service: Failed with result 'exit-code'.

To Reproduce
Steps to reproduce the behavior:

  1. Build release binary
  2. Write config and place in path shown above
  3. Create the data path and set appropriate ownership
  4. Create systemd service as shown
  5. Run CLI invocation, then run service
  6. Observe failure and logs

Expected behavior
Same behavior in systemd service context as in shell

Desktop (please complete the following information):

  • OS: Arch
  • Rust Version: Stable (Arch Linux upstream)
  • Version: current master
@hntd187
Copy link
Member

hntd187 commented Jan 20, 2021

This may be a dumb question, but does the process have the permissions to access where the config says to store it's data? It's by default a relative path like data/ so maybe an absolute path would work better?

@sempervictus
Copy link
Author

Yeah, the config file says /var/lib/toshi/data with /var/lib/toshi owned by toshi:toshi

@hntd187
Copy link
Member

hntd187 commented Jan 20, 2021

I can't reproduce this, granted I don't have access to arch linux, I only have WSL2 right now to test on (which getting systemd to work was a nightmare by itself)

systemctl status toshi.service
● toshi.service - Toshi Search
     Loaded: loaded (/etc/systemd/system/toshi.service; disabled; vendor preset: enabled)
     Active: activating (start) since Wed 2021-01-20 12:52:54 EST; 5s ago
   Main PID: 2810 (toshi)
      Tasks: 50 (limit: 30664)
     Memory: 18.2M
     CGroup: /system.slice/toshi.service
             └─2810 /mnt/c/Users/shcar/IdeaProjects/Toshi/target/debug/toshi --config /mnt/c/Users/shcar/IdeaProjects/Toshi/config/config.toml

Jan 20 12:52:54 DESKTOP-LFHMLDH systemd[1]: Starting Toshi Search...
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]: Jan 20 12:52:54.512 INFO Indexes: [], toshi: debug
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]:   ______         __   _   ____                 __
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]:  /_  __/__  ___ / /  (_) / __/__ ___ _________/ /
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]:   / / / _ \(_-</ _ \/ / _\ \/ -_) _ `/ __/ __/ _ \
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]:  /_/  \___/___/_//_/_/ /___/\__/\_,_/_/  \__/_//_/
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]:  Such Relevance, Much Index, Many Search, Wow
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]:
Jan 20 12:52:54 DESKTOP-LFHMLDH toshi[2810]: Jan 20 12:52:54.517 INFO Toshi running on 127.0.0.1:8080, toshi: debug

I created a very simple setup

[Unit]
Description=Toshi Search
After=basic.target

[Service]
ExecStart=/mnt/c/Users/shcar/IdeaProjects/Toshi/target/debug/toshi --config /mnt/c/Users/shcar/IdeaProjects/Toshi/config/config.toml
Type=notify
Environment=RUST_BACKTRACE=1

[Install]
WantedBy=multi-user.target

So I'm not sure what is happening here, but it doesn't seem related to toshi itself. Maybe turning logging to debug will shed some more light?

@Alward-Sensai
Copy link

Alward-Sensai commented Sep 19, 2022

Same issue here, installing in a debian docker.

This solved the problem:

#ln -s /home/03d46f9/Toshi/config /config

It looks like is not obeying --config command and searches for default value in current directory "/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants