Manage viam-agent

viam-agent is installed as a systemd service named viam-agent on Linux, and as a launchd daemon named system/com.viam.agent on MacOS.

  • To restart viam-agent:
  1. Navigate to your machine in Viam.
  2. Click on the machine status indicator next to the machine name.
  3. Click on the restart arrow symbol. This will restart viam-server and viam-agent.
sudo systemctl restart viam-agent
  • To start viam-agent:

    sudo systemctl start viam-agent
    
  • To stop viam-agent:

sudo systemctl stop viam-agent
  • To completely uninstall viam-agent and viam-server, run the following command:

    sudo /bin/sh -c "$(curl -fsSL https://storage.googleapis.com/packages.viam.com/apps/viam-agent/uninstall.sh)"
    

    This command uninstalls viam-agent, viam-server, the machine cloud credentials file (/etc/viam.json), and the provisioning configuration file (/etc/viam-provisioning.json).

  • To restart viam-agent:
  1. Navigate to your machine in Viam.
  2. Click on the machine status indicator next to the machine name.
  3. Click on the restart arrow symbol. This will restart viam-server and viam-agent.
sudo launchctl kickstart -k system/com.viam.agent
  • To start viam-agent:

    sudo launchctl kickstart system/com.viam.agent
    

    If the service fails to start, make sure it is bootstrapped. The following command will print an error message if the service is NOT bootstrapped.

    sudo launchctl print system/com.viam.agent
    

    The following command will bootstrap the service.

    sudo launchctl bootstrap system /Library/LaunchDaemons/com.viam.agent.plist
    

    If the service STILL fails to start, ensure that it is enabled. The following command will enable the service.

    sudo launchctl enable system/com.viam.agent
    
  • To stop viam-agent:

sudo launchctl kill and sudo launchctl stop will NOT fully stop viam-agent, as launchd will automatically resurrect it. You can use the following to “boot out” the service and fully stop it.

sudo launchctl bootout system/com.viam.agent

If you would like to start viam-agent again after this command, you will need to bootstrap it again.

sudo launchctl bootstrap system /Library/LaunchDaemons/com.viam.agent.plist
  • To completely uninstall viam-agent and viam-server, run the following command:

    sudo /bin/sh -c "$(curl -fsSL https://storage.googleapis.com/packages.viam.com/apps/viam-agent/uninstall.sh)"
    

    This command uninstalls viam-agent, viam-server, and the machine cloud credentials file (/etc/viam.json).

On Windows, you can manage viam-agent using the Services GUI or the command line. You can also use the Viam web UI to restart viam-agent.

  1. Open the Services management console from your computer’s start menu.

  2. Find viam-agent in the list of services.

    Windows Services manager with viam-agent highlighted.
  3. Use the Restart Service, Stop Service, and Start Service buttons to manage viam-agent.

  4. To change the startup type of viam-agent, right-click on viam-agent and select Properties. Select your desired startup type from the Startup type dropdown menu.

    Windows Services manager with viam-agent properties open.
  1. Open a PowerShell prompt, selecting Run as administrator.

  2. Use the following commands to manage viam-agent:

    • To start viam-agent:

      Start-Service viam-agent
      
    • To stop viam-agent:

      Stop-Service viam-agent
      
    • To restart viam-agent:

      Restart-Service viam-agent
      
    • To change the startup type of viam-agent, use one of the following commands:

      Set-Service -Name "viam-agent" -StartupType Manual
      Set-Service -Name "viam-agent" -StartupType Automatic
      
  1. Navigate to your machine in Viam.
  2. Click on the machine status indicator next to the machine name.
  3. Click on the restart arrow symbol. This will restart viam-server and viam-agent.

To uninstall viam-agent, run the following command in an administrator prompt:

sc stop viam-agent
sc delete viam-agent
Remove-Item \opt\viam -Recurse
Remove-Item C:\Windows\system32\config\systemprofile\.viam -Recurse

Troubleshooting

You can find assistance in the Troubleshooting section.