For a couple of months now I have been running into this extremely annoying bug,… where sddm will sometimes completely freeze just after it started, and sometimes it will work just fine. There's no pattern to it (that I have found). If it did freeze, I had to go into a tty and restart the service, after a restart it would almost always work just fine. It seems to happen mostly if this is the first time sddm has been started since reboot.
Usually when it happens dmesg will show me that there was a segfault in libc:
```
[ 23.071813] QSGRenderThread[3920]: segfault at 7 ip 00007f1d3045a1a6 sp 00007f1cf9965400 error 4 in libc-2.29.so[7f1d303f1000+159000]
[ 23.071817] Code: 84 42 ff ff ff 0f 1f 80 00 00 00 00 4a 8d 14 e0 4c 8b 42 40 4d 85 c0 0f 84 2a ff ff ff 48 81 fb ff 03 00 00 0f 87 ea 01 00 00 <49> 8b 08 48 89 4a 40 42 fe 0c 2049 c7 40 08 00 00 00 00 0f 1f 80
```
I asked for help on the [gentoo forums](https://forums.gentoo.org/viewtopic-p-8349472.html#8349472) and got some helpful hints and tips to make a backtrace using gdb. I had some trouble with that because for some reason there wasn't a coredump file anywhere I looked, turns out it doesn't create one automatically if the problem occurs in a child process or something, idk. When I removed sddm from the default runlevel, and instead started it manually after every boot. I was then able to use the CTRL+\ shortcut to force a coredump after it froze providing me with the following backtrace:
```
Reading symbols from sddm...
Reading symbols from /usr/lib/debug//usr/bin/sddm.debug...
[New LWP 3853]
[New LWP 3854]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `sddm'.
Program terminated with signal SIGQUIT, Quit.
#0 0x00007f265c4c1393 in __GI___poll (fds=0x55f34e0ed8d0, nfds=10, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
29 return SYSCALL_CANCEL (poll, fds, nfds, timeout);
[Current thread is 1 (Thread 0x7f2659df6f80 (LWP 3853))]
(gdb) bt
#0 0x00007f265c4c1393 in __GI___poll (fds=0x55f34e0ed8d0, nfds=10, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1 0x00007f265b90015e in g_main_context_poll (priority=<optimized out>, n_fds=10, fds=0x55f34e0ed8d0, timeout=<optimized out>, context=0x55f34e0ca340) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:4221
#2 g_main_context_iterate (context=context@entry=0x55f34e0ca340, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:3915
#3 0x00007f265b90027f in g_main_context_iteration (context=0x55f34e0ca340, may_block=may_block@entry=1) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:3981
#4 0x00007f265cb0b280 in QEventDispatcherGlib::processEvents (this=0x55f34e0c99b0, flags=...) at kernel/qeventdispatcher_glib.cpp:422
#5 0x00007f265cab0a7b in QEventLoop::exec (this=this@entry=0x7ffe74f35300, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140
#6 0x00007f265cab8f52 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:120
#7 0x000055f34d3a301a in main (argc=<optimized out>, argv=0x7ffe74f354d8) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/DaemonApp.cpp:138
```
If I try to restart sddm immediately after this it will always segfault again, this time it does give me the "Segmentation Fault (core dumped)" message and I do find a coredump file, without having to use the CTRL+\ shortcut. This always gives a different backtrace:
```
Reading symbols from sddm...
Reading symbols from /usr/lib/debug//usr/bin/sddm.debug...
[New LWP 3927]
[New LWP 3928]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `sddm'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 return ret;
[Current thread is 1 (Thread 0x7f2362626f80 (LWP 3927))]
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f2364c1a535 in __GI_abort () at abort.c:79
#2 0x00007f23650e1707 in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1901
#3 QMessageLogger::fatal (this=this@entry=0x7ffcf29c2c30, msg=msg@entry=0x55d7ecc209c8 "Display server failed to start. Exiting") at global/qlogging.cpp:887
#4 0x000055d7ecbc468d in SDDM::Display::start (this=this@entry=0x55d7ed5e4890) at /usr/include/qt5/QtCore/qlogging.h:91
#5 0x000055d7ecc0643f in SDDM::Seat::createDisplay (this=0x55d7ed5fd770, terminalId=7) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/Seat.cpp:82
#6 0x000055d7ecc0665d in SDDM::Seat::Seat (this=0x55d7ed5fd770, name=..., parent=<optimized out>) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/Seat.cpp:48
#7 0x000055d7ecc0881d in SDDM::SeatManager::createSeat (this=0x55d7ed5e98f0, name=...) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/SeatManager.cpp:121
#8 0x000055d7ecc08960 in SDDM::SeatManager::<lambda()>::operator() (__closure=0x55d7ed5e3aa0, __closure=0x55d7ed5e3aa0) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/SeatManager.cpp:159
#9 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, SDDM::SeatManager::logindSeatAdded(const QString&, const QDBusObjectPath&)::<lambda()> >::call (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#10 QtPrivate::Functor<SDDM::SeatManager::logindSeatAdded(const QString&, const QDBusObjectPath&)::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#11 QtPrivate::QFunctorSlotObject<SDDM::SeatManager::logindSeatAdded(const QString&, const QDBusObjectPath&)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0x55d7ed5e3a90,
r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:439
#12 0x00007f236530e01e in QtPrivate::QSlotObjectBase::call (a=0x7ffcf29c2e80, r=0x55d7ed5e98f0, this=0x55d7ed5e3a90) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#13 QMetaObject::activate (sender=0x55d7ed5e9550, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3776
#14 0x000055d7ecc0760f in SDDM::LogindSeat::canGraphicalChanged (this=<optimized out>, _t1=<optimized out>, _t1@entry=true) at src/daemon/sddm_autogen/include/SeatManager.moc:143
#15 0x000055d7ecc07ac3 in SDDM::LogindSeat::<lambda()>::operator() (__closure=0x55d7ed5e3ad0) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/SeatManager.cpp:68
#16 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, SDDM::LogindSeat::LogindSeat(const QString&, const QDBusObjectPath&, QObject*)::<lambda()> >::call (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#17 QtPrivate::Functor<SDDM::LogindSeat::LogindSeat(const QString&, const QDBusObjectPath&, QObject*)::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#18 QtPrivate::QFunctorSlotObject<SDDM::LogindSeat::LogindSeat(const QString&, const QDBusObjectPath&, QObject*)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0x55d7ed5e3ac0,
r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:439
#19 0x00007f236530e01e in QtPrivate::QSlotObjectBase::call (a=0x7ffcf29c3020, r=0x55d7ed5e9550, this=0x55d7ed5e3ac0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#20 QMetaObject::activate (sender=0x55d7ed5fdd90, signalOffset=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at kernel/qobject.cpp:3776
#21 0x00007f2365c94dcf in QDBusPendingCallWatcher::finished (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qdbuspendingcall.cpp:158
#22 0x00007f2365c94edb in QDBusPendingCallWatcher::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at .moc/moc_qdbuspendingcall.cpp:94
#23 0x00007f236530edca in QObject::event (this=0x55d7ed5fdd90, e=<optimized out>) at kernel/qobject.cpp:1260
#24 0x00007f23652e1ebb in doNotify (receiver=0x55d7ed5fdd90, event=0x55d7ed5d6ba0) at ../../include/QtCore/../../src/corelib/kernel/qobject.h:142
#25 0x00007f23652e1f4f in QCoreApplication::notifyInternal2 (receiver=0x55d7ed5fdd90, event=0x55d7ed5d6ba0) at kernel/qcoreapplication.cpp:1060
#26 0x00007f23652e5265 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x55d7ed5d5ee0) at kernel/qcoreapplication.cpp:1799
#27 0x00007f236533b863 in postEventSourceDispatch (s=0x55d7ed5e75c0) at kernel/qeventdispatcher_glib.cpp:276
#28 0x00007f236412ff62 in g_main_dispatch (context=0x55d7ed5dd340) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:3182
#29 g_main_context_dispatch (context=context@entry=0x55d7ed5dd340) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:3847
#30 0x00007f23641301f0 in g_main_context_iterate (context=context@entry=0x55d7ed5dd340, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:3920
#31 0x00007f236413027f in g_main_context_iteration (context=0x55d7ed5dd340, may_block=may_block@entry=1) at /usr/src/debug/dev-libs/glib-2.58.3/glib-2.58.3/glib/gmain.c:3981
#32 0x00007f236533b280 in QEventDispatcherGlib::processEvents (this=0x55d7ed5dc9b0, flags=...) at kernel/qeventdispatcher_glib.cpp:422
#33 0x00007f23652e0a7b in QEventLoop::exec (this=this@entry=0x7ffcf29c3440, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:140
#34 0x00007f23652e8f52 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:120
#35 0x000055d7ecbc801a in main (argc=<optimized out>, argv=0x7ffcf29c3618) at /usr/src/debug/x11-misc/sddm-0.18.1-r1/sddm-0.18.1/src/daemon/DaemonApp.cpp:138
```
If I then restart sddm again it will work just fine.
Using gentoo with linux-5.1.16
sddm-0.18.1-r1
glibc-2.29-r2
glib-2.58.3
xorg-server-1.20.5
nvidia-drviers-430.26 (with nvidia-drm.modeset=1)
I hope this is useful