c0psrul3
By:
c0psrul3

package install issue for "do-agent"

January 17, 2017 614 views
DigitalOcean Debian

received error while installing 'do-agent' package via wget-bash script:

The following NEW packages will be installed:
  do-agent
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,538 kB of archives.
After this operation, 7,827 kB of additional disk space will be used.
Get:1 https://repos.sonar.digitalocean.com/apt/ main/main do-agent amd64 0.4.6 [2,538 kB]
Fetched 2,538 kB in 0s (10.3 MB/s)
Selecting previously unselected package do-agent.
(Reading database ... 94352 files and directories currently installed.)
Preparing to unpack .../do-agent_0.4.6_amd64.deb ...
Unpacking do-agent (0.4.6) ...
Setting up do-agent (0.4.6) ...
do-agent: unrecognized service
dpkg: error processing package do-agent (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 do-agent
E: Sub-process /usr/bin/dpkg returned an error code (1)
[mike@hostnumber1:~]$ 
8 Answers

Hmm, as far as I know, it should work correctly on Debian.

Make sure you're running it on supported distro. Supported distros are Ubuntu 14.04 and higher, CentOS 6 and higher and Debian 8. Script should warn you if you install on unsupported distro, but just to check.

Looks like the problem is that it can't find do-agent service.
Did you ever before installed Monitoring (do-agent) and removed it?
I remember problem that in early beta that if you installed it, then removed and tried to install again it could show similar service errors.

You can try completely removing it using purge option and trying script again:

  • sudo apt-get purge do-agent

Graphs are still in beta so things like this can happen. Also, you can contact support to report this problem and get help around it.

@c0psrul3

Have you tried running sudo apt-get update first? If package repositories are out of sync, installations may fail. So we'd run:

sudo apt-get update \
&& sudo apt-get -y install do-agent

yes, all package sources were updated first.
is Debian8 "jessie".

I've tried purging the agent, then re-installing:

Ign http://ftp.us.debian.org jessie InRelease
Hit http://ftp.us.debian.org jessie-updates InRelease                    
Hit http://security.debian.org jessie/updates InRelease                  
Hit http://ftp.us.debian.org jessie Release.gpg                             
Hit http://ftp.us.debian.org jessie Release                                 
Hit https://repos.sonar.digitalocean.com main InRelease                                      
...
Get:12 https://repos.sonar.digitalocean.com main/main Translation-en   
Ign https://repos.sonar.digitalocean.com main/main Translation-en   
Ign http://debmon.org debmon-jessie/main Translation-en_US          
Ign http://debmon.org debmon-jessie/main Translation-en
Fetched 9,620 B in 2s (4,420 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
apt-transport-https is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1760  100  1760    0     0  73089      0 --:--:-- --:--:-- --:--:-- 76521
OK
Ign http://ftp.us.debian.org jessie InRelease
Hit http://security.debian.org jessie/updates InRelease                  
Hit http://ftp.us.debian.org jessie-updates InRelease                        
Hit http://ftp.us.debian.org jessie Release.gpg                                                   
Hit http://security.debian.org jessie/updates/main Sources                                        
...
Fetched 9,620 B in 2s (4,514 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  do-agent
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2,538 kB of archives.
After this operation, 7,827 kB of additional disk space will be used.
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Selecting previously unselected package do-agent.
(Reading database ... 95747 files and directories currently installed.)
Preparing to unpack .../do-agent_0.4.6_amd64.deb ...
Unpacking do-agent (0.4.6) ...
Setting up do-agent (0.4.6) ...
do-agent: unrecognized service
dpkg: error processing package do-agent (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 do-agent
E: Sub-process /usr/bin/dpkg returned an error code (1)
[mike@mahost:~]$ echo `!!`
echo `sudo bash DigitalOcean_Graphs_beta__install.sh`

After purge:

[mike@mahost:~]$ sudo apt update && sudo apt upgrade
Get:12 https://repos.sonar.digitalocean.com main/main Translation-en   
Ign https://repos.sonar.digitalocean.com main/main Translation-en   
Ign http://debmon.org debmon-jessie/main Translation-en_US          
Ign http://debmon.org debmon-jessie/main Translation-en
Fetched 9,620 B in 2s (4,395 B/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Please note, i'm just testing this out wanted to look at the 'do-agent' - beta the monitoring.
But i've got no success thus far.

I'm still experiencing the issue. I followed the manual installation instructions listed here, since the install script says it can't run on my OS (Debian):
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-the-digitalocean-agent-for-monitoring

System info:

$ uname -a
Linux dpashk.com 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux

When I try to remove the package via sudo apt-get purge do-agent, it seems to stumble in the same place:

Removing do-agent ...
do-agent: unrecognized service
update-rc.d: using dependency based boot sequencing
rm: invalid option -- 'd'
Try `rm --help' for more information.
dpkg: error processing do-agent (--purge):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 do-agent

I tried removing the install log of the package from /var/lib/dpkg/status so that apt thinks it's not installed and doing the whole procedure all over, but the outcome is the same.

DigitalOcean Monitoring tracks your server resource usage over time. Some metrics, like bandwidth and disk I/O, can be easily measured or calculated from external tools. For a more complete picture, the DigitalOcean Agent can be installed on Droplets to provide metrics for memory and disk utilization and pass along information about the top consumers of CPU and memory on the system. The Agent also allows you to set up .alert policies and notifications.

@luxio how do I check? I used the standard Debian image provided by DigitalOcean.

@dpashk You can check if sysvinit is installed with dpkg -l sysvinit

Thanks @luxio, I'm using sysvinit.

  • In this case you have to convert the do-agent service file to a SysV-init file, e.g.:

    /etc/init.d/do-agent:

    #!/bin/dash
    ### BEGIN INIT INFO
    # Provides: do-agent
    # Required-Start:       $syslog $local_fs
    # Required-Stop:        $syslog $local_fs
    # Default-Start:        2 3 4 5
    # Default-Stop:         0 1 6
    # Short-Description: DigitalOcean agent
    ### END INIT INFO
    
    . /lib/lsb/init-functions
    prog=do-agent
    PIDFILE=/var/run/$prog.pid
    DESC="DigitalOcean agent"
    start() {
            log_daemon_msg "Starting $DESC" "$prog"
            start_daemon -p $PIDFILE /opt/digitalocean/bin/do-agent -log_syslog
            if [ $? -ne 0 ]; then
                    log_end_msg 1
                    exit 1
            fi
            if [ $? -eq 0 ]; then
                    log_end_msg 0
            fi
            exit 0
    }
    
    stop() {
            log_daemon_msg "Stopping $DESC" "$prog"
            killproc -p $PIDFILE /opt/digitalocean/bin/do-agent
            if [ $? -ne 0 ]; then
                    log_end_msg 1
                    exit 1
            fi
            if [ $? -eq 0 ]; then
                    log_end_msg 0
            fi
    }
    
    force_reload() {
            stop
            start
    
    }
    
    case "$1" in
            start)
                    start
                    ;;
            stop)
                    stop
                    ;;
            force-reload)
                    force_reload
                    ;;
            restart)
                    stop
                    start
                    ;;
    
            *)
                    echo "$Usage: $prog {start|stop|force-reload|restart}"
                    exit 2
    esac
    
    $ chmod 755 /etc/init.d/do-agent
    $ update-rc.d do-agent defaults
    
    • For some reason this example was hanging on my Debian 8 (jessie) droplets. It would get stuck on starting. However, rewriting /etc/init.d/do-agent with start-stop-daemon seems to have done the trick:

      #!/bin/bash
      #
      #       /etc/init.d/do-agent  -- startup script for DigitalOcean agent
      #
      ### BEGIN INIT INFO
      # Provides: do-agent
      # Required-Start:       $syslog $local_fs
      # Required-Stop:        $syslog $local_fs
      # Default-Start:        2 3 4 5
      # Default-Stop:         0 1 6
      # Short-Description: DigitalOcean agent
      ### END INIT INFO
      
      prog=do-agent
      DAEMON=/opt/digitalocean/bin/do-agent
      PIDFILE=/var/run/$prog.pid
      DESC="DigitalOcean agent"
      SCRIPTNAME=/etc/init.d/$prog
      RUN_AS_USER="nobody"
      RUN_AS_GROUP="nogroup"
      DAEMON_ARGS=" -log_syslog"
      
      # Exit if the package is not installed
      [ -x "$DAEMON" ] || exit 0
      
      # Load the VERBOSE setting and other rcS variables
      . /lib/init/vars.sh
      
      # Define LSB log_* functions.
      # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
      # and status_of_proc is working.
      . /lib/lsb/init-functions
      
      #
      # Function that starts the daemon/service
      #
      
      start() {
              log_daemon_msg "Starting $DESC" "$prog"
              # Return
              #   0 if daemon has been started
              #   1 if daemon was already running
              #   2 if daemon could not be started
      
              touch $PIDFILE
              chown $RUN_AS_USER:$RUN_AS_GROUP $PIDFILE
      
              start-stop-daemon --start -c $RUN_AS_USER:$RUN_AS_GROUP -b -m --pidfile /var/run/do-agent.pid --exec $DAEMON  --test > /dev/null \
                      || return 1
              start-stop-daemon --start -c $RUN_AS_USER:$RUN_AS_GROUP -b -m --pidfile /var/run/do-agent.pid --exec $DAEMON -- \
                       $DAEMON_ARGS || return 2
      
              log_end_msg $?
      }
      
      stop() {
              # # Return
              # #   0 if daemon has been stopped
              # #   1 if daemon was already stopped
              # #   2 if daemon could not be stopped
              # #   other if a failure occurred
              log_daemon_msg "Stopping $DESC" "$prog"
              killproc -p $PIDFILE /opt/digitalocean/bin/do-agent
              if [ $? -ne 0 ]; then
                      log_end_msg 1
                      return $?
              fi
              if [ $? -eq 0 ]; then
                      log_end_msg 0
              fi
      
              rm -f $PIDFILE
      
      }
      
      force_reload() {
              stop
              start
      
      }
      
      case "$1" in
              start)
                      start
                      ;;
              stop)
                      stop
                      ;;
              force-reload)
                      force_reload
                      ;;
              restart)
                      stop
                      start
                      ;;
      
              *)
                      echo "$Usage: $prog {start|stop|force-reload|restart}"
                      exit 2
      esac
      
      
      
Have another answer? Share your knowledge.