系统 -> Ubuntu 22.04 LTS
Firefox -> Mozilla Firefox 110.0(不使用 snap firefox)
用例 -> 在系统启动时将 firefox 作为系统服务启动。
如下创建服务->
[Unit]
Description=Firefox service as startup app
BindsTo=graphical.target
PartOf=graphical.target
After=graphical.target
[Service]
Type=simple
User=user1
Group=user1
Environment=DISPLAY=':0'
Environment=XAUTHORITY='/run/user/1000/gdm/Xauthority'
ExecStart=firefox
[Install]
WantedBy=multi-user.target
已验证环境变量 DISPLAY 默认为 :0
在正常情况下,手动启动服务时,firefox 作为服务启动。
启动后,服务失败并出现以下错误 “localhost.localdomain firefox [878]:错误:无法打开显示::0”
关于如何解决这个问题的任何想法?