Locionic
Blog
Projects
Dev ToolsCheatsheetsSeries & Guides
About MeFree Production KitContact
Send email to LocionicLocionic GitHub profileLocionic YouTube channel
© 2026Locionic• All rights reserved.
Dev Kits & Data•Tools•Tags•RSS•Privacy Policy•Terms
  1. Home
  2. Blog
  3. Fixing a 2-Minute Login Delay on Ubuntu (Real Debugging Journey)
Wednesday, May 27, 2026•8 min read

Fixing a 2-Minute Login Delay on Ubuntu (Real Debugging Journey)

Locionic
Locionic(@Locionic)
linux ubuntu performance troubleshooting
Fixing a 2-Minute Login Delay on Ubuntu (Real Debugging Journey)

I sat staring at a frozen desktop for two full minutes after typing my password. Every single morning. For three days straight.

Audio Briefing• Voice: Google Cloud Journey-F
0:00 / --:--
Interactive Dev Tool
100% Client-Side & Private

Linux Permissions & Chmod Calculator

Interactive octal & symbolic permission matrix with CLI builder

Convert between octal (755, 644, 600) and symbolic (rwxr-xr-x) Linux permissions with an interactive matrix and shell command builder.

Chmod OctalSymbolic PermissionsLinux MatrixBash Command
Launch Full ToolBrowse all 22 Dev Tools
Key Insight

Boot time and login time are completely different problems. systemd-analyze measures boot speed - not what happens after you type your password.

This is the follow-up to my original Ubuntu login delay post, where an NVIDIA/Xorg issue caused a similar symptom. This time the machine had no NVIDIA GPU, but the same two-minute freeze was back. Different root cause, different fix.


The Diagnostic Toolkit

Before touching anything, collect evidence. Guessing wastes time.

Boot-time analysis (what loads before the login screen):

bash
systemd-analyze blame | head -20
systemd-analyze critical-chain
systemd-analyze plot > boot.svg

User-session analysis (what loads after you type your password):

bash
systemd-analyze --user blame | head -20
systemd-analyze --user critical-chain

Journal scanning (find timeout and failure events):

bash
# All errors since last boot
journalctl -b -p err

# Everything, with timestamps
journalctl -b --output=short-precise | less

# Filter for common culprits
journalctl -b | grep -iE "timeout|timed out|failed|refused|killed"

The critical insight: systemd-analyze blame only shows boot-time (pre-login). For post-login freezes, you need --user and journalctl -b.


The First Clue: NetworkManager

systemd-analyze blame showed NetworkManager-wait-online.service at 5.7 seconds. Not the login freeze culprit, but worth fixing.

What NetworkManager-wait-online does

This service blocks the boot sequence until a full network connection is established. On a server, it matters - systemd services like databases need network before starting. On a desktop, it's usually pointless.

bash
sudo systemctl disable NetworkManager-wait-online.service

Check it actually disabled:

bash
systemctl is-enabled NetworkManager-wait-online.service
# Should output: disabled

Boot got 5 seconds faster. The login freeze didn't budge.

Why this is safe on desktops: Desktop apps don't depend on network being ready at boot time - they handle it themselves. The only services that need NetworkManager-wait-online to succeed are ones explicitly After=network-online.target, which is rare on desktops.


The Second Clue: Duplicate Keyring

journalctl -b | grep -iE "failed|error" showed a cluster of errors at exactly the two-minute mark after login:

Failed to start app-gnome-gnome-keyring-secrets.scope
systemd[1423]: Failed to start gnome-keyring-secrets.scope
cgroup: Failed to create /user.slice/user-1000.slice/session-2.scope/app.slice/app-gnome-keyring

The timestamps were precise: these errors appeared 120 seconds after login - the exact length of the freeze.

Understanding the Problem

GNOME was starting the keyring daemon twice - once via systemd user services, and again via .desktop autostart files in /etc/xdg/autostart/. The second attempt found the socket already in use, crashed, and left systemd waiting on the failed service before it could declare the session ready.

Confirm the Duplicate

Check whether autostart files exist:

bash
ls /etc/xdg/autostart/ | grep keyring
# gnome-keyring-pkcs11.desktop
# gnome-keyring-secrets.desktop
# gnome-keyring-ssh.desktop

Check whether the systemd user service is also active:

bash
systemctl --user status gnome-keyring-daemon.service

If both are present and the service is active, you have the duplicate.

The Fix

Disable the autostart entries for your user only (don't modify system-wide files):

bash
mkdir -p ~/.config/autostart
for f in gnome-keyring-pkcs11.desktop gnome-keyring-secrets.desktop gnome-keyring-ssh.desktop; do
    cp /etc/xdg/autostart/$f ~/.config/autostart/$f
    echo "X-GNOME-Autostart-enabled=false" >> ~/.config/autostart/$f
done

Log out and back in. The cgroup errors should disappear.

The cgroup errors disappeared. The freeze? Still two minutes, exactly.


The Real Culprit: snapd's Math

After eliminating the obvious candidates, I ran a targeted search for anything in the journal related to timing:

bash
journalctl -b | grep -i "snap\|adjust\|timeout" | head -30

There it was:

snapd[2242]: adjusting startup timeout by 2m0s (pessimistic estimate of 30s plus 5s per snap)
snapd[2242]: OsRelease{...} snap name "snapd-desktop-integration" error: service not found
Snapd's Timeout Formula

snapd calculates its startup timeout as 30 seconds + 5 seconds per installed snap. I had 18 snaps installed. 30 + (5 × 18) = 120 seconds exactly.

This is hardcoded in the snapd source. You cannot configure it shorter.

The snapd-desktop-integration snap was failing on every login. snapd waited the full calculated timeout (120 seconds) before giving up and letting the session proceed.

Diagnosing Which Snap Is Failing

bash
# Check snap status
snap list

# Check for failing snap services
snap services | grep -v enabled

# Watch snap logs
journalctl -b -u snapd | grep -iE "fail|error|timeout"

The output showed snapd-desktop-integration consistently failing to connect. The snap's job is to sync GTK themes and fonts between the host and containerized snap apps. Purely cosmetic - nothing breaks if it fails, except the login wait.

The Fix

bash
sudo snap remove snapd-desktop-integration

Log out, log back in. Desktop loaded instantly.

Alternative: Keep the Snap, Remove the Service

If you want to keep the snap for occasional use but stop it from running on login:

bash
sudo snap stop snapd-desktop-integration
sudo snap set snapd-desktop-integration daemon=false

This prevents the service from starting automatically while keeping the snap installed.


The Full Picture: Three Bugs, One Symptom

BugTool that caught itImpact on loginFix
NetworkManager-wait-onlinesystemd-analyze blame+5s on boot (not login)systemctl disable
Duplicate gnome-keyringjournalctl -b -p errCgroup errors, minor delayDisable autostart duplicates
snapd timeoutjournalctl -b | grep snap+120s login freezesnap remove snapd-desktop-integration

Each bug was real. None of them caused the two-minute freeze on its own until the snapd issue was found.


Preventive Checks

If you want to audit what's starting slowly in your user session without waiting for something to break:

bash
# Slowest user services at startup
systemd-analyze --user blame | head -20

# All snap services and their status
snap services

# Snaps that have autostart behavior
snap list | awk 'NR>1 {print $1}' | xargs -I{} snap info {} 2>/dev/null | grep -A2 "services:"

For systems with many snaps, the math above applies: every 6 additional snaps adds 30 seconds to a worst-case timeout. Keep your snap list lean.


Diagnostic Cheat Sheet

Boot breakdown: systemd-analyze blame | head -20
User session breakdown: systemd-analyze --user blame | head -20
Login failures: journalctl -b | grep -iE "timeout|timed out|failed"
Snap-specific: journalctl -b -u snapd | grep -iE "fail|adjust|timeout"
Snap services: snap services | grep -v enabled


TL;DR

Three separate bugs. Two minutes of waiting. One snap remove command fixed it.

The real lesson: login freeze ≠ boot slowness. systemd-analyze blame won't show you what's happening after you type your password. Use systemd-analyze --user blame and journalctl -b | grep -iE "failed|timeout" to find post-login issues.

snapd's 30 + 5n timeout formula is the most common cause I've seen for mysterious 1–2 minute login delays on Ubuntu machines with many snaps installed. If your machine freezes for exactly N×30 seconds after login, check snap services first.

You Might Also Like

  • Fixing 2–3 Minute Login Delay on Ubuntu with NVIDIA (Xorg + nvidia-drm Issue)
  • How to Add a Directory to PATH in Linux (Permanent Fix)
  • FastAPI Docker Multistage Builds: Cut Your Image Size by 70%
  • Astral uv in Docker: Multi-Stage Builds, BuildKit Caching & Fast CI

Test Your Knowledge

Interactive Quiz
Question 1 of 2

A developer is experiencing a significant delay after entering their password on an Ubuntu desktop, but `systemd-analyze blame` shows a very fast boot time. What is the most likely reason for this discrepancy?

Advertisement
Share this article:

Stay Updated

Get the latest posts delivered straight to your inbox.

Free Developer Utilities

Free In-Browser Developer Tools

Clean AI CLI logs, build cron expressions, decode JWTs, and calculate chmod permissions offline.

Explore Tools

Related Articles

Fixing 2–3 Minute Login Delay on Ubuntu with NVIDIA (Xorg + nvidia-drm Issue)
linuxMay 27, 2026

Fixing 2–3 Minute Login Delay on Ubuntu with NVIDIA (Xorg + nvidia-drm Issue)

After a kernel update, my Ubuntu desktop took 2–3 minutes to appear after login. The culprit was a DRM modeset ownership fight between nvidia-drm and Xorg. Here's how I fixed it in 10 seconds.

Read more
Ubuntu Server Security: The Pragmatic Linux Hardening Checklist
devopsJuly 22, 2026

Ubuntu Server Security: The Pragmatic Linux Hardening Checklist

Production Ubuntu server hardening guide: SSH key enforcement, UFW firewalls, Fail2ban intrusion prevention, unattended upgrades, and auditd logging.

Read more
Why pipes sometimes get "stuck": buffering
terminalNovember 29, 2024

Why pipes sometimes get "stuck": buffering

The first time my terminal froze mid-pipeline I spent an hour debugging the wrong thing. Here's what was actually happening and how to fix it in seconds.

Read more
On this page
0%
  • The Diagnostic Toolkit
  • The First Clue: NetworkManager
  • The Second Clue: Duplicate Keyring
  • The Real Culprit: snapd's Math
  • Diagnosing Which Snap Is Failing
  • The Fix
  • Alternative: Keep the Snap, Remove the Service
  • The Full Picture: Three Bugs, One Symptom
  • Preventive Checks
  • TL;DR
  • Test Your Knowledge
Previousconst vs Immutability in JavaScript: The Binding, Not the ValueRead NextFixing 2–3 Minute Login Delay on Ubuntu with NVIDIA (Xorg + nvidia-drm Issue)