Toshi
Toshi copied to clipboard
Toshi Search fails in systemd service
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:
- Build release binary
- Write config and place in path shown above
- Create the data path and set appropriate ownership
- Create systemd service as shown
- Run CLI invocation, then run service
- 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
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?
Yeah, the config file says /var/lib/toshi/data
with /var/lib/toshi
owned by toshi:toshi
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?
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 "/"