4

I'm using playwright to run automated testing on CentOS 8.

Node script are run as systemd services.
Chromium is used from the rpm package.

But chromium from rpm package has problems with video codec support.
I installed chromium from flatpak and tried to run it...

After the first failure, I went to github playwright repo.
Then I created another question, but already in the flatpack repo.

In short, when I try to start chromium from flatpak from script that is running as a systemd service, I get an error:

Cannot autolaunch D-Bus without X11 $DISPLAY
(zenity:8): Gtk-WARNING **: 17:13:28.767: cannot open display:

As far as I understand, I need to somehow make sure that the script running as a service has a dbus... How to do it?

nexcode
  • 93
  • 6

1 Answers1

0

You need to set correct Environment= inside your unit or export all required variables using

systemctl --user import-environment DISPLAY XAUTHORITY

if command -v dbus-update-activation-environment >/dev/null 2>&1; then
    dbus-update-activation-environment DISPLAY XAUTHORITY
fi

See

After that, even with a basic unit below

~/.config/systemd/user/chromium.service

[Unit]
Description=Chromium

[Service]
ExecStart=/usr/bin/flatpak run org.chromium.Chromium
ExecStop=/usr/bin/flatpak kill org.chromium.Chromium


[Install]
WantedBy=default.target

systemctl --user start chromium will open your browser

Andrew
  • 3,912
  • 17
  • 28