Public bug reported:

I'm not sure if this is the right package; please move it if I'm in the
wrong place.

Executive Summary: Putting just "set -u" into a .bash_profile hangs a
Session: Lubuntu login (and most others, too) because X11 scripts fail
to handle unset variables properly.  Also, one variable typo found (see
below).

Distributor ID: Ubuntu
Description:    Ubuntu 26.04 LTS
Release:        26.04
Codename:       resolute

1. I upgrade Ubuntu 24.04 to 26.04.  The machine (2008 Macbook) is too slow 
with only 6GB and the Xwayland display keeps crashing with an i915 "GPU HANG", 
but that's not my problem here.
2. I "apt install lubuntu-desktop" and reboot.  I can't log in; everything 
hangs after I type my password.  After much messing around using an ssh login 
to modify my login .bashrc and .bash_profile, I isolate this:
3. I create an empty account with nothing in the home directory other than a 
.bash_profile containing one line: set -u
4. I can log in to the new account with Session: Ubuntu, but all the other 
sessions (Lubuntu, etc.) hang after I type my password.  I have to ssh in and 
kill the Xorg server to unfreeze the display.

Here is what the process tree shows when the screen is hung after I type
my password (e.g. using Session: Lubuntu):

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
[...]
root        2089  0.0  0.4 170236 26576 ?        Ssl  16:09   0:00 /usr/bin/sddm
root       50467  0.8  1.4 453576 89956 tty2     Ssl+ 23:07   0:00  \_ 
/usr/lib/xorg/Xorg -nolisten tcp -background none -seat seat0 vt2 -auth 
/run/sddm/xauth_EhHYHb -noreset -displayfd 18

There is no sddm-helper process in the tree.

Here is what the process tree shows when I log in successfully using
Session: Ubuntu:

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
[...]
root        2089  0.0  0.4 170364 26632 ?        Ssl  16:09   0:00 /usr/bin/sddm
root       52030  0.1  1.4 453572 89892 tty2     Ssl+ 23:11   0:00  \_ 
/usr/lib/xorg/Xorg -nolisten tcp -background none -seat seat0 vt2 -auth 
/run/sddm/xauth_bjLPkv -noreset -displayfd 18
root       52192  0.0  0.4  90276 25404 ?        S    23:11   0:00  \_ 
/usr/lib/x86_64-linux-gnu/sddm/sddm-helper --socket 
/tmp/sddm-auth-f00af065-da45-4dc8-95a9-0ac69d1e814e --id 71 --start 
/usr/bin/gnome-session --session=ubuntu --user ian
ian        52279  0.0  0.1 175204  9596 tty1     Ssl+ 23:11   0:00  |   \_ 
/usr/libexec/gnome-session-init-worker ubuntu

Whatever helper scripts are called from /usr/bin/sddm for the Lubuntu
and other sessions are dying if "set -u" is enabled in my .bash_profile.

From the BASH man page: "If expansion is attempted on an unset variable
or parameter, the shell prints an error message, and, if not
interactive, exits with a non-zero status."

The "unbound variable" problem has been ongoing for years with X11
scripting.  In my .xsession-errors file I found and fixed all of these
and more:

    /usr/share/im-config/initializer: line 54: CJKV_LOCALE: unbound variable
    /usr/share/im-config/initializer: line 89: GTK_IM_MODULE: unbound variable
    /usr/share/im-config/initializer: line 89: QT_IM_MODULE: unbound variable
    /usr/share/im-config/initializer: line 89: CLUTTER_IM_MODULE: unbound 
variable
    /usr/share/im-config/initializer: line 89: SDL_IM_MODULE: unbound variable
    /usr/share/im-config/initializer: line 89: XMODIFIERS: unbound variable
    /usr/share/im-config/initializer: line 90: XDG_CURRENT_DESKTOP: unbound 
variable
    /etc/X11/Xsession.d/70im-config_launch: line 23: XMODIFIERS: unbound 
variable
    /usr/share/im-config/im-config_setting: line 25: SDL_IM_MODULE: unbound 
variable
    /etc/X11/Xsession.d/90atk-adaptor: line 8: GTK_MODULES: unbound variable
    /etc/X11/Xsession.d/90x11-common_ssh-agent: line 10: SSH_AUTH_SOCK: unbound 
variable

That first one needs special attention because it's from this code in
/usr/share/im-config/initializer:

        if [ -z "$CJKV_LOCALE" ]; then
            CJKV_LOCALES="zh_TW:zh_HK:zh_SG:zh_CN:ja_JP:ko_KR:vi_VN"
        fi

Looks like a typing error: CJKV_LOCALE should be CJKV_LOCALES.  (Aside: This is 
exactly why you should run your code with "set -u".)  Even if it weren't a 
typing error, it would die with "unbound variable" if CJKV_LOCALES weren't 
defined.  The right way to write this, so that it works with "set -u", is like 
this:
   
        if [ -z "${CJKV_LOCALES-}" ]; then 
    
which works with or without "set -u" in effect.  All the X11 scripts (above) 
need to be updated to do this so that they don't die if "set -u" is in 
someone's .bash_profile.
    
P.S. Even after fixing all the above unbound variables, I was not able to get 
the Session: Openbox to work. The screen just hangs after typing my password 
and my .xsession-errors file is full of errors:
    
Openbox-Message: Unable to find a valid menu file 
"/var/lib/openbox/debian-menu.xml"
/bin/sh: 1: exec: start-pulseaudio-x11: not found
[ 2026-07-22 00:55:01.124 sanitize_options ERROR ] Backend not specified. You 
must choose one explicitly. Valid ones are: 
[ 2026-07-22 00:55:01.124 sanitize_options ERROR ]      glx
[ 2026-07-22 00:55:01.124 sanitize_options ERROR ]      egl
[ 2026-07-22 00:55:01.124 sanitize_options ERROR ]      xrender
[ 2026-07-22 00:55:01.124 sanitize_options ERROR ]      dummy
[ 2026-07-22 00:55:01.124 session_init FATAL ERROR ] Failed to get 
configuration, usually mean you have specified invalid options.
[ 2026-07-22 00:55:01.124 main FATAL ERROR ] Failed to create new session.

(nm-applet:76407): libayatana-appindicator-WARNING **: 00:55:02.156:
libayatana-appindicator is deprecated. Please use libayatana-
appindicator-glib in newly written code.

(nm-applet:76407): nm-CRITICAL **: 00:55:02.526: ((../src/libnm-core-
impl/nm-setting-connection.c:232)): assertion '<dropped>' failed

(update-notifier:76404): libayatana-appindicator-WARNING **: 00:55:02.975: 
libayatana-appindicator is deprecated. Please use libayatana-appindicator-glib 
in newly written code.
blueman-applet 00.55.03 WARNING  PluginManager:153 __load_plugin: Not loading 
PPPSupport because its conflict has higher priority
blueman-applet 00.55.03 WARNING  PluginManager:153 __load_plugin: Not loading 
DhcpClient because its conflict has higher priority

(update-notifier:76404): libayatana-appindicator-WARNING **:
00:55:12.192: libayatana-appindicator is deprecated. Please use
libayatana-appindicator-glib in newly written code.

(update-notifier:76404): libayatana-appindicator-WARNING **:
00:55:12.201: libayatana-appindicator is deprecated. Please use
libayatana-appindicator-glib in newly written code.

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: sddm 0.21.0+git20250502.4fe234b-2ubuntu3
ProcVersionSignature: Ubuntu 7.0.0-28.28-generic 7.0.12
Uname: Linux 7.0.0-28-generic x86_64
ApportVersion: 2.34.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Tue Jul 21 23:25:06 2026
InstallationDate: Installed on 2022-05-18 (1526 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Release amd64 (20220419)
SourcePackage: sddm
UpgradeStatus: Upgraded to resolute on 2026-07-19 (2 days ago)

** Affects: sddm (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug lubuntu resolute

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2161486

Title:
  "set -u" in .bash_profile prevents Lubuntu login: unbound variables

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sddm/+bug/2161486/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to