I may have broken my X configuration when I was messing around with VFIO passthrough, but I've been living with this issue for so long that I honestly don't recall. Regardless, here's what happens:
1. Boot machine
2. Log in
3. startx
4. Black screen, nothing works
5. Switch to TTY2, killall xinit
6. Back on TTY1, startx again
7. Success
I'm sick of doing this every time I start my system, I can't figure it out on my own, and I can't find anyone else with the same issue. Any help is greatly appreciated. At the time of writing, it's very late here and I've been wrestling with this for hours. Making this post is my last resort, so I will be going to bed and won't be able to respond until tomorrow.
Logfile from ~/.local/share/xorg: https://paste.artixlinux.org/ac15b1c7
.xinitrc: https://paste.artixlinux.org/d5468953
can't you install and start lightdm? Also a good thing to try is to delete all X's files and reinstall it.
Other than your workaround you don't mention what you've tried to fix it. So this thread could end up being a succession of
"Try this"
"Already tried that"
I'd take it back to basics. try a simpler ~/.xinitrc or override it as described here https://wiki.archlinux.org/title/Xinit#Override_xinitrc
The last command in your ~/.xinitrc is
exec dwm > ~/.local/share/dwm/dwm.log
Have you checked for errors in dwm.log after a failed start ?
Have you compared this log(cleaned, empty) between a failed and successful start ?
Can we get both versions of your Xorg logfile, one from the failed attempt and one from when startx succeeds?
Also I get a syntax error from dry running your xinitrc script:
d5468953.txt: 45: Syntax error: word unexpected (expecting "do")
I did some digging and your xinitrc file is litered with CTRL+m keycodes for some reason, try cleaning it with sed and then try it with startx because after cleaning it I didn't get any syntax error
In addition I agree with gripped to going back to basics, just try an xinitrc with only dwm and see if it works