multiple issues with /etc/X11/Xsession.d/ - "has_option: command not found"

Bug #1955135 reported by Norbert
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
dbus (Ubuntu)
Confirmed
Undecided
Unassigned
xorg (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Steps to reproduce:
1. Boot 20211217 Ubuntu MATE daily ISO
2. Open ~/.xsession-errors

Expected results:
* no errors and warnings

Actual results:
* there are two errors about xorg:

/etc/X11/Xsession.d/30x11-common_xresources: line 16: has_option: command not found
/etc/X11/Xsession.d/90x11-common_ssh-agent: line 9: has_option: command not found

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: x11-common 1:7.7+23ubuntu1
ProcVersionSignature: Ubuntu 5.13.0-19.19-generic 5.13.14
Uname: Linux 5.13.0-19-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.11-0ubuntu74
Architecture: amd64
BootLog: Error: [Errno 13] Permission denied: '/var/log/boot.log'
CasperMD5CheckResult: pass
CasperVersion: 1.465
CompositorRunning: None
CurrentDesktop: MATE
Date: Fri Dec 17 14:22:15 2021
Dependencies: lsb-base 11.1.0ubuntu3
DistUpgraded: Fresh install
DistroCodename: jammy
DistroVariant: ubuntu
ExtraDebuggingInterest: Yes, if not too technical
GraphicsCard:
 NVIDIA Corporation GF108M [GeForce GT 425M] [10de:0df0] (rev a1) (prog-if 00 [VGA controller])
   Subsystem: Sony Corporation GF108M [GeForce GT 425M] [104d:907a]
LiveMediaBuild: Ubuntu-MATE 22.04 LTS "Jammy Jellyfish" - Alpha amd64 (20211217)
MachineType: Sony Corporation VPCF13Z1R
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/casper/vmlinuz file=/cdrom/preseed/username.seed maybe-ubiquity quiet splash ---
SourcePackage: xorg
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 10/20/2010
dmi.bios.release: 1.90
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: R0190Y9
dmi.board.asset.tag: N/A
dmi.board.name: VAIO
dmi.board.vendor: Sony Corporation
dmi.board.version: N/A
dmi.chassis.asset.tag: N/A
dmi.chassis.type: 10
dmi.chassis.vendor: Sony Corporation
dmi.chassis.version: N/A
dmi.ec.firmware.release: 1.90
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrR0190Y9:bd10/20/2010:br1.90:efr1.90:svnSonyCorporation:pnVPCF13Z1R:pvrC606GZYK:skuN/A:rvnSonyCorporation:rnVAIO:rvrN/A:cvnSonyCorporation:ct10:cvrN/A:
dmi.product.family: VAIO
dmi.product.name: VPCF13Z1R
dmi.product.sku: N/A
dmi.product.version: C606GZYK
dmi.sys.vendor: Sony Corporation
version.compiz: compiz N/A
version.libdrm2: libdrm2 2.4.107-8ubuntu1
version.libgl1-mesa-dri: libgl1-mesa-dri 21.2.2-1ubuntu1
version.libgl1-mesa-glx: libgl1-mesa-glx N/A
version.xserver-xorg-core: xserver-xorg-core 2:1.20.13-1ubuntu1
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev N/A
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:19.1.0-2build1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20200714-1ubuntu2
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.17-1build1

Revision history for this message
Norbert (nrbrtx) wrote :
Revision history for this message
Norbert (nrbrtx) wrote :

Also happens on Xubuntu.

Revision history for this message
Norbert (nrbrtx) wrote :

.xsession-errors from Xubuntu

Revision history for this message
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
http://iso.qa.ubuntu.com/qatracker/reports/bugs/1955135

tags: added: iso-testing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This particular bug has already been reported and is a duplicate of bug 1922414, so it is being marked as such. Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug. Additionally, any further discussion regarding the bug should occur in the other report. Feel free to continue to report any other bugs you may find.

Revision history for this message
Norbert (nrbrtx) wrote :

Still happens on UM Jammy.

How Long?????

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

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

Changed in dbus (Ubuntu):
status: New → Confirmed
Changed in xorg (Ubuntu):
status: New → Confirmed
Revision history for this message
Boris Steiner (boris-steiner) wrote (last edit ):

This issue is caused by lightdm running /usr/sbin/lightdm-session instead of /etc/X11/Xsession.

The simplest workaround for me was:
- introduce has_option functon as 1st step in Xsession.d sourced scripts
- as root create file /etc/X11/Xsession.d/01custom-has-option with following content:

OPTIONS="$(
  if [ -r "$OPTIONFILE" ]; then
    cat "$OPTIONFILE"
  fi
  if [ -d /etc/X11/Xsession.options.d ]; then
    run-parts --list --regex '\.conf$' /etc/X11/Xsession.options.d | xargs -d '\n' cat
  fi
)"

#check if has_option is already defined; if not, define

has_option 2>1 > /dev/null || has_option() {
  # Ensure that a later no-foo overrides an earlier foo
  if [ "$(echo "$OPTIONS" | grep -Eo "^(no-)?$1\>" | tail -n 1)" = "$1" ]; then
    return 0
  else
    return 1
  fi
}

- logout and login

Details:
- /etc/X11/Xsession introduces has_option shell function that check if Xsession.options contains predefined option
- /etc/X11/Xsession sources all files under /etc/X11/Xsession.d in alphabetic order
- as the scripts are sourced they maintain the same environemnt and definitions of variables or functions as Xsession
- however, lightdm uses lightdm-session that also sources /etc/X11/Xsession.d/* BUT does NOT define has_option function
- provided script checks if the function has_option already exists (Xsession is in play) and if not (lightdm-session's game) it defines it the same way as is in /etc/X11/Xsession

Alternative solutions:
- modify lightdm-session to contain has_option the same way as /etc/X11/Xsession
- modify (create) /etc/lightdm/lightdm.conf containing:
[Seat:*]
session-wrapper=/etc/X11/Xsession

- requires reboot; it did not work ok for 100% as my .profile env vars were not correctly propagated

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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