Skip to content

Disabling Ubuntu's "Daemons Using Outdated Libraries" Prompt

Ubuntu 22.04 LTS introduces a new behavior where apt asks "Which service should be restarted?" during package updates. While designed to enhance security, this prompt can interrupt automated workflows and become frustrating for users who prefer uninterrupted work sessions.

Understanding the Needrestart Feature

The prompt you're seeing comes from needrestart, a utility that:

  • Checks which running services use outdated libraries after updates
  • Prompts you to restart affected services for security and stability
  • Helps prevent security vulnerabilities from persisting after updates

While valuable for system security, the interactive nature can be disruptive.

Quick Solution: Configure Needrestart Behavior

Edit the configuration file to change how needrestart handles service restarts:

bash
sudo nano /etc/needrestart/needrestart.conf

Look for this line (likely commented out with a #):

perl
#$nrconf{restart} = 'i';

Change it to one of these options:

perl
# Automatically restart services (recommended for most users)
$nrconf{restart} = 'a';

# Or simply list services without restarting
$nrconf{restart} = 'l';

# Or disable completely (not recommended)
$nrconf{restart} = '';

Save the file (Ctrl+O then Ctrl+X in nano) and the changes will take effect immediately.

Available Configuration Options

Configuration Options Overview
ValueBehaviorRecommended For
'i'Interactive prompt (default)Users who want manual control
'a'Automatic restartsMost users; balances safety and convenience
'l'List services onlyAdvanced users who manage services manually
''Disable completelyAutomated systems; not recommended for daily use

Recommendation

For most desktop users, $nrconf{restart} = 'a'; provides the best balance - it keeps your system secure by automatically restarting services while eliminating the interactive prompts.

Alternative: Temporary Bypass for Single Command

If you prefer to avoid configuration changes, you can temporarily bypass the prompt for a single apt command:

bash
sudo NEEDRESTART_MODE=a apt upgrade

This tells needrestart to use automatic mode just for that command.

Services using outdated libraries can pose security risks. The automatic restart option ('a') ensures that:

  • Security updates take effect immediately
  • You maintain system stability
  • You avoid potential vulnerabilities from outdated libraries in memory

Note on Critical Services

Some services (like SSH connections or database servers) might be better restarted manually during maintenance windows. For servers, consider using 'l' to list services instead of automatically restarting them.

Verifying the Configuration

After making changes, you can verify your settings with:

bash
greprestart /etc/needrestart/needrestart.conf

This should display your current restart configuration setting.

Conclusion

The "Daemons using outdated libraries" prompt is a security feature, not a bug. While you can disable it completely, the recommended approach is to configure automatic restarts ('a') for the best balance of security and convenience. This ensures your system remains secure while eliminating the interactive prompts during package updates.