How to solve occasionally getting logged out and black screen appears. I can log into it but GUI doesn't show up only in terminal

Hi @avik, and welcome!

In addition to @brahma’s advice, please see:

Additionally, please provide the output of:

journalctl --boiot=-1 --no-pager --priority=3

Where the --boot argument is the number of boots ago this happened. So -1 for the previous boot, -2 for the one before that, and so on and so forth.

Edit:

So, we need more information. Please provide thee output of:

sudo inxi --admin --verbosity=7 --filter --no-host --width