ubuntu 14.04 ltsp-server /etc/X11/Xsession.d/40-ltsp-server DESKTOP_SESSION breaks lubuntu-desktop login

Bug #1330252 reported by Tero Marttila
40
This bug affects 7 people
Affects Status Importance Assigned to Milestone
ltsp (Ubuntu)
Fix Released
Medium
Alkis Georgopoulos

Bug Description

DistroRelease: Ubuntu 14.04
Package: ltsp-server 5.5.1-1ubuntu2

The following code in `/etc/X11/Xsession.d/40-ltsp-server` causes issues with dash `export ...` expansion as regards LP#139097 :

    DESKTOP_SESSION=$(echo $1 | sed "s/gnome-session --session=//g")

Given the following `/usr/share/xsessions/Lubuntu.desktop` :

    Exec=/usr/bin/lxsession -s Lubuntu -e LXDE

Attempting to login to the Lubuntu desktop session results in the following error in `~/.xsession-errors` :

    /etc/X11/Xsession: 6: export: -s: bad variable name

Presumeably due to the `DESKTOP_SESSION` being set above breaking in `/etc/X11/Xsession.d/70gconfd_path-on-session` :

    export MANDATORY_PATH=${GCONF_PREFIX}/${DESKTOP_SESSION}.mandatory.path
    export DEFAULTS_PATH=${GCONF_PREFIX}/${DESKTOP_SESSION}.default.path

Commenting out the culprit DESKTOP_SESSION=... assignment lets me login to the Lubuntu desktop again.

Revision history for this message
Tero Marttila (terom-u) wrote :

Note that in Ubuntu 12.04 (where Lubuntu LTSP works) the lubuntu-default-settings 0.27 package ships a different /usr/share/xsessions/Lubuntu.desktop :

    Exec=/usr/bin/startlubuntu

The /etc/X11/Xsession.d/... files seem to be the same.

Revision history for this message
Jonathan Carter (jonathan) wrote :

This also affects ltsp fat clients. On fat client environments this bug doesn't occur when /etc/X11/Xsession.d/40-ltsp-client is removed from the ltsp chroot.

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

Can you test if this solves the problem?

Replace:
    DESKTOP_SESSION=$(echo $1 | sed "s/gnome-session --session=//g"
With:
    DESKTOP_SESSION=$(grep -l "^Exec=$1\$" /usr/share/xsessions/*.desktop 2>/dev/null | sed -n '1 s,.*/\(.*\)\.desktop,\1,p')

Revision history for this message
Jukka Korhonen (korhonen-j) wrote :

I was unable to solve the problem with that replacing.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ltsp (Ubuntu):
status: New → Confirmed
Revision history for this message
John Hupp (john.hupp) wrote :

Running Lubuntu 14.04.1 i386 with LTSP-PNP, I also encountered this bug.

But if I comment out the DESKTOP_SESSIONS line as above, then I can't log in to the server itself, I get a login loop.

Does this workaround only work with a dedicated chroot, or did I do something wrong?

Revision history for this message
John Hupp (john.hupp) wrote :

I also tried removing 40-ltsp-server altogether and updating the image. In this case the server boot succeeds, but the client boot doesn't even get as far as the login screen. After identifying the boot server IP, it fails with "TFTP open timeout."

So again, I'm wondering if perchance we only have a good workaround with a dedicated chroot.

Revision history for this message
John Hupp (john.hupp) wrote :

I had forgotten about the usual fix for a TFTP open timeout: in /etc/dnsmasq.d/network-manager, replace "bind interfaces" with "bind dynamic." This takes care of the timeout and gets me to a login screen, but that still suffers from the login loop.

I can log in to Openbox with no problem.

Revision history for this message
John Hupp (john.hupp) wrote :

Alkis' replacement in Comment #3 also does not fix the problem. The client still has a login loop.

Revision history for this message
John Hupp (john.hupp) wrote :

This workaround passed along to me by Vagrant Cascadian works:

Write a script, say /usr/local/bin/lubuntu-custom:

  #!/bin/sh
  exec /usr/bin/lxsession -s Lubuntu -e LXDE

(For others less experienced like me, remember to make the script executable.)

Also write a corresponding /usr/share/xsessions/Lubuntu-Custom.desktop file:

  [Desktop Entry]
  Name=Lubuntu-custom
  Comment=LXDE - Lightweight X11 desktop environment
  Exec=/usr/local/bin/lubuntu-custom

(Alternatively, one could instead edit /usr/share/xsessions/Lubuntu.desktop to use that Exec command.)

And then set the default session in lts.conf:

  LDM_SESSION=Lubuntu-custom

However, my observation concerning this last step is that LDM does not default to this session selection. Rather it defaults to the last-used/selected session.

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

I think that 40-ltsp-server and 40-ltsp-client should be deleted, and DESKTOP_SESSION should be set from X50-dmrc-processing in CLIENT_ENV, since that's the script that parses the xsession files and so it can output DESKTOP_SESSION with no additional overhead.

Revision history for this message
Peter Vilhan (peter-vilhan-5) wrote :

Hi all,
workaround is:
1. chroot /opt/ltsp/i386 or amd64
2. run dpkg-reconfigure dash in chroot and select NO (Do not use dash as sh)
3. then update image with ltsp-update-image
Enjoy!

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

I tested my patch from #3 and it does work, but I don't have access to commit it because it's in the Ubuntu packaging and not in the upstream code.

Both /etc/X11/Xsession.d/40-ltsp-server and /opt/ltsp/i386/etc/X11/Xsession.d/40-ltsp-client need to have that one line changed.
So the result would be:

if [ -n "$LTSP_CLIENT" ] && [ -z "$DESKTOP_SESSION" ]; then
    if ([ "$1" = "default" ] || [ -z "$1" ]) && [ "$(readlink /etc/alternatives/x-session-manager)" = "/usr/bin/gnome-session" ]; then
        DESKTOP_SESSION=ubuntu
    elif [ -n "$1" ]; then
        DESKTOP_SESSION=$(grep -l "^Exec=$1\$" /usr/share/xsessions/*.desktop 2>/dev/null | sed -n '1 s,.*/\(.*\)\.desktop,\1,p')
    fi
    export DESKTOP_SESSION
fi

But I really think that Ubuntu should sync its ltsp packaging with Debian, and that code above should go to X50-dmrc-processing instead.

Changed in ltsp (Ubuntu):
assignee: nobody → Stéphane Graber (stgraber)
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Tenho Tuhkala (muppis) wrote :

Running dpkg-reconfigure dash and answering No at server side fixed this for me.

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :
Changed in ltsp (Ubuntu):
assignee: Stéphane Graber (stgraber) → Alkis Georgopoulos (alkisg)
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.