How to Completely Disable ‘Udisks2’ (Disk Manager Daemon) in Ubuntu Server

udisks2 (often referred to simply as UDisks) is a background system daemon in Ubuntu and other Linux distributions that implements D-Bus interfaces to query and manipulate storage devices. It is the underlying engine that automatically detects when you plug in a USB flash drive, polls CD-ROM drives, and allows non-root users in a graphical desktop environment to mount and unmount partitions simply by clicking on them in a file manager. However, on a headless Ubuntu Server—where all storage administration should be handled explicitly by the root user via /etc/fstab and command-line tools like mount and parted—udisks2 is entirely redundant and poses a minor security risk by automatically interrogating unknown block devices.

This guide explains how to completely disable and mask the udisks2 daemon on Ubuntu Server, forcing the system to rely exclusively on manual mount commands.

Stop and Mask Udisks2 via Systemctl

Uninstalling udisks2 using the APT package manager is generally discouraged, as several core system utilities and server administrative packages may list it as a soft dependency. If you attempt to apt remove udisks2, you risk accidentally uninstalling unrelated management tools. The correct server administration approach is to permanently mask the service.

  1. Log into your Ubuntu Server via SSH or directly at the console terminal.
  2. First, check if the daemon is currently active and polling devices:
    sudo systemctl status udisks2.service
  3. Stop the running daemon immediately:
    sudo systemctl stop udisks2.service
  4. Disable the service to prevent it from launching automatically during the next boot sequence:
    sudo systemctl disable udisks2.service
  5. Finally, mask the service. This creates a hard symlink to /dev/null, ensuring that no other process, D-Bus request, or user action can inadvertently trigger the daemon to start:
    sudo systemctl mask udisks2.service

Verify the Configuration

After executing the masking command, verify that the daemon is completely neutralized.

  1. Run the status command once more:
    sudo systemctl status udisks2.service
  2. The terminal output must clearly indicate Loaded: masked (Reason: Unit udisks2.service is masked.). The active state will read inactive (dead).

Your Ubuntu Server will no longer automatically probe or attempt to mount newly attached block devices. If you plug in a USB drive, you must manually identify it using lsblk and explicitly mount it using the standard sudo mount /dev/sdX /mnt/target command.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.