this post was submitted on 19 Feb 2024
18 points (84.6% liked)

Lemmy Support

4661 readers
27 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

I'm trying to set up my own Lemmy server with Docker. I think I have everything set up, but I'm getting an error Cannot autolaunch D-Bus without X11 $DISPLAY. This error kind of makes sense, because I'm SSHing into my server and have not forwarded D-Bus connections, so $DISPLAY is undefined. But why does a Lemmy server need a display in the first place? Is this a bug and a display isn't actually needed? If I set $DISPLAY to whatever, will it still run okay?

top 20 comments
sorted by: hot top controversial new old
[–] [email protected] 23 points 9 months ago (1 children)

Sounds like something is incorrect in your setup. Nothing Lemmy does requires x11, dbus, or any display technology.

[–] [email protected] 3 points 9 months ago (1 children)

Thanks. Do you know what I could have done wrong? I've looked through all the config files and there's nothing about a display in them, unless you count lemmy-ui

[–] [email protected] 4 points 9 months ago

No idea. Sorry.

[–] [email protected] 8 points 9 months ago (1 children)

what's your docker-compose.yml look like, and what command are you using to start it?

[–] [email protected] 4 points 9 months ago* (last edited 9 months ago) (1 children)

I'm starting with sudo docker compose up -d and my docker-compose.yml is:

version: "3.7"

x-logging: &default-logging
  driver: "json-file"
  options:
    max-size: "50m"
    max-file: "4"

services:
  proxy:
    container_name: proxy
    image: docker.io/library/nginx
    ports:
      # actual and only port facing any connection from outside
      # Note, change the left number if port 1236 is already in use on your system
      # You could use port 80 if you won't use a reverse proxy
      - "8536:8536"
    volumes:
      - ./nginx_internal.conf:/etc/nginx/nginx.conf:ro,Z
      - ./proxy_params:/etc/nginx/proxy_params:ro,Z
    restart: always
    logging: *default-logging
    depends_on:
      - pictrs
      - lemmy-ui
  lemmy-ui:
    container_name: lemmy-ui
    image: dessalines/lemmy-ui:${LEMMY_VERSION}
    environment:
      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
      - LEMMY_UI_LEMMY_EXTERNAL_HOST=${DOMAIN}
      - LEMMY_UI_HTTPS=true
    volumes:
      - ./volumes/lemmy-ui/extra_themes:/app/extra_themes
    depends_on:
      - lemmy
    restart: always
    logging: *default-logging
  lemmy:
    container_name: lemmy
    image: dessalines/lemmy:${LEMMY_VERSION}
    hostname: lemmy
    restart: always
    logging: *default-logging
    environment:
      - RUST_LOG=warn
    volumes:
      - ./lemmy.hjson:/config/config.hjson:Z
    depends_on:
      - postgres
      - pictrs
  pictrs:
    container_name: pictrs
    image: docker.io/c:0.4.3
    # This needs to match the pictrs url in lemmy.hjson
    hostname: pictrs
    environment:
      - PICTRS__MEDIA__EXTERNAL_VALIDATION=http://pictrs-safety:14051/api/v1/scan/IPADDR
      - PICTRS__MEDIA__VIDEO_CODEC=vp9
      - PICTRS__MEDIA__GIF__MAX_WIDTH=256
      - PICTRS__MEDIA__GIF__MAX_HEIGHT=256
      - PICTRS__MEDIA__GIF__MAX_AREA=65536
      - PICTRS__MEDIA__GIF__MAX_FRAME_COUNT=400
      - PICTRS_OPENTELEMETRY_URL=http://otel:4137
      - RUST_LOG=debug
      - RUST_BACKTRACE=full
      - PICTRS__API_KEY=${PICTRS_API_KEY}
      - PICTRS__STORE__TYPE=${PICTRS_STORE_TYPE}
      - PICTRS__STORE__ENDPOINT=${PICTRS_STORE_ENDPOINT}
      - PICTRS__STORE__BUCKET_NAME=${PICTRS_STORE_BUCKET_NAME}
      - PICTRS__STORE__REGION=${PICTRS_STORE_REGION}
      - PICTRS__STORE__USE_PATH_STYLE=${PICTRS_STORE_USE_PATH_STYLE}
      - PICTRS__STORE__ACCESS_KEY=${PICTRS_STORE_ACCESS_KEY}
      - PICTRS__STORE__SECRET_KEY=${PICTRS_STORE_SECRET_KEY}
    volumes:
      - ./volumes/pictrs:/mnt:Z
    user: 991:991
    restart: always
    logging: *default-logging
    deploy:
      resources:
        limits:
          memory: 690m
  postgres:
    container_name: postgres
    image: docker.io/postgres:15-alpine
    hostname: postgres
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data:Z
      - ./customPostgresql.conf:/etc/postgresql.conf
    restart: always
    command: postgres -c config_file=/etc/postgresql.conf
    logging: *default-logging
  pictrs-safety:
    image: ghcr.io/db0/pictrs-safety:v1.2.2
    hostname: pictrs-safety
    container_name: pictrs-safety
    environment:
    - FEDIVERSE_SAFETY_WORKER_AUTH="${PICTRS_SAFETY_WORKER_AUTH}"
    - FEDIVERSE_SAFETY_IMGDIR="/tmp/images"
    - USE_SQLITE=1
    - secret_key="${PICTRS_SECRET_KEY}"
    - SCAN_BYPASS_THRESHOLD=10
    - MISSING_WORKER_THRESHOLD=5
    ports:
      - "14051:14051"
    user: 991:991
    restart: always
    logging: *default-logging
    depends_on:
      - pictrs

I'm following this guide: https://patrickwu.space/2023/11/04/install-lemmy-simplified/. My .env file is:

LEMMY_VERSION=0.19.3
DOMAIN=lemmy.soulism.net
# postgres
POSTGRES_USER=admin
POSTGRES_PASSWORD=**redacted**
POSTGRES_DB=
# pictrs
## keys
PICTRS_API_KEY=stars
### 15 random characters
PICTRS_SAFETY_WORKER_AUTH=p70nkXCN1UEcyN3
### 80 random characters
PICTRS_SECRET_KEY=**redacted**
## storage type; by default is filesystem for object storage please set it to object_storage
PICTRS_STORE_TYPE=filesystem
PICTRS_STORE_ENDPOINT=
PICTRS_STORE_BUCKET_NAME=
PICTRS_STORE_REGION=
PICTRS_STORE_USE_PATH_STYLE=false
PICTRS_STORE_ACCESS_KEY=
PICTRS_STORE_SECRET_KEY=
[–] [email protected] 3 points 9 months ago (1 children)

The image for the pictrs service is wrong.
No idea what it should be, but it shouldnt be docker.io/c:0.4.3

[–] [email protected] 1 points 9 months ago (1 children)

Thanks. I get the same error even with pictrs image set to docker.io/asonix/pictrs:0.5.4

[–] [email protected] 2 points 9 months ago (1 children)

I mean, i dont see anything strange.
Maybe just destroy the droplet and start fresh? Or spin up another just to test with?
Are you familiar with installing docker? I always just use docker's convenience script to install it, and never had any problems.
You sure you havent accidentally installed docker desktop instead of docker engine? I dont know if docker has a desktop version for linux.

I keep meaning to figure out rootless mode or swap to podman

[–] [email protected] 1 points 9 months ago

I've never used docker before. It's a strange newfangled technology I don't understand. Back in my day you either used apt-get, or you compiled it yourself. I want to learn, and I thought installing Lemmy would be a good learning opportunity, but I'm finding myself chasing my own tail instead. My docker version is Docker version 24.0.2, build cb74dfc, and google is seeming to indicate that's docker engine. I can't see how docker desktop would be trying to run on ubuntu.

[–] mindlessLump 7 points 9 months ago (1 children)

I think there is some info missing. You’re using SSH to access the server where you are running the docker image? Why does your server have X server installed?

I have no experience running Lemmy. It could be the Lemmy instance includes X server to run some kind of GUI? Seems strange.

[–] [email protected] 3 points 9 months ago

My server is running the default ubuntu image from Oracle Cloud. I don't think it has X server installed.

[–] [email protected] 6 points 9 months ago

It doesn’t. No idea what you’ve done.

[–] [email protected] 5 points 9 months ago

As others have already said, Lemmy does not require a display.

You might want to try the Ansible method of setting up a Lemmy instance. I personally found it much easier.

[–] [email protected] 3 points 9 months ago

The problem is likely Ubuntu not Lemmy or not even the Lemmy setup process.

You seem to not have a dbus session going which you should by default even with SSH. It sounds like it might be falling back to trying to get it from X11 and fails that too (obviously).

So, just Ubuntu being Ubuntu.

[–] [email protected] 1 points 9 months ago (1 children)

What’s the error you’re seeing?

[–] [email protected] 1 points 9 months ago (1 children)

Cannot autolaunch D-Bus without X11 $DISPLAY

[–] [email protected] 2 points 9 months ago (1 children)

Ah my bad. Memmy didn’t display the code block in your OP or this post. I see it on the web version.

That error might be less about needing X11 and more about wanting D-Bus. Since D-Bus isn’t running, it’s trying to start it by itself using X11, which also doesn’t work.

Does the error actually make Lemmy quit out?

FWIW I have a sanitised copy of my Lemmy k8s config on Gitlab that might help: https://gitlab.com/conorab/k8s-lemmy

[–] [email protected] 1 points 9 months ago

I haven't even got Lemmy running yet, I'll still trying to compose Docker.

[–] [email protected] 1 points 9 months ago

all i know is.. that ssh can have configuration turned on for x11 forwarding.

[–] [email protected] -3 points 9 months ago

use wayland then