Wednesday, June 26, 2024

KDE freezes while playing music and reading disk

I was experiencing strange freezes on Kubuntu. It started since upgrade to 23.04. It happens when PC works few hours with turned off monitor and it never happened with turned on monitor. I was using Pragha player. Also there may be extensive disk operations on background, etc. Freeze continued after upgrade to 24.04. Playback glitches and keyboard becomes unresponsive. Only hard reset helps.

I stopped using Pragha player – use VLC. Miracle happened – no freezes during past two weeks. How music player can freeze whole system? Best solution for audio - Audacious.

Still left annoying shit that should be eliminated: I regularly "loose files" when copying from mobile phone to NTFS drive both via Wi Fi and USB. Files simply disappear in destination folder. This error is fixed in Windows with chkdsk D: /f Also there are issues when canceling copy process to USB drive.

Another annoying crap is that sometimes KDE boots without sound with lagging start menu and slow disk read. Why such basic things suck on modern Linux? O_o

Most problems SOLVED by fresh install of 24.04 LTS but still sometimes screen won't turn from sleeping mode. Ctrl + Alt + F1 (F2) saves the day but... At least once I had problem with NTFS again. PC simply was frozen and needed chkdsk D: /f. Anyway LTS is better than rolling release.

sudo apt install ntfs-3g

lsmod | grep ntfs

findmnt -no FSTYPE /dev/sda1

ntfs3

echo "blacklist ntfs3" | sudo tee /etc/modprobe.d/disable-ntfs3.conf

sudo update-initramfs -u

findmnt -no FSTYPE /dev/sda1

fuseblk // You're using ntfs-3g, which shows up as fuseblk.

>>> Didn't help to solve freeze after display turn off. >>>

Screen Locking disabled in Workspace Behavior.

journalctl -b -1 >>> check logs from last boot

org.kde.powerdevil.backlighthelper.brightness failed

org.kde.powerdevil: ... a non-existent action

Disabling PowerDevil and will see how it goes:

systemctl --user mask plasma-powerdevil.service
Created symlink /home/user/.config/systemd/user/plasma-powerdevil.service → /dev/null.

nano /home/user/turn-off-display.sh

#!/bin/sh

xset +dpms

xset dpms 0 0 300

chmod +x ~/.xprofile

nano /home/user/.config/autostart/turn-off-display.desktop

[Desktop Entry]

Name=Turn Off Display

Type=Application

Exec=/home/user/turn-off-display.sh

X-KDE-autostart-enabled=true

To switch off monitor turn off >>> xset dpms 0 0 0

Monitor turn off in 10 sec >>> xset dpms 0 0 10

pci=noaer — Disable PCIe Advanced Error Reporting. Tells the kernel not to report (or respond to) PCIe bus errors. On some systems (especially AMD or older motherboards), AER floods logs and causes freezes.

Also added GRUB_CMDLINE_LINUX_DEFAULT="pci=noaer" in sudo nano /etc/default/grub

sudo update-grub

systemctl --user unmask plasma-powerdevil.service

Removed "/home/user/.config/systemd/user/plasma-powerdevil.service".
systemctl --user enable plasma-powerdevil.service
The unit files have no installation config (WantedBy=, RequiredBy=, UpheldBy=,
Also=, or Alias= settings in the [Install] section, and DefaultInstance= for
template units). This means they are not meant to be enabled or disabled using systemctl.
 
Possible reasons for having these kinds of units are:
• A unit may be statically enabled by being symlinked from another unit's
 .wants/, .requires/, or .upholds/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
 a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
 D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
 instance name specified.
systemctl --user start plasma-powerdevil.service
systemctl --user status plasma-powerdevil.service
plasma-powerdevil.service - Powerdevil
    Loaded: loaded (/usr/lib/systemd/user/plasma-powerdevil.service; static)
    Active: active (running) since Fri 2025-05-16 15:50:56 EEST; 7s ago
  Main PID: 5235 (org_kde_powerde)
     Tasks: 7 (limit: 38347)
    Memory: 6.6M (peak: 7.4M)
       CPU: 90ms
    CGroup: /user.slice/user-1000.slice/user@1000.service/background.slice/plasma-powerdevil.service
            └─5235 /usr/lib/x86_64-linux-gnu/libexec/org_kde_powerdevil


rm -r .cache/* // remove cache just in case

>>> Didn't help to solve freeze after display turn off. >>>


Disable Fast Startup in Windows 

Control Panel → Power Options → Choose what the power buttons do

Click "Change settings that are currently unavailable"

Uncheck: ☑ Turn on fast startup (recommended). If unavailable > cmd as Admin > powercfg /hibernate on. Save and fully shut down Windows (not reboot) > shutdown /s /f /t 0

Make Windows Use UTC (not recommended)

regedit > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation

RealTimeIsUniversal > 1 => make Linux use local time instead =>

Make Linux Use Local Time (Matches Windows) > timedatectl set-local-rtc 1 --adjust-system-clock

🟢 Keep local time (easy) Dual-boot users who want clocks to match timedatectl set-local-rtc 1

🔵 Use UTC (clean) Single-boot Linux or advanced users timedatectl set-local-rtc 0


Finally I got freeze when working with AI with turned on display, etc. HDD stopped mounting. Switched off ntfs, as described above. Now HDD is seen correctly without 0 TB after mount. Will see how it goes. More than year passed since this shit started happening, lol

Kill Baloo if not needed. Never used in my case. Add this to ~/.config/baloofilerc:

[Basic Settings]

Indexing-Enabled=false

balooctl status

balooctl stop

balooctl disable

Performance gain: noticeable. Especially during login or when copying/moving files. 

Blacklisted VirtualBox kernel modules if not using it

echo "blacklist vboxdrv" | sudo tee /etc/modprobe.d/disable-vbox.conf

sudo update-initramfs -u

To re-enable VirtualBox kernel modules after blacklisting them with modprobe.d, just delete the blacklist file and update the initramfs again.

sudo rm /etc/modprobe.d/disable-vbox.conf

sudo update-initramfs -u

Load the modules manually (without rebooting). If you want to test immediately:

sudo modprobe vboxdrv

sudo modprobe vboxnetflt

sudo modprobe vboxnetadp

lsmod | grep vbox


journalctl --since "30 minutes ago" > journal_last_30min.txt

    At May 21 01:38:27, a kernel warning was triggered:

WARNING: CPU: 6 PID: 17 at kernel/rcu/rcu.h:111 rcu_gp_cleanup

This is a known issue related to RCU (Read-Copy-Update) logic in the kernel, which manages CPU synchronization and can deadlock under driver bugs or hardware stress. It escalated to:

watchdog: BUG: soft lockup - CPU#7 stuck for 26s!

rcu_preempt self-detected stall on CPU

Affected components:

    NVIDIA proprietary driver (nvidia_uvm, nvidia_drm, nvidia_modeset, nvidia)

    VirtualBox kernel modules (vboxdrv, vboxnetflt, vboxnetadp)

    NTFS3 kernel module (external HDD is on NTFS)


After installing ntfs-3g and disabling ntfs driver, switching from NVIDIA proprietary to open-source Nouveau and back to NVIDIA proprietary all seems working smoothly.  This method also helps to reset GPU driver after power surge and other glitches.

No comments:

Post a Comment