Defender for Endpoint on Linux is run from the command line, so problems show up in two places: the package manager during installation, and the mdatp health output afterwards. In this post I'll work through the checks in order (package, service, onboarding, cloud connectivity and real-time protection), with the commands to run and what good output looks like.
Errors this guide fixes
mdatp: command not foundTerminalFailed to start mdatp.service: Unit mdatp.service not found.Terminal (systemctl)healthy: falseTerminal (mdatp health)licensed: falseTerminal (mdatp health)org_id: unavailableTerminal (mdatp health)engine_load_status: Engine not loadedTerminal (mdatp health)definitions_status: unavailableTerminal (mdatp health)real_time_protection_subsystem: unavailableTerminal (mdatp health)
Symptoms#
- The package installs, but the tool doesn't run:
mdatp: command not found. - The service won't start:
Failed to start mdatp.service: Unit mdatp.service not found. mdatp healthreports one or more of these values (column spacing trimmed):
healthy: false
licensed: false
org_id: unavailable
engine_load_status: Engine not loaded
definitions_status: unavailable
real_time_protection_subsystem: unavailable- The server never shows up in the Microsoft Defender portal, the EICAR test file isn't detected, or the workload slows down after deployment.
Why it happens#
- Package or dependency problems. The package must match the distribution and version. The RPM package needs glibc 2.17 or later and the DEB package needs libc6 2.23 or later; versions before 101.25032.0000 also needed
mde-netfilterand the PCRE library. - The daemon can't start. The
mdatpservice account or unit file is missing, SELinux is enforcing,/optis a symbolic link, orwdavdaemonisn't executable or sits on anoexecmount. - Onboarding didn't happen. Installing the package isn't enough: until the onboarding script runs,
licensedis false andorg_idis unavailable. - Cloud connectivity. Only static or transparent proxies are supported. PAC, WPAD and authenticated proxies aren't, and TLS inspection breaks the connection.
- Real-time protection. Files on unsupported file systems aren't scanned on access, and other security tools or very busy paths can cause conflicts and high CPU.
How to fix it#
1. Confirm the installation finished#
sudo journalctl --no-pager | grep 'microsoft-mdatp' > installation.log
grep 'postinstall end' installation.logA postinstall end line with the time of your installation means the package installed. If the package manager reported missing dependencies, install the required versions and run it again. For new deployments, Microsoft's installer script mde_installer.sh picks the right repository and package and can onboard in the same run:
sudo ./mde_installer.sh --install --channel prod --onboard ./MicrosoftDefenderATPOnboardingLinuxServer.py2. Get the service running#
sudo systemctl status mdatp
id mdatp
sudo useradd --system --no-create-home --user-group --shell /usr/sbin/nologin mdatp # only if id returned nothing
sudo service mdatp restartIf the unit isn't found, copy /opt/microsoft/mdatp/conf/mdatp.service to /lib/systemd/system (Ubuntu, Debian) or /usr/lib/systemd/system (RHEL, Oracle, SLES), run sudo systemctl daemon-reload and start it again. Still failing? Check that ls -l /opt/microsoft/mdatp/sbin/wdavdaemon shows -rwxr-xr-x, that the file system isn't mounted noexec, and use a bind mount for /opt/microsoft if /opt is a symlink. Microsoft suggests testing with SELinux in permissive mode only briefly, then reverting immediately. For mdatp: command not found, recreate the link:
sudo ln -sf /opt/microsoft/mdatp/sbin/wdavdaemonclient /usr/bin/mdatp3. Onboard and confirm the tenant#
Download the Linux onboarding package from Settings › Endpoints › Device management › Onboarding in the Microsoft Defender portal and run it:
sudo python3 MicrosoftDefenderATPOnboardingLinuxServer.py
mdatp health --field licensed
mdatp health --field org_idYou want true and your own tenant's organization ID. A different ID means the server was onboarded with another tenant's package.
4. Test cloud connectivity#
mdatp connectivity testEvery line should end in [OK]. If one doesn't, check whether TLS inspection is in the path: the certificate issuer for a Defender URL must be Microsoft, not your proxy's CA.
openssl s_client -connect x.cp.wd.microsoft.com:443 -servername x.cp.wd.microsoft.com </dev/null 2>/dev/null | openssl x509 -noout -issuerExempt the Defender for Endpoint domains from inspection, use a static or transparent proxy, then run sudo systemctl restart mdatp and test again. The URL list and proxy options are in moving to streamlined connectivity.
5. Read the health fields#
| Field | Good value | If not |
|---|---|---|
healthy / health_issues | true / empty list | Work through the issues listed |
licensed, org_id | true, your tenant | Step 3 |
definitions_status | up_to_date | Step 4; check definitions_updated_minutes_ago |
engine_load_status | Engine load succeeded | Step 2, then collect diagnostics |
real_time_protection_enabled, real_time_protection_subsystem | true, a subsystem name | Check policy, then step 6 |
supplementary_events_subsystem | ebpf (default from 101.2408.0000) or auditd | Check mdatp health --details edr |
conflicting_applications | Empty | Remove or coordinate the other security tool |
mdatp health --details edr and mdatp health --details definitions show more detail per component; passive_mode_enabled tells you whether the antivirus runs in passive mode, as described in passive mode and EDR in block mode.
6. Fix detection and performance problems#
If the service is healthy but the EICAR test file isn't detected, run findmnt -T <path> on the file's folder: files on file systems that on-access scanning doesn't support aren't scanned. For high CPU, confirm the cause by turning real-time protection off for a short test (sudo mdatp config real-time-protection --value disabled, then --value enabled again), and review the scan statistics:
mdatp diagnostic real-time-protection-statistics --output json > rtp-stats.json
mdatp exclusion folder add --path /var/lib/myapp/data/
mdatp exclusion listKeep exclusions narrow (a busy data folder of a trusted application, not / or /tmp), and if the server gets its settings from policy, add them there instead of locally.
7. Collect diagnostics#
If none of this helps, run sudo mdatp diagnostic create. It prints Diagnostic file created: followed by the path of a zip file to attach to a support case.
Verify the fix#
mdatp health --field healthyreturnstrueandhealth_issuesis empty.mdatp connectivity testshows[OK]for every URL.- An EICAR test file is detected and appears in
mdatp threat list. - The server appears in the Defender portal's device inventory, and its device ID matches
mdatp health --field edr_machine_id.
Prevent it next time#
- Check Microsoft's supported distributions and kernel versions before rollout, and deploy with the installer script or your configuration management tool rather than by hand.
- After agent upgrades and reboots, re-run
mdatp healthand read the Linux release notes for known issues in your build. - Watch the sensor health state in the device inventory; Inactive and No sensor data explains each state.
- For Macs, the same
mdatpcommands apply; see onboarding macOS with Intune.

