Skip to content
TheChatArchiveThe Chat Archive
chatgpt-4o-latest-20250326· OpenAIHugging Face LMArena Human Preference 140K

my linux computer randomly powers off sometimes during the time between i close the lid…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Metallama-3.3-70b-instruct’s answer.
  1. User

    my linux computer randomly powers off sometimes during the time between i close the lid and reopened it (it should just suspend) and i dont know why

  2. Assistant

    That’s definitely frustrating. When a Linux system powers off instead of suspending (especially after closing the lid), it can be due to several reasons ranging from power settings, ACPI issues, kernel bugs, hardware problems, or even misconfigured suspend targets.

    Here’s a comprehensive checklist to help you debug and potentially fix the issue:


    🧪 Step-by-Step Troubleshooting


    1. Check What Happens When You Close the Lid

    Run this command to check your current lid-close behavior:

    cat /etc/systemd/logind.conf | grep Lid
    

    Look at these parameters:

    • HandleLidSwitch=
    • HandleLidSwitchDocked=
    • HandleLidSwitchExternalPower=

    If it's set to poweroff, hibernate, or unset, it may explain the behavior.

    ✅ What to fix:

    Edit the file:

    sudo nano /etc/systemd/logind.conf
    

    Set the following values:

    HandleLidSwitch=suspend
    HandleLidSwitchDocked=suspend
    HandleLidSwitchExternalPower=suspend
    

    After editing, restart systemd-logind:

    sudo systemctl restart systemd-logind
    

    Note: If you’re using GNOME or KDE, these desktop environments might override systemd. Check their power settings in the system GUI too.


    2. Inspect System Logs After Unexpected Shutdown

    Use journalctl to see what was happening around the time the system went down.

    journalctl --since "30 minutes ago" --priority=3
    

    Or filter for logs at shutdown time:

    journalctl -b -1 | grep -i "power\|fail\|shutdown\|lid\|suspend"
    

    Look for:

    • kernel panic
    • ACPI error
    • power button event
    • thermal shutdown

    Paste any suspicious logs here if you're unsure.


    3. Firmware and ACPI Issues

    Some laptops have buggy ACPI implementations, which means Linux might misinterpret lid-close as shutdown.

    ✅ Try booting with kernel parameter:

    1. Edit GRUB:
    sudo nano /etc/default/grub
    
    1. Modify the GRUB_CMDLINE_LINUX_DEFAULT line. Add:
    acpi_osi=Linux acpi_backlight=vendor
    

    Full example:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=vendor"
    
    1. Update GRUB:
    sudo update-grub
    
    1. Reboot.

    4. Check for Thermal Shutdowns

    If your laptop gets too hot during suspend (especially if fans stop), it may thermally shut itself off.

    Check with:

    journalctl -b -1 | grep -i thermal
    

    5. Check if You’re Using uswsusp, TLP, or Other Power Management Tools

    If you're using something like TLP or powerdevil, or have installed uswsusp, they may interfere with the suspend behavior.

    ✅ Possible fix:

    Temporarily disable them and test:

    sudo systemctl stop tlp
    sudo systemctl disable tlp
    

    Or uninstall:

    sudo apt remove tlp
    

    6. Investigate if the System Actually Suspends

    Add a script to log events before/after suspend. Create this file:

    sudo nano /lib/systemd/system-sleep/debug-suspend.sh
    

    Paste into it:

    #!/bin/bash
    
    case $1/$2 in
      pre/*)
        echo "$(date) - SYSTEM IS SUSPENDING" >> /var/log/suspend-debug.log
        ;;
      post/*)
        echo "$(date) - SYSTEM RESUMED" >> /var/log/suspend-debug.log
        ;;
    esac
    

    Make it executable:

    sudo chmod +x /lib/systemd/system-sleep/debug-suspend.sh
    

    Then test again — if the system powers off, check /var/log/suspend-debug.log after reboot.


    7. Hardware Tests & BIOS Update

    If this is a newer or older laptop:

    • Ensure BIOS/UEFI firmware is up to date.
    • BIOS might have lid-behavior settings — check those.

    Optional: Use Hibernation Instead

    If suspend is flaky, hibernation may be more reliable — provided swap is configured properly.


    Still Unsolved?

    If none of the above fixes it, please provide these details:

    • Laptop model: (e.g. Dell XPS 13 9380)
    • Distro & version: (e.g., Ubuntu 22.04, Arch, Fedora, etc.)
    • Desktop environment: (e.g., GNOME, KDE)
    • Output of this command:
    sudo journalctl -b -1 | tail -n 100
    

    I'd be happy to help analyze the exact problem.

    Let me know what you find!

  3. User

    the computer is fine for a couple days of uptime and just suspending and waking when im not using it, it doesnt overheat or run out of power. but sometimes it seems to have turned off. i dont know if its a bios setting i dont know about or if the computer is crashing in dmesg i can see the following line [ 16.264860] systemd-journald[674]: File /var/log/journal/76ce0aece5364f2dad7894d987256026/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.

  4. Assistant

    Thanks for the details — that log line is very telling. It likely means that your system is not shutting down cleanly, which points strongly toward either:

    • A hard crash, or
    • A firmware-level power cut (e.g. BIOS-triggered behavior)

    We can walk through some next steps, but first, let’s break down the information so far:


    🔍 Analysis of Your Observations

    ✅ What we know:

    • Problem is intermittent, not always reproducible — system can be fine for days.
    • You deliberately suspend the machine (by closing the lid).
    • Battery and thermals are okay.
    • On wake, the system is sometimes fully powered off, not suspended.
    • You found journald errors about corruption, caused by unclean shutdown (power lost without a proper shutdown).

    This suggests the system did not shut down normally, and instead lost power unexpectedly — either due to:

    • A system panic/crash
    • A BIOS/UEFI setting or lid-triggered power-off
    • A firmware or driver issue during suspend (ACPI/UEFI/kernel bug)

    🛠️ Next Steps for Debugging


    1. Check if Suspend Fails or is Skipped Altogether

    Let’s check your suspend journal more deeply. Try running:

    journalctl | grep -i "suspend\|sleep\|power\|lid" | tail -n 100
    

    Or filter the logs from the previous boot (if now already rebooted):

    journalctl -b -1 | grep -i -E "suspend|sleep|lid|power|shutdown|crash"
    

    Look for this pattern:

    • Suspend initiated (sleep.target, systemd-sleep)
    • System sleeps
    • But no wake marker / resume message
    • Or, system resumes and then fails soon after

    2. Add a Watchdog Script to Catch Crashes Before They Happen

    If the shutdown is hard, and you're not getting logs, you can try enabling kernel crash dumps or use pstore.

    Enable kdump (if your distro supports it):

    sudo systemctl enable kdump
    sudo systemctl start kdump
    

    Additionally, enable pstore (persistent storage for kernel panic logs):

    sudo dmesg | grep -i pstore
    

    And check after a crash:

    sudo cat /sys/fs/pstore/* 2>/dev/null
    

    If there's a recent kernel panic or crash, pstore might contain it.


    3. Scan for ACPI or Firmware Errors

    Look for ACPI or firmware events:

    dmesg | grep -i acpi | less
    

    What you're looking for:

    • ACPI errors (e.g., "AE_NOT_FOUND", "No handler for Region")
    • BIOS or EC timeouts
    • Possible hints like "firmware bug"

    4. Temporarily Disable Lid Suspend and Manually Suspend

    Just to isolate lid-close behavior, try setting the system to do nothing when the lid is closed:

    Modify /etc/systemd/logind.conf:

    HandleLidSwitch=ignore
    HandleLidSwitchDocked=ignore
    

    Restart the service:

    sudo systemctl restart systemd-logind
    

    Then test manual suspend from the command line:

    systemctl suspend
    

    → See if the error still reproduces when you disconnect power, wait, and then wake manually.

    This test helps rule out:

    • Lid switch being misread or sending unintended signals
    • BIOS behavior on lid-close

    5. Double-Check BIOS/UEFI Power-Saving and Lid Settings

    Enter BIOS/UEFI and look for:

    • Lid close behavior / "What to do on lid close"
    • Wake-on-LAN or Wake-on-AC (disable for now)
    • Sleep state (S3 vs Modern Standby/S0ix) → if your BIOS supports legacy S3 sleep, try enabling it.
    • Intel/AMD platform trust (PTT/TPM) → some crash logs only store in TPM (rare, but worth checking)

    Not all BIOS/UEFI support these, but if yours does, changing from S0ix to S3 sleep can make Linux work more predictably on suspend.


    6. Try a Different Suspend Method

    Most systems use systemd's suspend → You could test with:

    sudo pm-suspend
    

    Or with uswsusp (if installed):

    sudo s2ram
    

    See if the result differs. This will tell us if it's an issue with systemd's implementation or sleep configuration, vs a broader kernel/firmware issue.


    🧠 Summary

    Given what you're seeing — especially the journald log corruption — your system is likely crashing or losing power while it should be sleeping. The most probable causes:

    1. Firmware/BIOS behavior on lid-close (especially if using S0ix sleep)
    2. Kernel or driver crash during suspend or wake
    3. ACPI bug leading to lockup or forced shutdown
    4. Less likely – hardware issue like bad RAM, SSD power issues

    📥 Want to Dive Deeper?

    If you're comfortable sharing output, here's what would help:

    • Output of:
    journalctl -b -1 | head -n 40
    journalctl -b -1 | tail -n 100
    
    • Your:
      • Distro version (e.g. Ubuntu 24.04, Arch 202405, etc.)
      • Laptop make/model (e.g., ThinkPad T14 Gen 1)
      • Output of: uname -a

    Let me know what you find, and we can get super-specific with the next steps or fax BIOS settings for your model.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.