How to fix E: Cannot mark package 'package-name' as automatically installed in APT

APTINTERMEDIATEMEDIUMUpdated Dec 29, 2025· 96 views

This error occurs when apt-mark cannot modify a package's installation status due to dependency conflicts or package state issues. Resolving dependency conflicts or using apt-get fix-broken to repair broken dependencies resolves this issue.

Quick fix

Fixes EMARKFAILED

apt-cache depends package-name
apt-cache rdepends package-name
  1. Check the package dependency status
  2. Verify the package is installed
  3. Check for broken dependencies
  4. Use apt-get to mark the package
apt — error
apt-cache depends package-name
apt-cache rdepends package-name
E: Cannot mark package 'package-name' as automatically installed

What this error means

The apt-mark command manages whether packages are marked as automatically installed (will be removed when no longer needed) or manually installed (kept even if no dependencies require them). This error occurs when apt-mark detects that changing a package's status would violate dependency constraints or when the package database is in an inconsistent state. When a package is marked as automatically installed, apt assumes it was only installed as a dependency and will remove it during 'apt autoremove' if nothing else depends on it. However, if marking a package as automatic would create an unresolvable dependency conflict—such as making a critical system package eligible for automatic removal—apt-mark refuses the operation to prevent system breakage.

Typical symptoms

  • apt-mark auto command fails with 'Cannot mark' error
  • Cannot change package installation status between auto and manual
  • apt autoremove suggests removing packages you need
  • Dependency chain appears broken or circular

Common causes

  1. Package has unmet or circular dependencies that would be violated by changing its status
  2. Package is required by another package but apt cannot determine the dependency relationship
  3. The package database is in an inconsistent state due to interrupted operations
  4. A previously held package is blocking the status change
  5. Conflicting version requirements exist between the package and its dependents

How to fix "E: Cannot mark package 'package-name' as automatically installed"

1Check the package dependency status

Run apt-cache depends package-name to see what packages depend on this one, and apt-cache rdepends package-name to see what requires it. This helps identify why apt-mark is refusing the status change.

bash
apt-cache depends package-name
apt-cache rdepends package-name
2Verify the package is installed

Confirm the package is actually installed on your system. apt-mark can only change the status of installed packages.

bash
dpkg -l | grep package-name
3Check for broken dependencies

Run apt-get check to diagnose and apt-get -f install to fix any broken dependencies that may be preventing the status change.

bash
sudo apt-get check
sudo apt-get -f install
4Use apt-get to mark the package

Instead of apt-mark, you can use apt-get directly, which may provide clearer error messages. However, this won't change the auto/manual status.

bash
sudo apt-get install --no-upgrade package-name
5Remove and reinstall the package

If the package state is corrupted, remove it completely and reinstall it. This resets its installation status.

bash
sudo apt-get remove package-name
sudo apt-get install package-name
6Try apt-mark with sudo if not already

apt-mark requires root privileges. Ensure you're running it with sudo.

bash
sudo apt-mark auto package-name

Advanced notes

The 'Cannot mark' error is often a symptom of deeper dependency issues in your system. The apt resolver is sophisticated but can sometimes get stuck when packages have circular dependencies or when the dependency graph has conflicts. If you're unable to resolve this through the standard steps, you may need to use aptitude (sudo apt-get install aptitude) which has a more powerful resolver that can sometimes break deadlocks that apt cannot. Additionally, tools like 'apt-get build-dep' or 'apt-get source' may be needed to understand complex dependency relationships in development scenarios.

Frequently asked questions

What does "EMARKFAILED" mean?
The apt-mark command manages whether packages are marked as automatically installed (will be removed when no longer needed) or manually installed (kept even if no dependencies require them). This error occurs when apt-mark detects that changing a package's status would violate dependency constraints or when the package database is in an inconsistent state. When a package is marked as automatically installed, apt assumes it was only installed as a dependency and will remove it during 'apt autoremove' if nothing else depends on it.
How do I fix "EMARKFAILED"?
This error occurs when apt-mark cannot modify a package's installation status due to dependency conflicts or package state issues. Resolving dependency conflicts or using apt-get fix-broken to repair broken dependencies resolves this issue.
What causes "EMARKFAILED"?
Package has unmet or circular dependencies that would be violated by changing its status Package is required by another package but apt cannot determine the dependency relationship The package database is in an inconsistent state due to interrupted operations
Is the "EMARKFAILED" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading