求助:kworker进程占用100% CPU,Linux/Ubuntu新手无法解决
Hey there! I totally get how frustrating it is when you’re new to Ubuntu/Linux, you’ve scoured dozens of forums, and still can’t shake that kworker process hogging all your CPU. Let’s break this down step by step—kworkers are kernel task handlers, so the key is to figure out exactly what task they’re stuck on, then target that issue.
First: Pinpoint the problematic kworker
kworkers have weird names like kworker/u8:1—the suffix tells us what they’re dealing with. Here’s how to dig deeper:
- Open a terminal and run
ps aux | grep kworkerto find the PID (process ID) of the high-CPU kworker. - Next, run
cat /proc/<PID>/stack(replace<PID>with the number you found) to see the kernel functions it’s stuck on. This will reveal the root cause—like a driver issue, filesystem error, or hardware problem. - Also, keep
dmesg -wrunning in another terminal to watch real-time kernel logs. kworker spikes almost always leave error messages here (e.g., "USB device timeout" or "GPU driver crash").
Common Fixes (Based on Most Likely Causes)
1. Driver Glitches (The #1 Culprit)
If the stack trace points to a specific driver (graphics, Wi-Fi, sound, etc.), here’s what to do:
- Update the driver: For example, if it’s an NVIDIA GPU, run
ubuntu-drivers devicesto see available drivers, then install the latest one withsudo apt install nvidia-driver-<version-number>. - Update your kernel: Outdated kernels often have driver bugs. Run:
sudo apt update && sudo apt upgrade linux-generic sudo reboot - For Wi-Fi/Bluetooth issues, try disabling and re-enabling the device first (via Settings > Network), then update the kernel if that doesn’t help.
2. Filesystem Errors
Sometimes a misbehaving drive (internal or external) triggers constant kworker activity:
- Unmount any external drives you have connected. If the CPU usage drops, run a filesystem check:
lsblk # Find your drive identifier (e.g., /dev/sdb1) sudo umount /dev/sdb1 sudo fsck /dev/sdb1 - To check your root filesystem, reboot into recovery mode and select the "Filesystem Check" option, or run
sudo touch /forcefsckand reboot (the system will check errors on startup).
3. Kernel Bugs
Occasionally, a specific kernel version has a known kworker bug. Try upgrading to the latest hardware-enablement (HWE) kernel:
sudo apt install linux-generic-hwe-22.04 # Adjust the version to match your Ubuntu release (e.g., 20.04) sudo reboot
If that doesn’t work, you can try a mainline kernel (note: these aren’t officially supported by Ubuntu, so proceed carefully).
4. Faulty Hardware
Failing disks, glitchy USB devices, or misbehaving sensors can cause kworker to go haywire:
- Disconnect all non-essential USB devices (like external drives, printers, etc.) and see if the CPU usage drops.
- Check for hardware errors in logs:
journalctl -k -p errwill show kernel-level error messages related to hardware.
Temporary Workaround (If You Need Immediate Relief)
If you can’t fix the root cause right away, you can limit the kworker to a single CPU core to reduce its impact:
taskset -cp <core-number> <PID>
For example: taskset -cp 1 1234 binds the kworker with PID 1234 to core 1. This is just a band-aid, though—you’ll still want to fix the underlying issue.
内容的提问来源于stack exchange,提问作者coolcat97

