Debian doesn't start the GUI interface

I have a fresh installation of Debian (2 days), everything went fine until today. I turned on my machine, the login screen appeared, I entered my password, it was accepted and then I got a black screen and the login screen appeared again. This happens every time I restart my machine.

In order to make it launch the GUI I have to go launch a terminal CTRL+ALT+F5, log in there and run startx.

I am quite a noob when it comes to these things, I don’t know where to look for problems.

Some logs about the crash from the current user session that are generated with journalctl -b0 _UID=1000 | curl -F'file=@-' http://0x0.st can be found here.

Asked By: Filip Laurentiu

||

The problem is indicated by this line in your log:

Jun 06 16:19:57 filip-thinkstation /usr/libexec/gdm-x-session[3156]: /etc/gdm3/Xsession: Beginning session setup...
Jun 06 16:19:57 filip-thinkstation /usr/libexec/gdm-x-session[3156]: /etc/gdm3/Xsession: 14: /home/filip/.starkli/env: Syntax error: "(" unexpected (expecting "fi")

Or, more accurately, that’s a problem, and we’ll see if it is the problem after you test the following. The file /home/filip/.starkli/env, which you have kindly uploaded here, is:

#!/bin/sh

# Adds binary directory to PATH
case ":${PATH}:" in
  *:/home/filip/.starkli/bin:*)
    ;;
  *)
    export PATH="/home/filip/.starkli/bin:$PATH"
    ;;
esac

# Loads completions based on shell
if [ -n "$ZSH_NAME" ]; then
    fpath=(/home/filip/.starkli/share/zsh-completions $fpath)
    autoload -U compinit
    compinit
else
    case $SHELL in
        */bash)
            if [ -f "/home/filip/.starkli/share/bash-completions/starkli" ]; then
                . /home/filip/.starkli/share/bash-completions/starkli
            fi
            ;;
        */zsh)
            fpath=(/home/filip/.starkli/share/zsh-completions $fpath)
            autoload -U compinit
            compinit
            ;;
    esac
fi

That works fine in bash, but not in POSIX sh or, in the case of Debian, dash which is what is being used to run it. If you try with dash, you will get

/home/terdon/scripts/foo.sh: 14: Syntax error: "(" unexpected (expecting "fi")

Which is exactly what you are seeing. This is because dash doesn’t support arrays, so the line fpath=(/home/filip/.starkli/share/zsh-completions $fpath) which tries to add /home/filip/.starkli/share/zsh-completions to the zsh-specific $fpath array fails. I suspect the author assumed it would be OK since that is only executed if [ -n "$ZSH_NAME" ] is true, which should only be the case when running zsh, but forgot that it would fail before getting there because the line itself is a syntax error in POSIX sh.

So, you can try editing this file and simply changing #!/bin/sh on the first line to #!/bin/bash. It should work then.


The OP explained that this (changing the shebang) didn’t solve the issue, presumably because the script is being sourced in an existing dash session and not run independently so the shebang is ignored. However, after commenting out the line that was sourcing this script in their ~/.profile, that solved the issue.

Answered By: terdon
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.