Uninstallation of Network Extension fails if version mismatches

I have an app which hosts network extensions(Packet Tunnel, Filter). I am facing uninstallation issue in scenario 2.

Uninstall API: OSSystemExtensionRequest.deactivationRequest

Scenarion 1:

  • app version 1.0.0.1,
  • extension inside app bundle version 1.0.0.1
  • Installed extension -> version 1.0.0.1

Uninstallation works fine.

Scenarion 2:

  • app version 1.0.0.2,
  • extension inside app bundle version 1.0.0.2
  • Installed extension -> version 1.0.0.1

Uninstallation fails with below error:

deactivation failed for client: /Applications/Remo Security Endpoint Client/ep-client.app/Contents/MacOS/ep-client, error: Error Domain=OSSystemExtensionErrorDomain Code=4 "(null)"

Question 1: is this by design or we can do something to make uninstall works in case application upgraded and tries to uninstall previous extension version.

Snippet from Apple Doc for API: OSSystemExtensionRequest.deactivationRequest

A deactivation request may require a restart before deactivating the extension. If the request succeeds but requires a restart to complete, the extension may still appear operational until the next restart.

Question 2: How do we know if restart needed or not?

How did you get into the situation described scenario 2?

Normally the system prevents that. For example, if you use the Finder to move app v2 into the Applications directory where app v1 is installed, the Finder will prompt you to remove the system extension before allowing the move.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi @eskimo

How did you get into the situation described scenario 2?

I have create pkg installer. Installer does following steps in root mode:

  1. Execute script to uninstall existing system extension. This script uses current app from application folder.
  2. Removes current app from application folder using sudo rm -rf
  3. Replace new app in application folder
  4. Run script to Install new version of system extension.

Problem: In step 1, due to some reason uninstallation fails, such as system prompts password for uninstallation, if by mistake user presses cancel button

We get into scenario 2 if uninstallation fails.

Normally the system prevents that

I have noticed, if we manually delete app using finder then macOS prompt for uninstalling its extension.

I have create pkg installer. Installer does following steps in root mode:

  1. Execute script to uninstall existing system extension. This script uses current app from application folder.

Sadly, this isn’t a workflow I’m prepared to support. See this post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Uninstallation of Network Extension fails if version mismatches
 
 
Q