I asked a question about this last year but decided then to just put up with it but its now getting intolerable so I wanted to finally sort this out and hopefully that might help someone else in my position in the future.
I have two kernels installed on my machine - the LTS and non LTS. I always default to the non LTS version and most of the time, it worked find but around 1 in 20 boots I would find that I would turn my machine on and I would be greeted with a black screen where I should be seeing BSPWM. Usually it was ok as I would reboot and run the LTS kernel and it would work fine.
Now since I have updated my machine (I do it every few months) I get the black screen every time on both kernels 99% of the time and I have to keep rebooting until the desktop shows again so its almost unusable at the moment.
Symptoms:
Black screen with working mouse
BSPWM is running as I can use mod+enter to open a terminal, the mouse changes and I can type as normal but I can’t see anything
Wallpaper isn’t visible
Polybar is not visible
If I type sudo pkill Xorg, I get taken to the login screen and can actually see that but when I log back in, im blind again.
Pressing Ctrl-Alt-F4 brings up TTY and I can control my computer that way. I used that to install AwesomeWM and I3wm and I can log in using those but the terminal doesn’t seem to be using any of my configuration from my .zshrc
When I type startx from TTY I can see a wallpaper but not Polybar and a terminal can be seen but in its default, non config setting. If I run something like a browser a window shows up but it looks awful, like the GPU can’t render it.
Machine Specs:
Dell XPS 7590
Intel UHD graphics 630 - built in GPU
Nvidia GeForce GTX 1650 mobile
I am actually typing this out now from a working BSPWM reboot with my laptop working as it should but I know if I restart I will be back to a black screen again. Its very strange. Sometimes it works, most of the time it doesn’t now.
I wonder if its a GPU issue but I don’t have a solid reason to think that. Is it possible to ‘switch’ between the cards or ask the system which one is in use?
I’m sorry for the wall of text about this, please let me know if you need me to explain in more detail about the issues
I’m not sure I understand this correctly. Do you mean to say that everything would return to normal at some point if you keep rebooting?
What mechanism do you use to set your wallpaper? feh? I assume you aren’t using any Desktop Environment, just a window manager.
What if you launch polybar directly from the terminal? Does it launch? If it doesn’t, what error messages does it display?
If polybar launches fine from the terminal, it is possible that bspwm was not launched with your custom configurations at ~/.config/bspwm/bspwmrc(the file where you put the code to launch start up applications, set your wallpaper, define your key-bindings, etc.) and was instead launched with the default configs somewhere inside the /etc/ directory.
Post the contents of your .xinitrc
Once every few months? Please don’t take this the wrong way, but are you sure you should be using an Arch-based distro at all?
In any case, make sure you follow the instructions in bwpsm’s wiki to properly configure your window manager.
Your ~/.config/bspwm/bspwmrc needs to be executable, so if it isn’t, then chmod +x ~/.config/bspwm/bspwmrc
Update:
While you’re at it, you might as well also post the contents of your ~/.config/bspwm/bspwmrc
Yes exactly. The black screen used to be rare but now its almost every reboot. When it boots correctly with BSPWM/Polybar its completely fine.
Yes, just BSPWM. I installed I3 and Awesome through TTY and they ‘work’ in that I can see things but the terminal is completely default.
I have tried that and nothing appears. Its possible that there could be errors but I can’t see them. I know BSPWM is working in the background though because I can open a terminal and type something like shutdown now and it works.
Here is the xinitrc from /etc/X11/xinit: (I don’t have one in my home directory)
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login
No, you’re right - I really should be more careful. I have two machines - a desktop that I update nearly every day and my laptop(the one with this issue) that I only use for an hour or so every other day or so hence it not being that up to date.
Thank you for taking the time to help me out, I really appreciate it
@anthony93 is correct - if you can get a terminal up, the fault is in your .bspwmrc. You need to bisect it and try and find the problem. What are you using to set the wallpaper??
I saw in your bspwmrc that polybar is launched via a shell script. Run that launch.sh script in your terminal and see what happens. My conjecture is that that shell script failed to do its job somehow. It might be helpful to post the contents of that shell script.
Another conjecture regarding the missing wallpaper. I’m not entirely sure how nitrogen works, but judging from the --restore flag, I’m guessing the actual wallpaper file is cached somewhere so that it can be reloaded upon subsequent sessions. That cached image could be missing, maybe that’s why the wallpaper wasn’t loaded. Another possiblity is like @xircon suggested. The command nitrogen --restore & failed, in which case it would help to know the error messages to know exactly what went wrong.
If you want, you can try to set your wallpaper with feh to see if it works.
Here is the contents of the shell script in .config/polybar/:
#!/usr/bin/env bash
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar
polybar top -c ~/.config/polybar/config.ini &
Nitrogen wise, everything seems normal. I have checked that the files are there in /usr/share/endeavouros/backgrounds and they are.
I have looked up nitrogen logs errors and I can’t seem to find any.
Nothing visibly happens. It maybe happening but I can’t see anything to veryify it. Its strange because its definately working in some form because if I use mod+enter to open a terminal, the mouse moves to the new ‘active’ window and typing works.
I have noticed that sometimes if I run sudo pkill Xorg to look out from the black screen then for a brief second the black screen disappears and I can see the wallpaper for a split second before seeing the login screen. The login screen always works by the way.
Weirdly, I’m replying to you from one of the ‘successful’ reboots
I have notice sometimes there are visual graphical errors on the screen. Might be unrelated but I will post a picture in the next reply.
I dont get any visible error messages but thats the thing, they maybe there but I cant see them. All I can see is the mouse (which I can move) and I can open a terminal using mod+enter and the mouse moves focus to the new window. I can type but I cant see anything that was pressed
Since you didn’t define your own .xinitrc, using startx will not launch BSPWM because the default /etc/X11/xinit will be used and there is no exec bspwm line inside that file.
On that note, how do you typically start your X server? Are you using a display manager like sddm or lightdm?
I have copied xinitrc from the default location to /home/.xinitrc and just added exec bspwm to the bottom of it. I restarted but it didn’t do anything different and I still get the black screen.
I’m using lightdm. Actually most of the settings are the default EndeavourOS settings ‘out of the box’. I have only really changed cosmetic things like the colors of polybar for example.
I have also tried running startx & bspwm from tty. What happens then is I get to a desktop and 3 default windows of xterm are on the screen. I either use Kitty or Wezterm so its almost as if an init file isn’t being called.
Again though, on some startups its 100% fine so its a tough one to work out.
If you are using a display manager like lightdm, chances are that .xinitrc isn’t involved in starting your X server at all. .xinitrc is only sourced when you launch X server manually with startx.
This is exactly what the code inside /etc/X11/xinit does when you ran startx. In other words, when you use startx, /etc/X11/xinit was read. This could be due to the fact that you didn’t place the .xinitrc file in the correct location.
This is not the correct location. The file needs to be inside your home directory.
That’s because when you are using lightdm, .xinitrc won’t be sourced at all. If I’m not mistaken, it is .xprofile that will be sourced.
I’m sorry, when I wrote that I meant $HOME/.xinitrc - I should have paid more attention to it
Thank you for explaining to me how the process works with lightdm and xinit - I didn’t realize they worked that way and am a bit of a noob with that process.
Interestingly, I tried suggestions from @Shjim - I disabled lines these from .xinitrc:
along with dex and picom from the bspwm config and I can now login and see things consistently so the laptop is in a ‘workable/usable’ state so that I can debug things. I suspect the issue is GPU related because if I use xterm then that works as normal but if I use kitty or wezterm (both use GPU accelerated) then a window appears but the screen is black. The Falkon browser also doesn’t render at all but Firefox works fine (I haven’t tried a video yet though).
Additionally, when I try to run games that I have been developing I get no output but streams of nouveau errors.
I think there was something that changed for my in the linux 6.7 kernel because linux 6.6 didn’t have the issues.
I will start a fresh thread about the graphics issue and link to this post from there
Thank you for your suggestions - I followed them and now I can see actually see things on my laptop. Its not perfect but I am now actually able to try and work out what is going wrong with my machine.
It might be worth it to try the LTS kernel. If you are a noob like me, you can run akm from the welcome screen and install it and then just reboot and select it to boot into.