Hi there! 👋
I’m currently setting up this instance, and so I decided to document some of the interesting things I encountered along the way :)
You can consider it a technical blog.
I decided to install Lemmy from scratch instead of using Docker or Ansible, and also use Arch instead of good old Debian because some of the software required to use Lemmy is too old in Debian’s repos. The documentation is quite solid, so compiling and setting up both backend and frontend was surprisingly easy - just install a few dependencies, run cargo build
here and pnpm build:prod
there, create some systemd services - and we are up and running!
Well, almost up and running.
Images are not loading, and the logs are occupied by those two bad boys:
Required command ffprobe not found, make sure it exists in pict-rs' $PATH
Required command exiftool not found, make sure it exists in pict-rs' $PATH
Well, how hard could it be to fix? Let’s install ffmpeg
(which contains ffprobe
) and exiftool
.
After typing both commands in the terminal to make sure everything was installed correctly, I restarted Lemmy.
To my surprise, while ffprobe
error disappeared, Lemmy still complained about missing exiftool
🤔
This was quite puzzling - I can invoke the command, but Lemmy (running under the same user as me) can’t find it.
Thankfully, the error is actually quite helpful as it talks about $PATH!
Lets check where is exiftool
installed
$ which exiftool
/usr/bin/vendor_perl/exiftool
and what is our path
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin
Now let’s use ps aux
to find the Lemmy’s process (which was 432 in my case), and check what PATH does it have
$ cat /proc/432/environ --show-nonprinting
LANG=en_US.UTF-8^@PATH=/usr/local/sbin:/usr/local/bin:/usr/bin^@USER=lemmy
And here is our problem! There is no /usr/bin/vendor_perl
in the PATH, and so Lemmy does not know to look for exiftool
there.
I’m not sure what is the best way to fix this, and also I’m quite lazy, so I just copied my path and set it as a configuration option in Lemmy’s service file:
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin
After asking systemd to reload the configuration and then restart Lemmy - the exiftool
problem was fixed as well.
Hopefully somebody will find this useful or at least interesting :D
Next thing, I’ll need to figure out why Lemmy does not work after a reboot, and requires a manual restart…
EDIT 1:
Quick debugging session has lead me to this line in src/lib.rs
let pool = build_db_pool().await?;
Not sure what exactly is wrong there, but Lemmy gets stuck somewhere inside this function.
I’ve fixed this simply by adding the following to the Lemmy’s service file:
After=postgresql.service
Next thing, I’ll try to configure a Tor hidden service for the instance :)
<3