There can be various reason for the problem you are facing. Can you share the logs from /var/log/syslog
or /var/log/kern.log
and also check if your machine is having any error while the device is on by dmesg -T
Another thing can be your hardware. Maybe there are some hardware issues which may create issues like system crash, sudden hang, etc.
You can try to give more log report so that others can understand what's the issue exactly.
Option 1
Service Fail
There might be some services that are crashing/failing again, and again, which can be reason for system crash. You can check your services regarding the same.
Example:
systemctl list-units --type=service
Here you can see all the services that are failed or active.
Option 2
Hardware Fail
There might be some hardware which are not working properly like: CPU fan, Display Graphics, RAM etc. You can check it on your Dmesg
logs, it can be seen there if there is any hardware error as well as or erros like GPU hand or Segmentation fault etc.
Example:
dmesg -T
[Fri Jan 21 18:02:27 2022] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=20339577 end=20339578) time 439 us, min 2146, max 2159, scanline start 2136, end 2196
[Fri Jan 21 18:03:29 2022] [drm] Got external EDID base block and 1 extension from "edid/edid.bin" for connector "DP-1"
[Fri Jan 21 18:03:29 2022] [drm] Got external EDID base block and 1 extension from "edid/edid.bin" for connector "DP-1"
[Fri Jan 21 18:37:28 2022] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=20465675 end=20465676) time 417 us, min 2146, max 2159, scanline start 2144, end 2200
[Fri Jan 21 19:03:59 2022] [drm] Got external EDID base block and 1 extension from "edid/edid.bin" for connector "DP-1"
[Fri Jan 21 19:04:00 2022] [drm] Got external EDID base block and 1 extension from "edid/edid.bin" for connector "DP-1"
[Fri Jan 21 20:41:15 2022] i915 0000:00:02.0: GPU HANG: ecode 9:4:0xc86dffef, in vlc [1478503], hang on vcs0
[Fri Jan 21 20:41:15 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Fri Jan 21 21:03:04 2022] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=20989841 end=20989842) time 412 us, min 2146, max 2159, scanline start 2142, end 2198
[Fri Jan 21 22:13:11 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Fri Jan 21 22:43:59 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Fri Jan 21 23:49:47 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Sat Jan 22 01:00:43 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Sat Jan 22 03:39:16 2022] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=22416118 end=22416119) time 413 us, min 2146, max 2159, scanline start 2117, end 2173
[Sat Jan 22 06:05:57 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Sat Jan 22 06:51:33 2022] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=23108341 end=23108342) time 408 us, min 2146, max 2159, scanline start 2141, end 2196
[Sat Jan 22 08:01:12 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Sat Jan 22 08:36:01 2022] [drm:intel_pipe_update_end [i915]] *ERROR* Atomic update failure on pipe A (start=23484460 end=23484461) time 433 us, min 2146, max 2159, scanline start 2102, end 2160
[Sat Jan 22 10:06:46 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Sat Jan 22 10:10:56 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
[Sat Jan 22 11:44:18 2022] i915 0000:00:02.0: Resetting vcs0 for hang on vcs0
or harware error like
[Mon Feb 14 13:41:45 2022] evm: security.ima
[Mon Feb 14 13:41:45 2022] evm: security.capability
[Mon Feb 14 13:41:45 2022] evm: HMAC attrs: 0x1
[Mon Feb 14 13:41:45 2022] BERT: Error records from previous boot:
[Mon Feb 14 13:41:45 2022] [Hardware Error]: event severity: fatal
[Mon Feb 14 13:41:45 2022] [Hardware Error]: Error 0, type: fatal
[Mon Feb 14 13:41:45 2022] [Hardware Error]: section type: unknown, 81212a96-09ed-4996-9471-8d729c8e69ed
[Mon Feb 14 13:41:45 2022] [Hardware Error]: section length: 0x290
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000000: 00000001 00000000 00000000 00020002 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000010: 00020002 00000001 0000031d 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000020: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000030: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000040: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000050: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000060: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000070: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000080: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000090: 0012cf23 00000000 00000002 00000001 #...............
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 000000a0: 0000031d 00000000 00040000 000ffff8 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 000000b0: 000014a8 00000880 00000880 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 000000c0: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 000000d0: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 000000e0: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 000000f0: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000100: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000110: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000120: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000130: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000140: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000150: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000160: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000170: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000180: 00000000 00000000 00000000 00000000 ................
[Mon Feb 14 13:41:45 2022] [Hardware Error]: 00000190: 00000000 00000000 00000000 00000000 ................
Option 3
Reinstalling the OS
You can try to re-install the OS and check if you get the same issue. If 'Yes' then there might be a chance that there is a hardware issue.