Xsession.d errors - how to fix? line... has_option: command not found

Hi, @mate2go

From what I've searched, you've "hit" two Bugs that were reported by @Norbert_X in Launchpad, in December 2021, then for the "alpha" version of "Ubuntu MATE 22.04 LTS ("Ubuntu-MATE 22.04 LTS "Jammy Jellyfish" - Alpha amd64"):

  1. Bug #1955135 “multiple issues with /etc/X11/Xsession.d/ - “ "has_option: command not found" : Bugs : xorg package : Ubuntu :

https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1955135

  1. Bug #1955136 “/etc/X11/Xsession.d/75dbus_dbus-launch: line 9: has_option: command not found" ” : Bugs : dbus package : Ubuntu

https://bugs.launchpad.net/ubuntu/+source/dbus/+bug/1955136

I've also found that @Norbert_X has posted the following topic, about a month ago (on 22- June-2022), here in the "Ubuntu MATE Community" discussion forums:

In that discussion, Norbert wrote, regarding this issue, the following:

" (...) Three other bugs are 1922414 , 1955135 and 1955136 . They break normal Xsession initialization and fill the ~/.xsession-errors with the following error messages:

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

Local fix for for these 3 bugs can be applied by executing long command below to re-add missing has_option function:

cat <<\EOF | sudo tee /etc/X11/Xsession.d/20x11-add-hasoption
# temporary fix for LP# 1922414, 1955135 and 1955136 bugs
# read OPTIONFILE
OPTIONS=$(cat "$OPTIONFILE") || true

has_option() {
 if [ "${OPTIONS#*
$1}" != "$OPTIONS" ]; then
   return 0
 else
   return 1
 fi
}
EOF

and then reboot. This will allow ssh-agent to start and other necessary fixes.
Note: if you have any additional issues caused by adding above file - please feel free to remove it by sudo rm /etc/X11/Xsession.d/20x11-add-hasoption and inform me about this problem. (...)"

Based on some additional searches that I've done, what seems to me to be the root cause of this issue has been discussed in the following Debian bug, reported about 2 years ago (in June 2020) by Jan Rauberg:

#963059 - x11-common: false linebreak in 20x11-common_process-args function has_option - Debian Bug report logs
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=963059

... where Jan Rauberg wrote, among other things, the following,:

"(...) * What led up to the situation?
x2go session ignores .Xresource configuration.
There is a false linebreak in function 'has_option' of 20x11-common_process-args.
The lines

 if [ "${OPTIONS#*
$1}" != "$OPTIONS" ]; then

should be

if [ "${OPTIONS#*$1}" != "$OPTIONS" ]; then

Otherwise the function will not be executed and the option 'allow-user-resources'
could not be parsed correctly. As a result the .Xresources-x2go will not be merged in. (...)"

I hope this reply of mine is useful to you (@mate2go) and others :slight_smile: Please note, that I ("ricmarques" = Ricardo Dias Marques) am NOT a Developer of Ubuntu or Ubuntu MATE or Debian. I'm just another Ubuntu MATE user (currently using Ubuntu MATE 20.04 LTS = "Focal Fossa").

2 Likes