Zend certified PHP/Magento developer

PC freezes randomly in Windows and Ubuntu, video keeps playing, mouse and keyboard input is ignored

PC starts ignoring mouse and keyboard once per day – it is not a total freeze, because the video keeps playing – the PC is used only to play YouTube, nothing else.

PC is a few years old, it has Intel Pentium 8505 and 8 GB of RAM and a 128 GB SSD, no graphic card, a 400W LG power supply, a wired PS2 keyboard, a wired USB mouse.

The same problem happens in Windows 10 and in Ubuntu.

The same problem happens if I disconnect the SSD from the motherboard and start it with a live Linux from USB.

One pass of MemTest86 reported no problems with RAM.

What else can I test?