Sudo Hanging for Minutes on Linux

I ran into a strange issue on Pop!_OS where Firefox and Thunderbird would sometimes take 1 to 3 minutes to open. During the same period, sudo in the terminal would also appear to freeze before finally responding.

The odd part was that the system itself did not feel slow. The desktop stayed responsive, other actions felt normal, and there was no obvious CPU or disk bottleneck. That made this harder to track down because it did not look like a typical performance problem.

The Symptoms

Here is what I was seeing:

  • Firefox sometimes took minutes to open.

  • Thunderbird did the same.

  • Running any sudo command in the terminal also stalled.

  • The rest of the system still felt fast.

That combination was the clue. When both GUI apps and sudo are delayed, but the machine itself is still responsive, the problem is often name resolution rather than general system performance.

The Fix

I added my actual hostname to both localhost lines.

First, get your hostname:

 
cat /etc/hostname

If your hostname is, for example, my-laptop, edit /etc/hosts so it looks like this:

 
127.0.0.1 localhost my-laptop ::1 localhost my-laptop

Then save the file.

If you are using nano:

  • Press Ctrl + O

  • Press Enter

  • Press Ctrl + X

Result

The fix was immediate. sudo became fast again, and Firefox and Thunderbird opened normally without the long delay.

This turned out not to be a general slowness issue at all. It was a local hostname resolution problem that only showed up in apps and commands that depended on it.

If you want, I can also turn this into a cleaner publish-ready version with a title, intro, problem, solution, and final takeaway blocks for WordPress.