startkde $DISPLAY is not set or cannot connect to the X server


if you are not be able to login and you are stuck in kdm lightdm window this can be helpfull for you :

there are a lots of issues that can develop this situation in your machine so i will list them here :

these are really funny but i had even this situation😀

-no space left in /var
-no space left in /
-no space left in /home
-no plasma-desktop or plasmashell installed

these instead are really normal

-bad video driver installed
-bad xorg manually configurated
-bad init file

i guess these are the most frequent issues so let’s try to find out which one is your issue

FIRST STEP PREPARE THE TERMINAL TO TEST YOUR MACHINE

try to start another konsole session being freezed on kdm window pressing these keys :

ctrl alt f3

PS : ctrl alt f7 it’s the normal session … so if you need to go back just do that.
before everything if you are a little skilled user you could try to see the x log file with this

fgrep '(EE)' /var/log/Xorg.0.log

but if you are not a skilled user…🙂 we will start with some weird errors like this

CHECK IF PLASMA-DESKTOP IS INSTALLED

sometime plasma-desktop is not installed so …

run this command :

type plasma-desktop
type plasmashell

if both are empty then you have not plasma installed😀 , so … if you have not plasma-desktop installed well install it🙂

(sudo apt-get install plasma-desktop # or similar )

try to login from the console and try to start kde with:

startkde

of nothing happen and you get stuck just do again CTRL ALT F4 or just use again the terminal

CHECK IF YOUR KDE CONFIGURATION HAS SOMETHING OF STRANGE

this code will start kwin without 3d effects … and start system settigns … so you can disable desktop effects … this is not a good stuff i mean it should work and it could be a problem with your video drivers …or it could be just a wrong configuration that you have tried not compatible with your drivers .

DISPLAY=:0 && KWIN_COMPOSE=N kwin --replace& systemsettings & echo

another test that you could try it’s to rename or maybe mv the kde configs folder

Maybe you don’t remember but you could have done something to kde configs so try to rename your ~/.kde , in some distro ~/.kde4 ,now try again

mv ~/.kde ~/.kdeOLD

or

mv ~/.kde4 ~/.kdeOLD

again

try to login from the console and try to start kde with:

startkde

if even with a new configs it doesn’t start … you have system bad configs or bad driver … if says

$DISPLAY is not set or cannot connect to the X server

try to set DISPLAY:0.0 in this way :

export DISPLAY=:0.0 ; startx

if it fails

CHECK XINITRC FILE

in my case i had a bad xinitrc so i have edited this file :

sudo nano /etc/X11/xinit/xinitrc

added this line

exec startkde

pressed CRTL X and saved …

to the terminal :
startx

and bam kde was back again, If it fails :

CHECK IF X CAN STARTS ITSELF PROPERLY WITHOUT KDE

make sure you have twm installed xterm and xclock

if kde doesn’t start try to see if at least X can run with another stuff , disable exec startkde putting # before put this shit on xinitrc

# exec startkde
# start some nice programs

twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login

you should see something like this , it’s not the same but it looks like this

xclock

if you can see xterm and xclock just type exit and press enter to exit. X is installed properly and the video driver should work fine.

CHECK IF YOU HAVE INSTALLED PROPERLY YOUR VIDEO DRIVER

here i can’t help you because it depends on your video card . To get your video card you can try this

lspci | grep -i vga

i got an ati so i need to :

ATI

sudo apt-get install --reinstall xserver-xorg-video-ati xserver-xorg-core xserver-xorg

if you have another video card you need to replace xserver-xorg-video-ati with one of these :

xserver-xorg-video-nouveau
xserver-xorg-video-intel
xserver-xorg-video-sis

SPACE LEFT SITUATION

as i said before you could have some problem of space , yeah! if you have not enough space in your haddrive kde could even not start … so …

to check this funny stuff you need to use this command line i have excluded HOME because normally it’s the biggest folder in my partition table but anyway if you have 1 partition only you can just remove that option from this command line

cd /; du --block-size=M --max-depth=1 --exclude=home --exclude=archivio --exclude=proc 2>/dev/null | sort -n

it will print a list like this :

2M ./.kde
3M ./oldkde
4M ./Lightworks
5M ./logs
111M ./.mozilla
111M ./.thumbnails
146M ./.q3a
390M ./.config
556M ./.local
1034M ./bin
1389M ./.cache
1404M ./VirtualBox VMs
5159M .

check the biggest folder and remove your stuff tipically you can remove safely /var/tmp/stuff or maybe you can just try to it to another harddrive just to be sure to not lose datas… but they should be only temp-files i had this issue one time for example for a bug in kde …

hope it will help you to start kde again🙂

trick

start kwin without compisition

KWIN_COMPOSE=N kwin --replace

9 Responses to startkde $DISPLAY is not set or cannot connect to the X server

  1. Getashell says:

    Wow this is amazing way to find an error with X. Thanks and i hope you keep post your knowledge.

    It was solves my problem modifing /etc/X11X/xinit/xinitrc and ~/.xinitrc like you said and testing comment Xterm XClock lines and adding exec startkde.

    Regards!

  2. Man you saved me🙂 that rox !!
    thanks for your help

  3. chriscurrin says:

    May I add in that my problem was the compositor and fixed by changing from OpenGL to XRender as in http://askubuntu.com/questions/620838/hardware-rendering-issues-with-nvidia-304-in-kubuntu-15-04
    Hopefully for others this will help!

  4. Pingback: Cannot start KDE in Fedora 22 | Asking

  5. Radek says:

    Saved my day!

  6. Micheal C says:

    got KDE working by using
    sudo enter-chroot
    xinit
    startkde

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: