dh_installudev - Linux


dh_installudev is a tool designed for Debian packages to handle installing, removing, and updating udev rules. It provides a convenient and streamlined approach to managing udev rules within the Debian packaging system.


dh_installudev [options] [debhelper options]


  • -u, –user: Install udev rules for the current user instead of the system.
  • -g, –group=GROUP: Install udev rules for a specific group instead of the default group.
  • -c, –copy: Copy udev rules instead of creating symlinks.
  • -m, –mode=MODE: Set file permissions for installed udev rules.
  • -r, –root=DIR: Set the root directory for copying udev rules.
  • -b, –backup: Create backup copies of existing udev rules before overwriting them.
  • -p, –preserve: Preserve existing udev rules and append new rules instead of overwriting them.
  • –no-install: Perform dry run without actually installing udev rules.
  • –no-remove: Skip removing old udev rules during upgrade or purge.
  • –no-write: Skip writing udev rules to the system.


Simple Installation

To install udev rules for the system:


Installation for a Specific User

To install udev rules for the user "myuser":

dh_installudev -u myuser

Preserving Existing Rules

To append new udev rules without overwriting existing ones:

dh_installudev -p

Dry Run

To verify the installation without making any changes:

dh_installudev --no-install

Common Issues

Permission Denied Errors

When installing udev rules for a non-root user, ensure the user has sufficient permissions to write to the /etc/udev/rules.d directory.

Conflicting Rules

If multiple packages install udev rules for the same device, conflicts can occur. Use the --preserve option to append rules and avoid overwriting.


dh_installudev integrates with the Debian packaging system and is typically used in the postinst and prerm scripts of Debian packages that include udev rules.

Related Commands