rvp
ps aux shows:
root 1770 0,0 0,1 81612 10244 ? Ss 12:25du. 0:00.06 /usr/X11R7/bin/xterm -class UXTerm
root 1969 0,0 0,4 281672 69976 ? S<l 12:25du. 0:01.24 /usr/X11R7/bin/X :0 -noretro -auth /root/.serverauth.1580
fstat -p $(pgrep X) says:
fstat: stat(1770): No such file or directory
fstat: stat(1969): No such file or directory
However, fstat -p 1969 shows:
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root X 1969 wd / 24258560 drwxr-xr-x 1536 r
root X 1969 0 / 4380680 crw------- constty rw
root X 1969 1 / 4380680 crw------- constty rw
root X 1969 2 / 4380680 crw------- constty rw
root X 1969 3 / 35563701 -rw-r--r-- 25817 w
root X 1969 4* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 5* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 6 / 4382449 crw-r----- pci0 rw
root X 1969 7 / 4382450 crw-r----- pci1 rw
root X 1969 8 / 4382451 crw-r----- pci2 rw
root X 1969 9 / 4382452 crw-r----- pci3 rw
root X 1969 10 / 4382453 crw-r----- pci4 rw
root X 1969 11 / 4382454 crw-r----- pci5 rw
root X 1969 12 / 4382455 crw-r----- pci6 rw
root X 1969 13 / 4382456 crw-r----- pci7 rw
root X 1969 14 / 4382457 crw-r----- pci8 rw
root X 1969 15 / 4382458 crw-r----- pci9 rw
root X 1969 16 / 4382459 crw-r----- pci10 rw
root X 1969 17 / 4382460 crw-r----- pci11 rw
root X 1969 18 / 4383208 crw-r----- pci12 rw
root X 1969 19 / 4383209 crw-r----- pci13 rw
root X 1969 20 / 4380683 crw-r----- mem rw
root X 1969 21 / 4380696 crw------- ttyE1 rw
root X 1969 22* misc ops=0xffffffff815d6f40 0xfffffcc5f8de0e48
root X 1969 23* misc ops=0xffffffff815d6f40 0xfffffcc5f8de0e48
root X 1969 24 / 4380695 crw------- ttyE0 rw
root X 1969 25* misc ops=0xffffffff815d6f40 0xfffffcc5f8de0e48
root X 1969 26* misc ops=0xffffffff815d6f40 0xfffffcc5f8de0e48
root X 1969 27* misc ops=0xffffffff815d6f40 0xfffffcc5f8de0e48
root X 1969 28* misc ops=0xffffffff815d6f40 0xfffffcc5f8de0e48
root X 1969 29* pipe 0xfffffcc5f7b04700 <- 0xfffffcc5f7a65038 rn
root X 1969 30* pipe 0xfffffcc5f7a65038 -> 0xfffffcc5f7b04700 w
root X 1969 31* pipe 0xfffffcc5f7b04320 <- 0xfffffcc5f7a65418 rn
root X 1969 32* pipe 0xfffffcc5f7a65418 -> 0xfffffcc5f7b04320 w
root X 1969 33 / 4380743 crw------- wsmux0 rw
root X 1969 34* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 35* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 36* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 37* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 38* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 39* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 40* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 41* unix stream <-> /tmp/.X11-unix/X0 [creat]
root X 1969 42* unix stream <-> /tmp/.X11-unix/X0 [creat]
ls -l /dev/dri output is:
crw-r----- 1 root wheel 180, 0 Jun 6 12:25 card0
crw-rw---- 1 root wheel 180, 128 Apr 5 23:22 renderD128
crw-rw---- 1 root wheel 180, 129 Apr 5 23:22 renderD129
crw-rw---- 1 root wheel 180, 130 Apr 5 23:22 renderD130
crw-rw---- 1 root wheel 180, 131 Apr 5 23:22 renderD131
Unfortunately, I don't know if any those are correct or not. Actually I'm starting to think that the problem is not that X can only run as root. Since I only started to experiment with root after X failed to start after using the system with amdgpu for a week or so. But now the same happens when logging in as root: after startx I get some garbage on the screen and the system hangs no matter how many times I restart it. What seems to help, is to boot with the original NetBSD 10 kernel which disables amdgpu by default, startx, then reboot with the same kernel but with amdgpu enabled and then startx works again. No clue what this magic is. Currently, I logged in as root and started x as root. I guess it'd work now as normal user too.
Concerning xhost, adding it to .xinitrc made the process hang so I added it to the root's .bash_profile like:
if xhost >& /dev/null ; then xhost + ; su -l r0ller; fi;
and added to r0ller's .bash_profile:
if [ -z "${DISPLAY}" ];then export DISPLAY=:0;fi;
This way, starting uxterm is opened as if r0ller logged in and can start any X app.
The whole system seems to work pretty strange though:
1) if I boot normally, amdgpu cannot kick in and hangs the boot process. But when booting into single user first, reboot and then boot as normal user only then it gets to the login (not xdm).
2) The other strange thing I noticed is that ACPI seems to work correctly when I boot into single user. At least, the poweroff command works only in that case. When booting normally, even if logged in as root, poweroff does not turn off the box only halts and prints something like press any key to reboot.