During system boot or while inspecting system logs using systemctl --failed on Ubuntu, administrators often encounter an error reading Failed to start Clean up any mess left by 0dns-up. This error is associated with the clean-up-0dns-up.service unit. While this service rarely crashes an ongoing desktop session, it triggers red failure flags during boot sequences, slows down startup timing, and indicates orphaned legacy network scripts left behind by previous software packages.
Why the 0dns-up Error Occurs
The 0dns-up service originates from legacy DNS management packages, specific VPN connection scripts (such as openconnect or vpnc), or older resolvconf integrations. The failure happens because:
- Missing Target Scripts: The service file calls a cleanup shell script in
/etc/network/if-up.d/or/var/run/that has been uninstalled or renamed. - Transition to systemd-resolved: Modern Ubuntu releases handle name resolution via
systemd-resolvedand Netplan, rendering traditional dynamic DNS file manipulations obsolete. - Orphaned Package Configuration: A VPN or network manager package was removed, but its systemd service configuration files were left behind because the package was not purged.
Step 1: Inspect the Failing Unit Details
Before modifying system files, inspect the exact status and error code returned by systemd:
systemctl status clean-up-0dns-up.service
Examine the ExecStart directive and the exit code. If the output indicates code=exited, status=203/EXEC or reports that the binary or path does not exist, the service is trying to execute a non-existent cleanup utility.
Step 2: Disable and Mask the Service
Because modern Ubuntu systems rely on systemd-resolved for dynamic DNS state management, this legacy cleanup service is redundant. You can safely disable and mask the service to prevent systemd from ever invoking it:
sudo systemctl stop clean-up-0dns-up.service
sudo systemctl disable clean-up-0dns-up.service
sudo systemctl mask clean-up-0dns-up.service
Masking links the service configuration to /dev/null, ensuring that no dependent network trigger can accidentally activate it during boot.
Step 3: Remove the Orphaned Service File
If you prefer a clean filesystem without masked remnant units, locate and remove the orphaned service definition directly:
- Locate the service file path:
sudo find /etc/systemd/system /lib/systemd/system -name "*0dns-up*" - Remove the service file (typically found in
/etc/systemd/system/clean-up-0dns-up.service):sudo rm /etc/systemd/system/clean-up-0dns-up.service - Reload the systemd daemon to commit the removal:
sudo systemctl daemon-reload sudo systemctl reset-failed
Step 4: Purge Residual VPN and Resolvconf Packages
If the error was introduced by an uninstalled VPN package, purge any leftover configuration files that remain on the host:
sudo apt-get autoremove --purge
dpkg -l | grep '^rc' | awk '{print $2}' | xargs -r sudo dpkg --purge
This command finds all packages in the rc (residual configuration) state and removes their configuration scripts from /etc/.
Verification
To confirm that your Ubuntu installation boots cleanly without errors, query the systemd failure log:
systemctl --failed
The command should return 0 loaded units listed, confirming that the boot sequence is now completely free of failed legacy service dependencies.