diff -Naur gdm-2.30.0.original/debian/changelog gdm-2.30.0/debian/changelog
--- gdm-2.30.0.original/debian/changelog
+++ gdm-2.30.0/debian/changelog
@@ -1,3 +1,11 @@
+gdm (2.30.2.is.2.30.0-4joorava0) lucid-proposed; urgency=low
+
+  * debian/patches/96_postsession.patch:
+    - Fix for gdm bug #621581, equivalent to attachment 168166
+      at bugzilla.gnome.org
+
+ -- Jouko Orava <jouko.orava@iki.fi>  Wed, 18 Aug 2010 05:50:25 +0300 
+
 gdm (2.30.2.is.2.30.0-0ubuntu3) lucid-proposed; urgency=low
 
   * debian/patches/95_git_name_escaping.patch:
diff -Naur gdm-2.30.0.original/debian/patches/96_postsession.patch gdm-2.30.0/debian/patches/96_postsession.patch
--- gdm-2.30.0.original/debian/patches/96_postsession.patch
+++ gdm-2.30.0/debian/patches/96_postsession.patch
@@ -0,0 +1,101 @@
+diff -Naur gdm-2.30.0.original/daemon/gdm-simple-slave.c gdm-2.30.0/daemon/gdm-simple-slave.c
+--- gdm-2.30.0.original/daemon/gdm-simple-slave.c
++++ gdm-2.30.0/daemon/gdm-simple-slave.c
+@@ -84,6 +84,7 @@
+ 
+         guint              start_session_when_ready : 1;
+         guint              waiting_to_start_session : 1;
++        guint              need_to_run_postsession : 1;
+         guint              plymouth_is_running : 1;
+   
+         gchar             *username;
+@@ -103,18 +104,51 @@
+ static void create_new_session (GdmSimpleSlave *slave);
+ static void start_greeter      (GdmSimpleSlave *slave);
+ 
++static gboolean
++run_presession_script (GdmSimpleSlave *slave)
++{
++        gboolean ret;
++        char *username;
++
++        username = gdm_session_direct_get_username (slave->priv->session);
++        if (username == NULL)
++                return TRUE;
++
++        ret = gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PreSession", username);
++        slave->priv->need_to_run_postsession = !ret;
++        g_free (username);
++
++        return ret;
++}
++
++static gboolean
++run_postsession_script (GdmSimpleSlave *slave)
++{
++        gboolean ret;
++        char *username;
++
++        if (!slave->priv->need_to_run_postsession)
++                return FALSE;
++
++        username = gdm_session_direct_get_username (slave->priv->session);
++        if (username == NULL)
++                return TRUE;
++
++        ret = gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PostSession", username);
++        slave->priv->need_to_run_postsession = ret;
++        g_free (username);
++
++        return ret;
++}
++
+ static void
+ on_session_started (GdmSession       *session,
+                     int               pid,
+                     GdmSimpleSlave   *slave)
+ {
+-        char *username;
+-
+         g_debug ("GdmSimpleSlave: session started %d", pid);
+ 
+-        /* Run the PreSession script. gdmslave suspends until script has terminated */
+-        username = gdm_session_direct_get_username (slave->priv->session);
+-        gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PreSession", username);
++        run_presession_script(slave);
+ 
+         /* FIXME: should we do something here?
+          * Note that error return status from PreSession script should
+@@ -129,13 +163,9 @@
+                    int             exit_code,
+                    GdmSimpleSlave *slave)
+ {
+-        char *username;
+-
+         g_debug ("GdmSimpleSlave: session exited with code %d\n", exit_code);
+ 
+-        /* Run the PostSession script. gdmslave suspends until script has terminated */
+-        username = gdm_session_direct_get_username (slave->priv->session);
+-        gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PostSession", username);
++        run_postsession_script(slave);
+ 
+         gdm_slave_stopped (GDM_SLAVE (slave));
+ }
+@@ -149,6 +179,8 @@
+                  signal_number,
+                  g_strsignal (signal_number));
+ 
++        run_postsession_script(slave);
++
+         gdm_slave_stopped (GDM_SLAVE (slave));
+ }
+ 
+@@ -651,6 +683,8 @@
+                 display_device = gdm_server_get_display_device (slave->priv->server);
+         }
+ 
++        slave->priv->need_to_run_postsession = FALSE;
++
+         slave->priv->session = gdm_session_direct_new (display_id,
+                                                        display_name,
+                                                        display_hostname,
