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

Issues encountered while installing on Ubuntu 22.04 #212

Open
ecton opened this issue Jun 12, 2023 · 7 comments
Open

Issues encountered while installing on Ubuntu 22.04 #212

ecton opened this issue Jun 12, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@ecton
Copy link

ecton commented Jun 12, 2023

Issue Summary

These are the problems I encountered trying to follow the guide on join-lemmy.org.

When trying to use docker-compose, I could not get external email delivery working due to the private networking on the main lemmy container. It simply times out when a local address is not used for delivery.

Rather than worry about postfix, I switched to installing from Scratch. Here are the issues I encountered:

  • sudo -iu postgres psql -c "CREATE USER lemmy WITH PASSWORD 'db-passwd';" -- This line is missing SUPERUSER. db-init.sh, which is referenced on the configuration page, creates the user with superuser permissions. Without this, a cryptic error "Couldn't run DB Migrations" is displayed, with no further information about the error encountered. I see there might be work towards removing this requirement, but right now, the guide doesn't work as-written.
  • cargo install lemmy_server --target-dir /usr/bin [...] This doesn't actually place lemmy_server in /usr/bin. It uses /usr/bin as the target directory for cargo when building. I believe --root is what is meant to be used here. For me, lemmy_server ended up in /root/.cargo/bin/.
  • curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash - When finally getting to the yarn install instruction, I learn that at a minimum, Node 14 is required.

I wanted to report these issues I had in hopes that the guide can be improved to help others install Lemmy more easily.

Steps to Reproduce

Try following the guide on a fresh Ubuntu 22.04 server.

@ecton ecton added the bug Something isn't working label Jun 12, 2023
@ctsrc
Copy link

ctsrc commented Jun 12, 2023

This doesn't actually place lemmy_server in /usr/bin. It uses /usr/bin as the target directory for cargo when building. I believe --root is what is meant to be used here.

Correct. I ran into the same problem.

Documentation https://join-lemmy.org/docs/en/administration/from_scratch.html should be changed

The correct command that it should say is

cargo install lemmy_server --root /usr/ --locked --features embed-pictrs

Then we get the final binary in /usr/bin/ as it should be, and we avoid most of the build garbage being put in system dirs.

Although it does seem to still result in .crates.toml and .crates2.json files being placed in /usr/.

@ctsrc
Copy link

ctsrc commented Jun 12, 2023

a cryptic error "Couldn't run DB Migrations" is displayed, with no further information about the error encountered

I see a similar message on my machine, having followed the original guide.

2023-06-12T18:40:45.893739Z  INFO lemmy_db_schema::utils: Running Database migrations (This may take a long time)...
thread 'main' panicked at 'Couldn't run DB Migrations', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/lemmy_db_schema-0.17.3/src/utils.rs:165:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Will try your suggestion about making the db lemmy user a db superuser. But I am questioning if that is really ideal. In my case I am running a separate PostgreSQL server for Lemmy, so for me it is not a big deal. But for people having different databases with different data on one shared PostgreSQL server it does not seem desirable to have the lemmy db user be a db superuser.

@ctsrc
Copy link

ctsrc commented Jun 12, 2023

I changed the lemmy user to a superuser

psql -c "ALTER USER lemmy WITH SUPERUSER;"

but for some reason I still get "Couldn't run DB Migrations", even though my lemmy db user is now a db superuser :S

\du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 lemmy     | Superuser                                                  | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

@ctsrc
Copy link

ctsrc commented Jun 12, 2023

For me the second issue with "Couldn't run DB Migrations" was that one of the migrations https://github.com/LemmyNet/lemmy/blob/25275b79eed0fb1fe90d27c197725f510f9965bb/migrations/2021-09-20-112945_jwt-secret/up.sql need the pgcrypto extension.

On the platform I am running on, FreeBSD 13.2-RELEASE, this required that in addition to having postgresql15-server installed I also needed to have postgresql15-contrib installed.

@Nutomic Nutomic transferred this issue from LemmyNet/lemmy Jun 14, 2023
@retiolus
Copy link
Collaborator

retiolus commented Jun 16, 2023

I get a working installation by following these steps, however, --features embed-pictrs seems to be ignored in my case.

@yaneony
Copy link

yaneony commented Jun 19, 2023

I get a working installation by following these steps, however, --features embed-pictrs seems to be ignored in my case.

Website is down. Possibly theres any backup or other source?!

@retiolus
Copy link
Collaborator

retiolus commented Jun 19, 2023

Website is down. Possibly theres any backup or other source?!

Not down on my end? You can check it here if you still have issues: https://web.archive.org/web/20230619234739/https://retiolus.net/posts/how-to-install-lemmy-from-scratch/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants