On Debian 13 GNOME HP laptop, how to make the following lines mentioning `spd5118` not be part of `sudo dmesg` output, but not silent all `spd5118` possible lines?

```
[503057.702178] spd5118 0-0050: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
[503057.702202] spd5118 0-0050: PM: failed to resume async: error -6
[503057.702572] spd5118 0-0053: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
[503057.702576] spd5118 0-0053: PM: failed to resume async: error -6
[587466.083983] spd5118 0-0050: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
[587466.083993] spd5118 0-0050: PM: failed to resume async: error -6
[587466.084375] spd5118 0-0053: PM: dpm_run_callback(): spd5118_resume [spd5118] returns -6
[587466.084387] spd5118 0-0053: PM: failed to resume async: error -6
```
Aug 4, 9:27pm

To suppress only the specific spd5118 resume error lines (e.g., spd5118_resume [spd5118] returns -6 and failed to resume async: error -6) from appearing in dmesg output without silencing all spd5118-related messages, you can use kernel dynamic debugging (dyndbg) to filter these messages.

Here’s how to do it on Debian 13 (GNOME/HP laptop):


Step 1: Identify the Kernel Module

The messages are generated by the spd5118 kernel module. Confirm this by running:

bash
lsmod | grep spd5118

If it’s loaded, proceed.


Step 2: Disable Specific Debug Messages

Use dyndbg to disable only the resume-related debug messages for spd5118. Run the following command as root:

bash
echo 'module spd5118 +p; func spd5118_resume -p' | sudo tee /sys/kernel/debug/dynamic_debug/control

Explanation:

  • module spd5118 +p: Enables all debug messages for the spd5118 module (default state).
  • func spd5118_resume -p: Disables debug messages only for the spd5118_resume function, which is responsible for the lines you want to suppress.

Step 3: Verify the Changes

Check if the messages are suppressed by running:

bash
sudo dmesg -w

Trigger the resume event (e.g., suspend/resume the laptop) and confirm the lines no longer appear.


Step 4: Make the Change Persistent

To ensure this persists across reboots, add the command to a startup script (e.g., /etc/rc.local or a systemd service).

Option 1: Using /etc/rc.local

  1. Edit /etc/rc.local (create it if it doesn’t exist):
    bash
    sudo nano /etc/rc.local
  2. Add the following line before exit 0:
    bash
    echo 'module spd5118 +p; func spd5118_resume -p' > /sys/kernel/debug/dynamic_debug/control
  3. Make it executable:
    bash
    sudo chmod +x /etc/rc.local

Option 2: Using a systemd Service

  1. Create a service file:
    bash
    sudo nano /etc/systemd/system/disable-spd5118-resume-messages.service
  2. Add the following:
    ini
    [Unit]
    Description=Disable spd5118 resume debug messages
    After=sysinit.target
    
    [Service]
    Type=oneshot
    ExecStart=/bin/sh -c 'echo "module spd5118 +p; func spd5118_resume -p" > /sys/kernel/debug/dynamic_debug/control'
    
    [Install]
    WantedBy=multi-user.target
  3. Enable and start the service:
    bash
    sudo systemctl enable disable-spd5118-resume-messages.service
    sudo systemctl start disable-spd5118-resume-messages.service

Alternative: Use dmesg Filtering (Temporary)

If you only want to hide these messages when running dmesg (without suppressing them at the kernel level), use:

bash
sudo dmesg | grep -v "spd5118_resume\|failed to resume async"

This filters out the lines only for the current session.


Why This Works

  • dyndbg allows granular control over kernel debug messages.
  • Disabling spd5118_resume debug messages only suppresses the resume-related errors while preserving other spd5118 messages (e.g., initialization, other functions).

Reverting the Change

To re-enable all spd5118 debug messages:

bash
echo 'module spd5118 +p' | sudo tee /sys/kernel/debug/dynamic_debug/control
Aug 4, 9:27pm

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Vibe can make mistakes. Check answers. Learn more