# I cannot stop X



## unInstance (Oct 23, 2021)

The problem is I can start X with *startx*, but if I quit, the screen just goes black. I does not show TTY then.

I own a thinkpad t440p.
I run FreeBSD 12.2.
My Xorg log https://pastebin.com/LK8RpqNL
My /var/log/messages https://pastebin.com/51n3PH6L


----------



## grahamperrin@ (Oct 23, 2021)

unInstance said:


> … Xorg log …



`[   456.531] (II) Server terminated successfully (0). Closing log file.`

From which numbered tty do you start X?


----------



## unInstance (Oct 23, 2021)

grahamperrin said:


> `[   456.531] (II) Server terminated successfully (0). Closing log file.`
> 
> From which numbered tty do you start X?


TTY0


----------



## unInstance (Oct 23, 2021)

I use dwm. If I run X, then switch to the TTY I started it from, then I can press ^C to successfully close it. But, if I close it via the dwm shortcut, then I can see just a black screen with the mouse pointer and terminal cursor with no ability to switch TTY's.


----------



## grahamperrin@ (Oct 23, 2021)

unInstance said:


> TTY0



If you Control-Alt-F2 then Alt-F1, what's visible?


----------



## unInstance (Oct 23, 2021)

grahamperrin said:


> If you Control-Alt-F2 then Alt-F1, what's visible?


Nothing happens.
I believe this may be related to vt(4).


----------



## grahamperrin@ (Oct 23, 2021)

USB keyboard attached, or is that with the integral keyboard?


----------



## unInstance (Oct 23, 2021)

grahamperrin said:


> USB keyboard attached, or is that with the integral keyboard?


Both.


----------



## grahamperrin@ (Oct 23, 2021)

unInstance said:


> … /var/log/messages …



`… FreeBSD 12.2-RELEASE r366954 …`

Please update the OS.


----------



## unInstance (Oct 23, 2021)

grahamperrin said:


> `… FreeBSD 12.2-RELEASE r366954 …`
> 
> Please update the OS.


I did update to 12.2 p10, but it doesn't help. 13.0 does not even boot for me. 12.2 used to work just fine until I tried to update to 13.0


----------



## grahamperrin@ (Oct 23, 2021)

Thanks,



unInstance said:


> … 13.0 does not even boot for me.



– do you mean, the installer for 13.0-RELEASE?

Or did you ugprade, find difficulty then revert to a boot environment with 12.2-RELEASE⋯?

The superior OS allows superior DRM (for graphics). It will be good to know exactly what happened when boot failed. A photograph, if you like. A separate topic for 13.0-RELEASE⋯



unInstance said:


> 12.2 used to work just fine until I tried to update to 13.0



Try:

12.2-RELEASE-p10
create, activate then boot a new boot environment
without starting a desktop environment
`pkg upgrade -f`
reboot


----------



## unInstance (Oct 23, 2021)

grahamperrin said:


> Thanks,
> 
> 
> 
> ...


13 installation media panics on boot for the first time, then it boots fine if I just restart it. It is completely random.

Now I have a clean 12.2 install and this issue with X just happens for some reason.


----------



## Kaminar (Oct 23, 2021)

I have similar issues in 12.2-p10 with syscons. I recently upgraded packages, and since time X has often problem with shutdown.

If I quit E16, X will hang for a few seconds. The console appears, but it's frozen. I have to switch to another console and then back. When I switch back to the first console, the console is normal again and message is on the screen that X server shutdowning is slow and must be killed.

In the X log is nothing special.


----------



## grahamperrin@ (Oct 23, 2021)

Kaminar said:


> 𡀦… similar … X has often problem with shutdown. …



As far as I can tell, no such problem in this case; see comment 2.



Kaminar said:


> 𡀦… switch to another console and then back. 𡀦…



I sometimes find that necessary, but it's not specific to 12⋯.

See for example <https://forums.freebsd.org/posts/535902>.


----------



## grahamperrin@ (Nov 1, 2021)

Cross-reference FreeBSD bug 259402 – x11-servers/xorg-server: stopping X makes system unresponsive


----------



## grahamperrin@ (Mar 23, 2022)

unInstance said:


> I cannot stop X … I can start X with *startx*, but if I quit, the screen just goes black. I does not show TTY then. …



I sometimes have what might be the same bug:

it _appears_ that the X session does not end, because (for example) `ttyv0` does not appear
contrary to appearances, the X session *did* end
there's a graphics issue – like, a remnant of closure of the X session
no response to HID (keyboards, trackball, and trackpad)
a simple, short press on the power button results in a clean shutdown of the operating system, and power off.
– I have `hw.acpi.power_button_state="S5"` in my sysctl.conf(5).

A recent example

Using the most recent beadm (not yet in the ports collection):



Spoiler: ./beadm reroot n253861-92e6b4712b5-b





```
% cd ~/dev/beadm
% git pull
Already up to date.
% ./beadm list
BE                    Active Mountpoint  Space Created
n250511-5f73b3338ee-d -      -            4.9G 2021-11-13 15:43
n252381-75d20a5e386-b -      -            6.8G 2022-01-12 23:23
n252450-5efa7281a79-a -      -            6.5G 2022-01-14 19:27
n252483-c8f8299a230-b -      -            4.8G 2022-01-17 14:24
n252505-cc68614da82-a -      -            4.9G 2022-01-18 14:26
n252531-0ce7909cd0b-h -      -            5.7G 2022-02-06 12:24
n252997-b6724f7004c-c -      -            6.2G 2022-02-11 23:07
n253116-39a36707bd3-e -      -            5.7G 2022-02-20 07:03
n253343-9835900cb95-c -      -            1.5G 2022-02-27 14:58
n253627-25375b1415f-e -      -          463.9M 2022-03-12 18:20
n253776-d5ad1713cc3-a -      -          244.0M 2022-03-14 23:40
n253776-d5ad1713cc3-b -      -          668.5M 2022-03-18 09:31
n253861-92e6b4712b5-a NR     /          163.6G 2022-03-19 07:40
% du -hs /var/cache/pkg
274M    /var/cache/pkg
% su -
Password:
root@mowa219-gjp4-8570p-freebsd:~ # pkg clean -a --quiet --yes
root@mowa219-gjp4-8570p-freebsd:~ # pkg autoremove
Checking integrity... done (0 conflicting)
Nothing to do.
root@mowa219-gjp4-8570p-freebsd:~ # bectl destroy -o n253776-d5ad1713cc3-a
root@mowa219-gjp4-8570p-freebsd:~ # cd /usr/home/grahamperrin/dev/beadm
root@mowa219-gjp4-8570p-freebsd:/usr/home/grahamperrin/dev/beadm # ./beadm create n253861-92e6b4712b5-b
Created successfully
root@mowa219-gjp4-8570p-freebsd:/usr/home/grahamperrin/dev/beadm # ./beadm mount n253861-92e6b4712b5-b /tmp/up
Mounted successfully on '/tmp/up'
root@mowa219-gjp4-8570p-freebsd:/usr/home/grahamperrin/dev/beadm # chroot /tmp/up
root@mowa219-gjp4-8570p-freebsd:/ # sysrc sddm_enable="NO"
sddm_enable: YES -> NO
root@mowa219-gjp4-8570p-freebsd:/ # pkg upgrade --fetch-only -r FreeBSD --quiet --yes
root@mowa219-gjp4-8570p-freebsd:/ # du -hs /var/cache/pkg
472M    /var/cache/pkg
root@mowa219-gjp4-8570p-freebsd:/ # exit
exit
root@mowa219-gjp4-8570p-freebsd:/usr/home/grahamperrin/dev/beadm # ./beadm umount n253861-92e6b4712b5-b
Unmounted successfully
root@mowa219-gjp4-8570p-freebsd:/usr/home/grahamperrin/dev/beadm # history -S && ./beadm reroot n253861-92e6b4712b5-b
```




I ran the commands in Konsole whilst using KDE Plasma, saved them to a file (2022-03-21-12-44 Konsole output.txt) at 12:44 before entering the final command.
The _visible_ result, photographed at 12:50:



Logged:



Spoiler: an extract from /var/log/messages





```
Mar 21 12:34:49 mowa219-gjp4-8570p-freebsd su[85461]: grahamperrin to root on /dev/pts/4
Mar 21 12:36:53 mowa219-gjp4-8570p-freebsd su[85697]: grahamperrin to root on /dev/pts/4
Mar 21 12:45:01 mowa219-gjp4-8570p-freebsd reroot[86555]: rerooted by grahamperrin
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-WARNING: instance of invalid non-instantiatable type '(null)'
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-CRITICAL: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd kernel: Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-CRITICAL: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-WARNING: instance of invalid non-instantiatable type '(null)'
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-CRITICAL: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-WARNING: instance of invalid non-instantiatable type '(null)'
Mar 21 12:45:05 mowa219-gjp4-8570p-freebsd console-kit-daemon[67388]: GLib-GObject-CRITICAL: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Mar 21 12:45:09 mowa219-gjp4-8570p-freebsd kernel: pid 68112 (recollindex), jid 0, uid 1002: exited on signal 6
Mar 21 12:45:10 mowa219-gjp4-8570p-freebsd kernel: [drm ERROR :btc_dpm_set_power_state] rv770_restrict_performance_levels_before_switch failed
Mar 21 12:45:18 mowa219-gjp4-8570p-freebsd devd[66846]: notify_clients: send() failed; dropping unresponsive client
Mar 21 12:45:37 mowa219-gjp4-8570p-freebsd kernel: , 67293 67294
Mar 21 12:45:49 mowa219-gjp4-8570p-freebsd syslogd: last message repeated 4 times
Mar 21 12:45:51 mowa219-gjp4-8570p-freebsd kernel:
Mar 21 12:45:51 mowa219-gjp4-8570p-freebsd kernel: pid 67588 (gammy), jid 0, uid 1002: exited on signal 6 (core dumped)
Mar 21 12:45:54 mowa219-gjp4-8570p-freebsd kernel: .
Mar 21 12:45:54 mowa219-gjp4-8570p-freebsd syslogd: last message repeated 1 times
Mar 21 12:45:59 mowa219-gjp4-8570p-freebsd devd[66846]: notify_clients: send() failed; dropping unresponsive client
Mar 21 12:45:59 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI: Device ada0p2.eli destroyed.
Mar 21 12:45:59 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI: Detached ada0p2.eli on last close.
Mar 21 12:45:59 mowa219-gjp4-8570p-freebsd devd[66846]: notify_clients: send() failed; dropping unresponsive client
Mar 21 12:45:59 mowa219-gjp4-8570p-freebsd ntpd[67187]: ntpd exiting on signal 15 (Terminated)
Mar 21 12:45:59 mowa219-gjp4-8570p-freebsd kernel: .
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd syslogd: kernel boot file is /boot/kernel/kernel
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel: Trying to mount root from zfs:august/ROOT/n253861-92e6b4712b5-b []...
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel: CPU: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz (2893.43-MHz K8-class CPU)
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   Origin="GenuineIntel"  Id=0x306a9  Family=0x6  Model=0x3a  Stepping=9
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   Features2=0x7fbae3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   AMD Features2=0x1<LAHF>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   Structured Extended Features=0x281<FSGSBASE,SMEP,ERMS>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   Structured Extended Features3=0x9c000400<MD_CLEAR,IBPB,STIBP,L1DFL,SSBD>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   XSAVE Features=0x1<XSAVEOPT>
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
Mar 21 12:46:10 mowa219-gjp4-8570p-freebsd kernel:   TSC: P-state invariant, performance statistics
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd kernel: .
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI: Device ada0p2.eli created.
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI: Encryption: AES-XTS 128
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI:     Crypto: accelerated software
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: ntpd 4.2.8p15-a (8): Starting
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: Command line: /usr/sbin/ntpd -p /var/db/ntp/ntpd.pid -c /etc/ntp.conf -f /var/db/ntp/ntpd.drift -g
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: ----------------------------------------------------
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: ntp-4 is maintained by Network Time Foundation,
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: Inc. (NTF), a non-profit 501(c)(3) public-benefit
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: corporation.  Support and training for ntp-4 are
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: available at https://www.nwtime.org/support
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87789]: ----------------------------------------------------
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87790]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): good hash signature
Mar 21 12:46:11 mowa219-gjp4-8570p-freebsd ntpd[87790]: leapsecond file ('/var/db/ntpd.leap-seconds.list'): loaded, expire=2022-12-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
Mar 21 12:46:12 mowa219-gjp4-8570p-freebsd xrdp-sesman[87843]: [WARN ] receiving SIGHUP 1
Mar 21 12:51:02 mowa219-gjp4-8570p-freebsd kernel: , 87876.
Mar 21 12:51:02 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI: Device ada0p2.eli destroyed.
Mar 21 12:51:02 mowa219-gjp4-8570p-freebsd kernel: GEOM_ELI: Detached ada0p2.eli on last close.
Mar 21 12:51:02 mowa219-gjp4-8570p-freebsd ntpd[87790]: ntpd exiting on signal 15 (Terminated)
Mar 21 12:51:02 mowa219-gjp4-8570p-freebsd kernel: .
Mar 21 12:51:03 mowa219-gjp4-8570p-freebsd syslogd: exiting on signal 15
```




a successful `reroot` beginning at 12:45:01
mount root at 12:46:10
power button around 12:51 (after taking the photograph).
<https://bsd-hardware.info/?probe=e9f59e748e>


vermaden above, for your information; a bug that might coincide with use of the `reroot` feature. As far as I can tell, only if the command is issued: 

whilst a display manager (e.g. SDDM) runs; or 
during an X session, even if the command is in a different `tty`.


----------



## grahamperrin@ (Mar 23, 2022)

Additional context:



grahamperrin said:


> there's a graphics issue – like, a remnant of closure of the X session



Sometimes after logging out from Plasma, I'll leave SDDM at `ttyv8` then (Control-Alt-F2) run commands as root at `ttyv1`. In this situation, it's normal to get `ttyv0` on screen after commands such as `service sddm stop` or shutdown now. If I recall correctly: sometimes, I do *not* get `ttyv0`:

again, it's like a *remnant* (but not visibly an X session)
– and it's necessary to press the power button.


Overall, this smells like an issue with (or affecting) DRM. I'll have a chat with someone outside the forums.


----------



## vermaden (Mar 24, 2022)

grahamperrin said:


> (...)
> 
> vermaden above, for your information; a bug that might coincide with use of the `reroot` feature. As far as I can tell, only if the command is issued:
> 
> ...


I would suspect a problem with DRM and/or Radeon graphics here.

Can you do that test:
- disable loading of all *drm/amd/radeon/graphics* modules at boot
- disable the X11 display manager (*sddm* on your side?)
- do that test in plain text console (with *beadm reroot*)

Thanks.


----------



## grahamperrin@ (Mar 24, 2022)

Keyword: 



grahamperrin said:


> sometimes



Unfortunately, the symptoms are not (are nowhere near) consistently reproducible. 


vermaden thanks, I previously used `beadm reroot ⋯` a few times at a `tty`, after logging out from Plasma. Also (throwing caution to the wind) a few times in Konsole, whilst using Plasma. In all cases except the one above, reroot succeeded. 

When run successfully from within Plasma, for me, the desktop environment disappears for a while, `ttyv0` does not become visible at any point. This seems proper. 

In my cases: radeonkms (from the probe above: <https://bsd-hardware.info/?probe=e9f59e748e#pci:1002-6841-103c-17a9>, <https://bsd-hardware.info/?probe=e9f59e748e&log=kldstat>). 

Opening post: Intel graphics. unInstance are you on `12.3-RELEASE-p4`, or have you progressed to `13.⋯`?


----------

