openSUSE / openSUSEway

dotfiles for Sway on openSUSE
MIT License
82 stars 17 forks source link

greetd thread 'main' panicked #55

Closed denisok closed 1 year ago

denisok commented 2 years ago

greetd doesn't start and show panic traces:

for @mcepl : https://user-images.githubusercontent.com/198999/152215734-1b0b0c46-48e6-4c12-945d-36bc8d5fa43a.jpg

for me:

thread 'main' panicked at 'unable to exec: Sys(EACCES)', greetd/src/session/worker.rs:255:14

I have enabled full trace in /usr/lib/systemd/system/greetd.service in [Service] section:

Environment="RUST_BACKTRACE=full"

but it shows just bunch of unknown.

denisok commented 2 years ago

@mcepl could you try that full trace and see if you see some more info?

denisok commented 2 years ago

I think my problem differs from Matěj's . I use MicroOS and there could be different issues with access and etc.

mcepl commented 2 years ago

Mine is https://user-images.githubusercontent.com/198999/152267485-4ab337bd-5cc5-435e-84e7-7b94720e0055.jpg

and the error is:

interface 'wl_output' has no event 4
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: 0s { code: 2, kind: NotFound, message: 'No such file or directory' }', src/app.rs:303:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
00:00:01.022 [common/ipc-client.c:87] Unable to receive IPC response

(polkit-gnome-authentication-agent-1:2695): Gtk-WARNING **: 02:31:16.164: cannot open display :0
[FAILED] Failed to start Greeter daemon.
[FAILED] Failed to start Network Manager Wait Online.
Arnavion commented 2 years ago

@mcepl greetd doesn't have src/app.rs. Also the first error about wl_output is a chromium / electron bug. The common/ipc-client.c error is from swaymsg successfully connecting to sway but then connection breaks. That means greetd is successfully starting a sway session, which is then starting some default programs (including chromium / some electron program, some Rust program, swaymsg and polkit-gnome-authentication-agent), one of which is crashing sway and thus taking down the whole graphical session. So greetd is probably not the problem.

You can try with a default / empty sway config and see.

mcepl commented 2 years ago

Also the first error about wl_output is a chromium / electron bug.

WHAT? Electron? I really cannot find anything which would depend on Electron automatically being started:

stitny~$ rg exec ~/.config/sway/
/home/matej/.config/sway/config.d/10_variables.conf
17:#set $menu dmenu_path | dmenu | xargs swaymsg exec --

/home/matej/.config/sway/config.d/40_clipboard.conf
5:exec wl-paste -n -t text --watch clipman store --histpath="~/.cache/clipman.json" >> /tmp/clipman-log.txt 2>&1 &
6:# exec wl-paste -n -p -t text --watch clipman store -P --histpath="~/.cache/clipman-primary.json" >> /tmp/clipman-log.txt 2>&1 &
7:bindsym $mod+x exec clipman pick -t wofi --histpath="~/.cache/clipman.json"
10:bindsym $mod+shift+section exec osurl "$(wl-paste --primary)"
11:bindsym $mod+shift+w exec wl-paste --primary -n |abbrevURL |wl-copy -n -p

/home/matej/.config/sway/config.d/20_autoexec.conf
2:exec_always /home/matej/.bin/import-gsettings
7:exec /usr/bin/mako

/home/matej/.config/sway/on_lock.sh
8:exec swaylock -f -c 000000

/home/matej/.config/sway/config.d/50_key-bindings.conf
5:bindsym $mod+Shift+x exec swaylock -F -f -i /home/matej/.config/sway/wallpaper.jpg
8:bindsym Print exec grim ~/screenshot-$(date +%Y-%m-%d_%H-%m-%s).png
11:bindsym $mod+Print exec grim -g "$(slurp)" ~/screenshot-$(date +%Y-%m-%d_%H-%m-%s).png
14:bindsym $mod+shift+m exec makoctl dismiss -a
17:bindsym XF86Calculator exec gnome-calculator
20:bindsym $mod+m exec sway-marker mark
21:bindsym $mod+semicolon exec sway-marker goto
22:# bindsym $mod+m exec swaymsg "mark $(zenity --entry --text='Enter mark:')"
23:# bindsym $mod+semicolon exec swaymsg "[con_mark=$(zenity --entry --text='Enter mark:')] focus"
26:bindsym --locked XF86AudioRaiseVolume exec --no-startup-id pamixer -i 5
27:bindsym --locked XF86AudioLowerVolume exec --no-startup-id pamixer -d 5
28:bindsym --locked XF86AudioMute exec --no-startup-id pamixer --toggle-mute
31:bindsym --locked XF86AudioPlay exec "mpris-ctl pp"
32:bindsym --locked XF86AudioStop exec "mpris-ctl --player active stop"
33:bindsym --locked XF86AudioNext exec "mpris-ctl --player active next"
34:bindsym --locked XF86AudioPrev exec "mpris-ctl --player active prev"
stitny~$ cat ~/.bin/import-gsettings
#!/usr/bin/python3
# usage: import-gsettings
import configparser
import os
import os.path

from gi import require_version
require_version('Gio', '2.0')
from gi.repository import Gio

translate_keys = {
        'gtk-theme-name': 'gtk-theme',
        'gtk-icon-theme-name': 'icon-theme',
        'gtk-cursor-theme-name': 'cursor-theme',
        'gtk-font-name': 'document-font-name',
        }

config = configparser.ConfigParser()
config.read([
    os.path.expandvars('$XDG_CONFIG_HOME/gtk-3.0/settings.ini'),
    os.path.expanduser('~/.config/gtk-3.0/settings.ini')])

sect = config['Settings']

iface = Gio.Settings.new('org.gnome.desktop.interface')

for key in translate_keys:
    if sect[key]:
        iface.set_string(translate_keys[key], sect[key])

mako? I really no clue.

mcepl commented 2 years ago

Also, the content of /etc/greetd directory:

stitny/e/greetd$ cat config.toml
[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number
# designating the VT.
vt = next

# The default session, also known as the greeter.
[default_session]

# `agreety` is the bundled agetty/login-lookalike. You can replace `bash`
# with whatever you want started, such as `sway`.
# command = "agreety --cmd bash"
command = "sway --config /etc/greetd/sway-config"

# The user to run the command as. The privileges this user must have depends
# on the greeter. A graphical greeter may for example require the user to be
# in the `video` group.
user = "greeter"
stitny/e/greetd$ cat sway-config
exec "wlgreet --command sway-run.sh; swaymsg exit"

bindsym Mod4+shift+e exec swaynag \
    -t warning \
    -m 'What do you want to do?' \
    -b 'Poweroff' 'systemctl poweroff' \
    -b 'Reboot' 'systemctl reboot'

exec /usr/libexec/polkit-gnome-authentication-agent-1

#include /etc/sway/config.d/
stitny/e/greetd$ cat /usr/bin/sway-run.sh
#!/bin/sh

# Session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway

# this file imports openSUSEway desktop enviroments
set -a
. /etc/sway/env
set +a

systemd-cat --identifier=sway sway $@

stitny/e/greetd$

I really don’ŧ see any Electron app here.

mcepl commented 2 years ago

New datapoint. With almost default /etc/greetd/config.toml:

[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number
# designating the VT.
vt = next

# The default session, also known as the greeter.
[default_session]

# `agreety` is the bundled agetty/login-lookalike. You can replace `bash`
# with whatever you want started, such as `sway`.
command = "agreety --cmd sway-run.sh"

# The user to run the command as. The privileges this user must have depends
# on the greeter. A graphical greeter may for example require the user to be
# in the `video` group.
user = "greeter"

(now looking at it, I should probably really add full path to sway-run.sh, shouldn’t I?)

So, with this configuration, I get repeatedly crashing login prompt, which finally settles and I can login to the plain bash session, where I can run sway command.

This is the full journalctl -xb, but I don’t see anything interesting there.

mcepl commented 2 years ago

@mcepl greetd doesn't have src/app.rs.

@Arnavion What an interesting thing to say! https://git.sr.ht/~kennylevinsen/wlgreet/tree/master/item/src/app.rs

denisok commented 2 years ago

sway-run.sh, shouldn’t I?)

it should be in a PATH, but if it is not it at least would go to the interface to login and then would complain that is can't run shell or something.

I use: command = "tuigreet --cmd sway-run.sh" and it works fine on my another box.

for you agreety, it should work. In the log you attached, I see only this suspicious:

úno 13 18:46:09 stitny greetd[2566]: gkr-pam: stashed password to try later in open session
úno 13 18:46:09 stitny greetd[2566]: pam_unix(greetd:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=matej
úno 13 18:46:11 stitny greetd[2566]: error: authentication error: pam_authenticate: AUTH_ERR
úno 13 18:46:11 stitny greetd[2446]: client loop failed: i/o error: Broken pipe (os error 32)

was it working before and stopped after some update. or this is a new installation ? Do you have pam module for greetd in /etc/pam.d ?

mcepl commented 2 years ago

Do you have pam module for greetd in /etc/pam.d ?

stitny:~ # l /etc/pam.d/greetd
lrwxrwxrwx. 1 root root 26 Feb 22  2021 /etc/pam.d/greetd -> ../../usr/etc/pam.d/greetd
stitny:~ # cat /etc/pam.d/greetd
#%PAM-1.0
auth     requisite      pam_nologin.so
auth     include        common-auth
account  include        common-account
password include        common-password
session  required       pam_loginuid.so
session  optional       pam_keyinit.so force revoke
session  include        common-session
stitny:~ # rpm -Vf $(readlink -f /etc/pam.d/greetd)
S.5....T.  c /etc/greetd/config.toml
stitny:~ #
denisok commented 2 years ago

so in my case (using openSUSE MicroOS) the crash is kinda destined:

 let cpath = CString::new("/bin/sh").unwrap();

when

> whereis bash
bash: /usr/bin/bash /usr/share/bash
> whereis sh
sh: /usr/bin/sh
denisok commented 2 years ago

at the end that is SELinux:

type=AVC msg=audit(1643843896.477:52): avc:  denied  { transition } for  pid=934 comm="greetd" path="/usr/bin/bash" dev="sda2" ino=77757 scontext=system_u:system_r:unconfined_service_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0 tclass=process permissive=0
mcepl commented 2 years ago

I have filed https://bugzilla.suse.com/show_bug.cgi?id=1198559 security bug for it and I would be grateful for your participation on it.

mcepl commented 1 year ago

I believe this ticket is now so old, that it is meaningless. I have still problems with greetd (and SELinux), but they are different, so I will file a new ticket.