I have a Ubuntu server with multiple telegram bots on autostart. I start/stop/reload them using systemctl as a root.
I needed to install a library for my server and I installed it as a root pip install moviepy
and then I got a warning in the terminal saying that installing libraries using pip is stupid and I should do it in my virtual environment. So I deleted this library from root and installed it in venv. Then got these errors
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM default
but I got rid of it using alsactl restore
After this I started to get an error error: XDG_RUNTIME_DIR not set in the environment
in the journalctl for the bot’s service while trying to restart it. I tried multiple things (when I used $ echo $XDG_RUNTIME_DIR
It returned things correctly but service just wouldn’t see the variable) and then I just added
`if "XDG_RUNTIME_DIR" not in os.environ:
os.environ["XDG_RUNTIME_DIR"] = "/tmp/runtime-root"`
in my main using advice from the Internet. Now I don’t get the error about “XDG_RUNTIME_DIR” but when I try to stop the service it can’t stop and I get the text
`Stopping 'bot_6'...
systemd[1]: 6_bot.service: State 'stop-sigterm' timed out. Killing.
systemd[1]: 6_bot.service: Killing process 12656 (python3) with signal SIGKILL.
systemd[1]: 6_bot.service: 6_bot.service: Killing process 12693 (python3) with signal SIGKILL.
systemd[1]: 6_bot.service: Killing process 12698 (SDLTimer) with signal SIGKILL.
systemd[1]: 6_bot.service: Killing process 12701 (python3) with signal SIGKILL.
systemd[1]: 6_bot.service: Main process exited, code=killed, status=9/KILL
systemd[1]: 6_bot.service: Failed with result 'timeout'.`
I know this situation is probably dumb but i need help