Closed paisleyrob closed 2 months ago
I played with this a little today. I've applied the following diff:
diff --git a/src/greeterbackground.c b/src/greeterbackground.c
index c2bc29e..f20b8a5 100644
--- a/src/greeterbackground.c
+++ b/src/greeterbackground.c
@@ -10,6 +10,11 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <math.h>
#include <cairo-xlib.h>
@@ -1079,14 +1084,27 @@ greeter_background_save_xroot(GreeterBackground* background)
cairo_surface_t *surface;
cairo_t *cr;
gsize i;
+ int fd = -1;
+
+ if(-1 == (fd = open("/tmp/lightdm-greeter-gtk.log", O_APPEND | O_CREAT | O_WRONLY | O_CLOEXEC, 0644))) {
+ perror("Aborting");
+ exit(0);
+ }
+
+ dprintf(fd, "%s:%d Entering\n", __FILE__, __LINE__);
const GdkRGBA ROOT_COLOR = {1.0, 1.0, 1.0, 1.0};
g_return_if_fail(GREETER_IS_BACKGROUND(background));
+ dprintf(fd, "%s:%d %p background\n", __FILE__, __LINE__, background);
+
priv = background->priv;
+ dprintf(fd, "%s:%d %p priv\n", __FILE__, __LINE__, priv);
surface = create_root_surface(priv->screen);
+ dprintf(fd, "%s:%d %p surface\n", __FILE__, __LINE__, surface);
cr = cairo_create(surface);
+ dprintf(fd, "%s:%d %p cr\n", __FILE__, __LINE__, cr);
gdk_cairo_set_source_rgba(cr, &ROOT_COLOR);
cairo_paint(cr);
@@ -1105,6 +1123,7 @@ greeter_background_save_xroot(GreeterBackground* background)
cairo_destroy(cr);
cairo_surface_destroy(surface);
+ close(fd);
}
const GdkRectangle*
As usual, the first login crashed, the second login succeeded. Here's the output of the log file that was generated:
greeterbackground.c:1094 Entering
greeterbackground.c:1100 0x2aebad20 background
greeterbackground.c:1103 0x2aebac60 priv
greeterbackground.c:1105 (nil) surface
greeterbackground.c:1107 0x7fcab6c97010 cr
greeterbackground.c:1094 Entering
greeterbackground.c:1100 0x395cca60 background
greeterbackground.c:1103 0x395cc9a0 priv
greeterbackground.c:1105 0x395d4640 surface
greeterbackground.c:1107 0x39546cf0 cr
After removing the segfault the greeter still exits. No core dump this time but the behavior is identical. First login exits, second login works like nothing was ever wrong.
I'm not sure what's going on here.
My next thought is to see if I can get the greeter spawned with additional debugging enabled. Looks like it's set to WARNING at the moment.
I found my answer https://wiki.archlinux.org/title/LightDM#Login_always_segfaults_on_first_attempt
Evidently my hostname is changing to the dhcp hostname as referenced in the following bugs/links. I manually set the hostname and the issue has gone away. I'll close this issue.
Upon first login to my machine the greeter crashes and I have to login a second time. The second time everything behaves properly. This morning I finally dug into the cause.
I don't understand how
surface
ends up withNULL
after the callfrom src/greeterbackground.c L1088
Nor do I understand why it works flawlessly after the first crash.
Here's the
gdb
back trace: