Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Sunday, September 27, 2026

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX 1050 / 1050 Ti (Pascal architecture), you may have encountered an infuriating problem: putting the laptop to sleep causes an abrupt reboot, either about 14 seconds into sleep or the moment you open the lid to wake it up.

For months, the standard advice across Linux forums has been to "switch to hibernate," "disable sleep entirely," or "turn off the NVIDIA card." None of those are real fixes. Instead of giving up on proper S3 sleep, I paired with Google Antigravity—an agentic AI assistant capable of running system diagnostics and kernel-level debugging—to investigate the root cause down to the ACPI firmware bytecode. Here is what was actually causing the failure, and the permanent 4-step fix that resolved it.


The Symptoms: Unclean Reboots During Sleep

Analyzing system logs across 24 boots on Ubuntu with kernel 7.0.0-generic and the NVIDIA proprietary driver (580 series) revealed 15 boots that ended in an unclean hard reset:

  • Pattern A (14-second watchdog reset): The laptop entered S3 deep sleep (PM: suspend entry (deep)). Exactly 14.3 seconds later, the hardware watchdog tripped an immediate reset. The laptop would reboot and sit unattended at the GDM login screen for hours.
  • Pattern B (Overnight wake reset): The laptop stayed asleep in S3 through the night, but the instant the lid was opened or power button pressed in the morning, the machine suffered a hard reset during S3 resume.

The Culprit Found by Antigravity: Dell BIOS ACPI AML Bug

Antigravity inspected the kernel journal, PCI subsystem states, and decompiled the laptop's ACPI tables (DSDT and SSDT3 / PegSsdt). It uncovered a critical firmware bug in Dell's CBX3 BIOS when Linux transitions the PCIe Root Port (0000:00:01.0 / \_SB.PCI0.PEG0) into D3cold:

  1. Entering D3cold: When putting the machine to sleep, Linux places the PCIe root port into D3cold, evaluating Dell's ACPI method PG00._OFF(), which cuts GPU rail GPIO power and marks the power resource as off (PG00._STA = 0).
  2. The Infinite Loop on Resume: Upon waking, Linux calls PG00._ON() during early device resume (dpm_resume_noirq) with interrupts disabled. In Dell's bytecode, PGON(0) checks if the power rail GPIO is high. Because firmware already re-powered the rail, it returns early without re-enabling or retraining the PCIe link!
  3. Immediately after, PG00._ON() executes:
    While ((VEID != 0x10DE))
    {
        Sleep (One)
    }
    Because the link was never retrained, reading VEID (the NVIDIA PCI Vendor ID) over MMIO returns 0xFFFF. The kernel hangs forever in this infinite loop until the Linux NMI watchdog resets the system ~14 seconds later!
Why doesn't this happen in Windows? Windows does not transition the parent PCIe root port into ACPI D3cold during S3 sleep; it leaves it in D3hot, keeping PG00 powered on and completely avoiding the buggy BIOS AML loop.

Additionally, Antigravity identified two secondary conflicts on modern Ubuntu:

  • systemd-sleep user session freezing: systemd-sleep freezes user.slice before suspend and keeps it frozen while NVIDIA's post-resume scripts try to switch virtual terminals (chvt 2), deadlocking against gnome-shell under Wayland.
  • Conflicting DRM framebuffers: The NVIDIA module defaulted to nvidia_drm.fbdev=1, creating a competing fb0: nvidia-drmdrmfb alongside Intel's i915drmfb during atomic KMS modesetting.

The 4-Step Solution

To eliminate these issues cleanly and permanently, Antigravity implemented four targeted adjustments:

1. Prevent D3cold via Persistent Udev Rule

By forcing d3cold_allowed=0 and power/control=on across the PCIe Root Port and the NVIDIA devices, Linux keeps them in D3hot during S3 suspend. ACPI power resource PG00 remains on, completely bypassing the buggy While (VEID != 0x10DE) code path.

Create /etc/udev/rules.d/80-nvidia-pm-fix.rules:

# Prevent D3cold (buggy ACPI PG00._OFF / PG00._ON infinite VEID loop in SSDT3)
# on Intel PCIe Root Port PEG0 (0000:00:01.0) and NVIDIA GTX 1050 Ti (0000:01:00.0 / 0000:01:00.1)
ACTION=="add|bind|change", SUBSYSTEM=="pci", KERNEL=="0000:00:01.0", ATTR{d3cold_allowed}="0", ATTR{power/control}="on", ATTR{power/wakeup}="disabled"
ACTION=="add|bind|change", SUBSYSTEM=="pci", KERNEL=="0000:01:00.0", ATTR{d3cold_allowed}="0", ATTR{power/control}="on"
ACTION=="add|bind|change", SUBSYSTEM=="pci", KERNEL=="0000:01:00.1", ATTR{d3cold_allowed}="0", ATTR{power/control}="on"

2. Disable Spurious PEG0 ACPI Wakeups via Systemd

Create a oneshot systemd service at /etc/systemd/system/disable-peg0-wakeup.service:

[Unit]
Description=Disable ACPI wakeup on PEG0 and keep NVIDIA power states consistent
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'if grep -q "^PEG0.*\*enabled" /proc/acpi/wakeup; then echo PEG0 > /proc/acpi/wakeup; fi; for dev in 0000:00:01.0 0000:01:00.0 0000:01:00.1; do [ -d "/sys/bus/pci/devices/$dev" ] && echo 0 > "/sys/bus/pci/devices/$dev/d3cold_allowed" 2>/dev/null && echo on > "/sys/bus/pci/devices/$dev/power/control" 2>/dev/null; done'
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable and start it:

sudo systemctl daemon-reload
sudo systemctl enable --now disable-peg0-wakeup.service

3. Prevent User Session Freezing Before NVIDIA Resume

Prevent systemd-sleep from deadlocking frozen user sessions during VT switches:

for svc in systemd-suspend.service systemd-hibernate.service systemd-suspend-then-hibernate.service; do
    sudo mkdir -p "/etc/systemd/system/${svc}.d"
    echo -e '[Service]
Environment="SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=false"' | sudo tee "/etc/systemd/system/${svc}.d/override.conf"
done

4. Set nvidia_drm fbdev=0 and Update Initramfs

In /etc/modprobe.d/nvidia-graphics-drivers-kms.conf, set:

options nvidia_drm modeset=1 fbdev=0
options nvidia NVreg_PreserveVideoMemoryAllocations=1
options nvidia NVreg_TemporaryFilePath=/var

Then rebuild initramfs and reboot:

sudo update-initramfs -u -k all
sudo reboot

Verification: 11+ Hours of Clean Overnight Sleep

After applying the fix and rebooting into kernel 7.0.0-34-generic, we ran multiple sleep tests. The system journal confirmed:

  • Test 1 (Short sleep): Slept 35 seconds → resumed cleanly.
  • Test 2 (Medium sleep): Slept 1 hour 38 minutes → resumed cleanly.
  • Test 3 (Overnight test): Slept in S3 deep sleep for 11 hours and 20 minutes continuously → woke up instantly with zero crashes, zero resets, and both internal display and external HDMI functioning perfectly!

Final Thoughts on AI-Assisted Troubleshooting

Hardware power management issues on Linux often feel like impenetrable black boxes. Working with Google Antigravity showed the real power of pairing with an autonomous AI: rather than relying on generic recommendations, it analyzed the exact system journal timestamps, decompiled Dell's ACPI tables, identified the exact assembly instruction causing the hang, and generated a tailored, verified fix.

If you are struggling with unexplained sleep reboots on a Dell Inspiron 7567 or similar Pascal-era hybrid graphics laptop, give this 4-step configuration a try!

Tuesday, March 2, 2021

How to Install Asterisk 18 and FreePBX 15 on Ubuntu (Raspberry Pi 4)

Running a full-featured IP-PBX telephony server on a Raspberry Pi 4 provides small offices and lab environments with an enterprise telephone system at negligible power consumption. This comprehensive guide covers compiling Asterisk 18 LTS with DAHDI/libpri and configuring the FreePBX 15 web administration portal on Ubuntu Server (ARM64).

Hardware: Raspberry Pi 4 (4GB / 8GB recommended) • OS: Ubuntu 20.04 LTS aarch64 • Stack: Asterisk 18 LTS, FreePBX 15, MariaDB, Node.js

1. Installing Build Prerequisites and MariaDB

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y build-essential linux-headers-generic libssl-dev libncurses5-dev   libnewt-dev libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev   mariadb-server mariadb-client libjansson-dev libedit-dev sox libsox-fmt-all

# Configure database
sudo mysql_secure_installation

2. Compiling Asterisk 18 LTS

cd /usr/src
sudo wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz
sudo tar -zxf asterisk-18-current.tar.gz
cd asterisk-18.*

sudo contrib/scripts/get_mp3_source.sh
sudo contrib/scripts/install_prereq install

sudo ./configure --with-pjproject-bundled --with-jansson-bundled
sudo make menuselect.makeopts
sudo menuselect/menuselect --enable format_mp3 menuselect.makeopts
sudo make -j$(nproc)
sudo make install
sudo make samples
sudo make config
sudo ldconfig

3. Installing FreePBX 15

Install Node.js, Apache, PHP modules, and run the FreePBX install script pointing to Asterisk:

cd /usr/src
sudo wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-15.0-latest.tgz
sudo tar -zxf freepbx-15.0-latest.tgz
cd freepbx
sudo ./install -n

Thursday, May 30, 2019

How to Install Aegisub Subtitle Editor on Ubuntu 18.10 and 19.04

Aegisub is the industry-standard open-source tool for creating, styling, and timing Advanced SubStation Alpha (.ass) subtitles. When Ubuntu temporarily removed Aegisub from official distribution archives in versions 18.10 and 19.04, users could maintain full access via the verified Anton multimedia PPA repository.

Compatibility: Ubuntu 18.10 (Cosmic Cuttlefish) • Ubuntu 19.04 (Disco Dingo) • Linux Mint

Installation via PPA

sudo add-apt-repository ppa:anton+/photo-video-apps -y
sudo apt-get update
sudo apt-get install aegisub -y

Sunday, October 1, 2017

How to Compile and Install the Latest Okular Document Viewer on Ubuntu

Okular is a versatile, feature-rich universal document viewer from KDE supporting PDF, PostScript, DjVu, CHM, and ePub formats with powerful PDF annotation and text-selection tools. Here is how to compile the latest upstream release directly from source on Ubuntu.

Dependencies: Poppler Qt5 • Libzip • CMake • Extra CMake Modules (ECM)

Build and Installation Commands

# 1. Fetch build dependencies
sudo apt-get build-dep okular -y
sudo apt-get install libpoppler-qt5-dev libzip-dev cmake extra-cmake-modules -y

# 2. Clone and compile latest source
mkdir -p ~/src && cd ~/src
git clone git://anongit.kde.org/okular.git
cd okular
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
make -j$(nproc)
sudo make install

Wednesday, November 9, 2016

How to Compile and Install the Latest qpdfview and Evince on Ubuntu & Debian

For Linux desktop users seeking a high-performance, lightweight PDF and DjVu document viewer with tabbed browsing, qpdfview (built with Qt5 and Poppler) is significantly faster and more customizable than default desktop readers like Evince.

Features: Tabbed reading • Continuous two-page layout • Low memory footprint • Poppler Qt5 rendering

Installation Steps (Ubuntu / Debian)

# 1. Install Qt5 and document format rendering development packages
sudo apt-get install qttools5-dev-tools libpoppler-qt5-dev libspectre-dev   libdjvulibre-dev libcups2-dev build-essential -y

# 2. Download and build latest qpdfview release
mkdir -p ~/src && cd ~/src
wget https://launchpad.net/qpdfview/trunk/0.4.17/+download/qpdfview-0.4.17.tar.gz
tar -zxf qpdfview-0.4.17.tar.gz
cd qpdfview-0.4.17

# 3. Generate Makefile and compile with all plugins enabled
lrelease qpdfview.pro
qmake qpdfview.pro
make -j$(nproc)
sudo make install

Thursday, September 22, 2016

How to Compile the Zulip Desktop Client from Source on Ubuntu 16.04 (Xenial)

Building the Zulip desktop client from source on Ubuntu 16.04 LTS (Xenial Xerus) requires resolving Qt5 WebKit, multimedia, and GStreamer Phonon audio backend dependencies.

Stack: Ubuntu 16.04 LTS • Qt 5.x • CMake • Zulip Desktop 0.5.x

Build and Installation Commands

# 1. Install Qt5 development libraries and phonon GStreamer backends
sudo apt-get install git cmake qt5-default libqt5svg5-dev libqt5webkit5-dev   qtmultimedia5-dev libjson0-dev phonon-backend-gstreamer phonon4qt5-backend-gstreamer -y

# 2. Download and build Zulip Desktop
wget https://github.com/zulip/zulip-desktop/archive/0.5.1.tar.gz
tar -zxf 0.5.1.tar.gz
cd zulip-desktop-0.5.1
mkdir build && cd build
cmake .. -DBUILD_WITH_QT5=On
make
sudo make install

# 3. Register Desktop launcher
cd /usr/share/applications
sudo ln -s /usr/local/share/applications/Zulip.desktop .

Tuesday, September 13, 2016

Setting Up Vim with Python 2/3 Support and Code Completion on Ubuntu 16.04

Configuring Vim as a fast, keyboard-driven Python IDE significantly boosts developer productivity. When following standard Vim Python configuration guides on Ubuntu 16.04 (Xenial Xerus), several key adjustments are required to achieve clean PEP 8 indentation, accurate syntax highlighting, and YouCompleteMe code autocompletion.

Stack: Ubuntu 16.04 LTS • Vim 7.4 / 8.0 • Python PEP 8 indentation rules

1. Enforcing Clean PEP 8 Indentation

Add the following configuration to your ~/.vimrc to ensure 4-space indentations, soft tabs, and trailing whitespace highlighting:

" PEP 8 standard formatting for Python buffers
augroup python_indent
    autocmd!
    autocmd FileType python setlocal tabstop=4
    autocmd FileType python setlocal softtabstop=4
    autocmd FileType python setlocal shiftwidth=4
    autocmd FileType python setlocal textwidth=79
    autocmd FileType python setlocal expandtab
    autocmd FileType python setlocal autoindent
    autocmd FileType python setlocal fileformat=unix
augroup END

2. Installing YouCompleteMe on Ubuntu 16.04

Install prerequisite development libraries before compiling the YCM C-extension:

sudo apt-get install build-essential cmake python-dev python3-dev -y
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer

Sunday, July 8, 2012

Setting Up an IKEv2 VPN with StrongSwan Between a NATed Linux Client and Server

Configuring a secure, roadwarrior-style IKEv2 IPsec VPN using StrongSwan allows a client behind a residential NAT router (such as a standard home DSL/Cable modem) to establish an encrypted tunnel to a remote dedicated server.

Topology: Client: Ubuntu (behind NAT) • Server: CentOS with StrongSwan 4.6.x (Public IP) • Protocol: IKEv2 with X.509 certificates

1. Server Configuration (/etc/ipsec.conf)

Define the IKEv2 connection on the server. The server listens on its public IP, provisions virtual IPs to clients from 10.10.3.0/24, and routes default internet traffic:

conn win7
    left=SERVER.IP.ADD.RESS
    leftcert=server.cert
    leftid=@server.domain.com
    leftsubnet=0.0.0.0/0
    right=%any
    rightsourceip=10.10.3.0/24
    keyexchange=ikev2
    auto=add
    leftfirewall=yes

2. Client Configuration (/etc/ipsec.conf)

On the client machine behind NAT, set left=%defaultroute and request an IP dynamically from the server via leftsourceip=%config:

conn ike
    left=%defaultroute
    leftsourceip=%config
    leftcert=client.cert
    leftid=@client.domain.com
    leftfirewall=yes
    right=SERVER.IP.ADD.RESS
    rightsubnet=0.0.0.0/0
    rightid=@server.domain.com
    auto=add

3. Initiating the Connection

Start the IPsec tunnel from the client:

ipsec up ike

Check the status to verify security associations (SAs):

ipsec statusall

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...