Skip to content

"Address already in use" during Salt bootstrap #27243

Closed

Description

@cubranic

Using the basic salt provisioner (with salt.bootstrap_options = '-P -D' and salt.install.master = true) on a Ubuntu Precise vagrant box (hashicorp/precise64), I get the following failure during Salt's bootstrap:

Processing triggers for python-support ...
 * DEBUG: Creating salt's cachedir
 *  INFO: Running install_ubuntu_check_services()
 * DEBUG: Checking if service salt-minion is enabled
 * DEBUG: Service salt-minion is enabled
 * DEBUG: Checking if service salt-master is enabled
 * DEBUG: Service salt-master is enabled
 *  INFO: Running install_ubuntu_restart_daemons()
 * DEBUG: Waiting 10 seconds for processes to settle before checking for them
 * DEBUG: There's upstart support while checking salt-minion
salt-minion start/running, process 5345
 * DEBUG: There's upstart support while checking salt-master
salt-master stop/waiting
salt-master start/running, process 5352
 *  INFO: Running daemons_running()
 * DEBUG: Waiting 10 seconds for processes to settle before checking for them
 * ERROR: salt-minion was not found running
 * ERROR: Failed to run daemons_running()!!!
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: salt.vagrant.test
[DEBUG   ] Configuration file path: /etc/salt/minion
[INFO    ] Setting up the Salt Minion "salt.vagrant.test"
[DEBUG   ] Created pidfile: /var/run/salt-minion.pid
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Attempting to authenticate with the Salt Master at 127.0.1.1
[DEBUG   ] Initializing new SAuth for ('/etc/salt/pki/minion', 'salt.vagrant.test', 'tcp://127.0.1.1:4506')
[CRITICAL] The Salt Master has rejected this minion's public key!
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.
[INFO    ] The salt minion is shut down
 * DEBUG: Running salt-minion by hand outputs:
 * DEBUG: DAEMON LOGS for minion:
 * DEBUG: 2015-09-18 19:01:49,854 [salt.crypt       ][CRITICAL][4788] The Salt Master has rejected this minion's public key!
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.
2015-09-18 19:02:00,069 [salt.crypt       ][CRITICAL][5354] The Salt Master has rejected this minion's public key!
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.
2015-09-18 19:02:07,509 [salt.cli.daemons ][INFO    ][5903] Setting up the Salt Minion "salt.vagrant.test"
2015-09-18 19:02:07,597 [salt.utils.process][DEBUG   ][5903] Created pidfile: /var/run/salt-minion.pid
2015-09-18 19:02:07,598 [salt.config      ][DEBUG   ][5903] Reading configuration from /etc/salt/minion
2015-09-18 19:02:07,735 [salt.minion      ][DEBUG   ][5903] Attempting to authenticate with the Salt Master at 127.0.1.1
2015-09-18 19:02:07,735 [salt.crypt       ][DEBUG   ][5903] Initializing new SAuth for ('/etc/salt/pki/minion', 'salt.vagrant.test', 'tcp://127.0.1.1:4506')
2015-09-18 19:02:07,739 [salt.crypt       ][CRITICAL][5903] The Salt Master has rejected this minion's public key!
To repair this issue, delete the public key for this minion on the Salt Master and restart this minion.
Or restart the Salt Master in open mode to clean out the keys. The Salt Minion will now exit.
2015-09-18 19:02:07,740 [salt.cli.daemons ][INFO    ][5903] The salt minion is shut down

[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: salt.vagrant.test
[DEBUG   ] Configuration file path: /etc/salt/master
[INFO    ] Setting up the Salt Master
[WARNING ] Unable to bind socket, error: [Errno 98] Address already in use
The ports are not available to bind
 * DEBUG: Running salt-master by hand outputs:
 * DEBUG: DAEMON LOGS for master:
 * DEBUG: 2015-09-18 19:01:49,848 [salt.master      ][ERROR   ][4846] Authentication attempt from salt.vagrant.test failed, the public keys did not match. This may be an attempt to compromise the Salt cluster.
2015-09-18 19:02:00,067 [salt.master      ][ERROR   ][5397] Authentication attempt from salt.vagrant.test failed, the public keys did not match. This may be an attempt to compromise the Salt cluster.
2015-09-18 19:02:07,738 [salt.master      ][ERROR   ][5397] Authentication attempt from salt.vagrant.test failed, the public keys did not match. This may be an attempt to compromise the Salt cluster.
2015-09-18 19:02:07,899 [salt.cli.daemons ][INFO    ][5934] Setting up the Salt Master
2015-09-18 19:02:07,899 [salt.utils.verify][WARNING ][5934] Unable to bind socket, error: [Errno 98] Address already in use

 * DEBUG: Running Processes:
 * DEBUG: USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.5  0.5  24424  2156 ?        Ss   19:00   0:00 /sbin/init
root         2  0.0  0.0      0     0 ?        S    19:00   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    19:00   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/0:0]
root         5  0.1  0.0      0     0 ?        S    19:00   0:00 [kworker/u:0]
root         6  0.0  0.0      0     0 ?        S    19:00   0:00 [migration/0]
root         7  0.0  0.0      0     0 ?        S    19:00   0:00 [watchdog/0]
root         8  0.0  0.0      0     0 ?        S    19:00   0:00 [migration/1]
root         9  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/1:0]
root        10  0.0  0.0      0     0 ?        S    19:00   0:00 [ksoftirqd/1]
root        11  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/0:1]
root        12  0.0  0.0      0     0 ?        S    19:00   0:00 [watchdog/1]
root        13  0.0  0.0      0     0 ?        S<   19:00   0:00 [cpuset]
root        14  0.0  0.0      0     0 ?        S<   19:00   0:00 [khelper]
root        15  0.0  0.0      0     0 ?        S    19:00   0:00 [kdevtmpfs]
root        16  0.0  0.0      0     0 ?        S<   19:00   0:00 [netns]
root        17  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/u:1]
root        18  0.0  0.0      0     0 ?        S    19:00   0:00 [sync_supers]
root        19  0.0  0.0      0     0 ?        S    19:00   0:00 [bdi-default]
root        20  0.0  0.0      0     0 ?        S<   19:00   0:00 [kintegrityd]
root        21  0.0  0.0      0     0 ?        S<   19:00   0:00 [kblockd]
root        22  0.0  0.0      0     0 ?        S<   19:00   0:00 [ata_sff]
root        23  0.0  0.0      0     0 ?        S    19:00   0:00 [khubd]
root        24  0.0  0.0      0     0 ?        S<   19:00   0:00 [md]
root        26  0.0  0.0      0     0 ?        S    19:00   0:00 [khungtaskd]
root        27  0.4  0.0      0     0 ?        S    19:00   0:00 [kswapd0]
root        28  0.0  0.0      0     0 ?        SN   19:00   0:00 [ksmd]
root        29  0.0  0.0      0     0 ?        S    19:00   0:00 [fsnotify_mark]
root        30  0.0  0.0      0     0 ?        S    19:00   0:00 [ecryptfs-kthrea]
root        31  0.0  0.0      0     0 ?        S<   19:00   0:00 [crypto]
root        39  0.0  0.0      0     0 ?        S<   19:00   0:00 [kthrotld]
root        40  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/u:2]
root        41  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/1:1]
root        42  0.0  0.0      0     0 ?        S    19:00   0:00 [scsi_eh_0]
root        43  0.0  0.0      0     0 ?        S    19:00   0:00 [scsi_eh_1]
root        44  0.0  0.0      0     0 ?        S    19:00   0:00 [scsi_eh_2]
root        45  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/u:3]
root        46  0.0  0.0      0     0 ?        S    19:00   0:00 [kworker/u:4]
root        65  0.0  0.0      0     0 ?        S<   19:00   0:00 [devfreq_wq]
root        66  0.2  0.0      0     0 ?        S    19:00   0:00 [kworker/0:2]
root       131  0.1  0.0      0     0 ?        S    19:00   0:00 [kworker/1:2]
root       219  0.0  0.0      0     0 ?        S<   19:00   0:00 [kdmflush]
root       231  0.0  0.0      0     0 ?        S<   19:00   0:00 [kdmflush]
root       240  0.3  0.0      0     0 ?        S    19:00   0:00 [jbd2/dm-0-8]
root       241  0.0  0.0      0     0 ?        S<   19:00   0:00 [ext4-dio-unwrit]
root       328  0.0  0.0  17224   348 ?        S    19:00   0:00 upstart-udev-bridge --daemon
root       332  0.0  0.1  21584   708 ?        Ss   19:00   0:00 /sbin/udevd --daemon
root       413  0.0  0.0  21436   256 ?        S    19:00   0:00 /sbin/udevd --daemon
root       414  0.0  0.0  21436   220 ?        S    19:00   0:00 /sbin/udevd --daemon
root       418  0.0  0.0      0     0 ?        S<   19:00   0:00 [iprt]
root       426  0.0  0.0      0     0 ?        S<   19:00   0:00 [kpsmoused]
root       514  0.0  0.1  15180   492 ?        S    19:00   0:00 upstart-socket-bridge --daemon
root       536  0.0  0.1  19192   608 ?        Ss   19:00   0:00 rpcbind -w
root       695  0.0  0.0      0     0 ?        S<   19:00   0:00 [rpciod]
root       717  0.0  0.0      0     0 ?        S<   19:00   0:00 [nfsiod]
102        728  0.0  0.1  23936   716 ?        Ss   19:00   0:00 dbus-daemon --system --fork --activation=upstart
syslog     734  0.0  0.2 249460   784 ?        Sl   19:00   0:00 rsyslogd -c5
root       741  0.0  0.0  25532    68 ?        Ss   19:00   0:00 rpc.idmapd
statd      749  0.0  0.1  21496   680 ?        Ss   19:00   0:00 rpc.statd -L
root       814  0.0  0.1  16016   744 tty4     Ss+  19:00   0:00 /sbin/getty -8 38400 tty4
root       832  0.0  0.1  16016   744 tty5     Ss+  19:00   0:00 /sbin/getty -8 38400 tty5
root       835  0.0  0.1  16016   744 tty2     Ss+  19:00   0:00 /sbin/getty -8 38400 tty2
root       836  0.0  0.1  16016   744 tty3     Ss+  19:00   0:00 /sbin/getty -8 38400 tty3
root       838  0.0  0.1  16016   744 tty6     Ss+  19:00   0:00 /sbin/getty -8 38400 tty6
root       840  0.0  0.1  19104   624 ?        Ss   19:00   0:00 cron
daemon     841  0.0  0.0  16900   192 ?        Ss   19:00   0:00 atd
root       858  0.0  0.1  15972   560 ?        Ss   19:00   0:00 /usr/sbin/irqbalance
root       909  0.0  0.0 214148   172 ?        Sl   19:00   0:00 /usr/sbin/VBoxService
root       969  0.0  0.0   7256   188 ?        Ss   19:00   0:00 dhclient eth0
root       973  0.0  0.1  16016   744 tty1     Ss+  19:00   0:00 /sbin/getty -8 38400 tty1
root      1019  0.0  0.3  71272  1136 ?        Ss   19:00   0:00 sshd: vagrant [priv]
vagrant   1034  0.2  0.1  71272   572 ?        S    19:00   0:00 sshd: vagrant@notty
root      1228  0.0  0.0   7256    48 ?        Ss   19:00   0:00 dhclient3 -e IF_METRIC=100 -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -1 eth0
root      1326  0.0  0.2  49948  1028 ?        Ss   19:00   0:00 /usr/sbin/sshd -D
root      1527  0.0  0.2  37112   972 ?        Ss   19:00   0:00 sudo -E -H bash -l
root      1528  0.0  0.1  14600   696 ?        S    19:00   0:00 bash -l
root      1530  0.0  0.1   4392   508 ?        S    19:00   0:00 /bin/sh - /tmp/bootstrap_salt.sh -P -D -k /tmp/minion-seed-keys -M
root      1532  0.0  0.2   4924   980 ?        S    19:00   0:00 sh -s -- -P -D -k /tmp/minion-seed-keys -M
root      1533  0.0  0.0      0     0 ?        S    19:00   0:00 [flush-8:0]
root      1534  0.8  0.0      0     0 ?        S    19:00   0:01 [flush-252:0]
root      1554  0.0  0.1   7396   552 ?        S    19:00   0:00 tee /tmp/bootstrap-salt.log
ntp       2316  0.0  0.2  37680  1100 ?        Ss   19:00   0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 103:108
root      3826  0.0  0.0      0     0 ?        S    19:01   0:00 [kworker/1:3]
root      5352  1.8  6.5 127216 24364 ?        Ss   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5383  1.0  6.4 212036 24252 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5384  0.0  5.6 209144 21280 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5385  0.0  6.0 209144 22748 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5386  0.0  5.4 127216 20304 ?        S    19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5387  4.2  6.7 867944 25124 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5388  4.2  6.7 867944 25104 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5395  4.3  6.7 867948 25076 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5396  4.3  6.7 867952 25104 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5397  4.2  6.7 867952 25200 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5404  0.0  5.6 504072 21300 ?        Sl   19:01   0:00 /usr/bin/python /usr/bin/salt-master
root      5938  0.0  0.3  18360  1200 ?        R    19:02   0:00 ps auxwww

Activity

  1. added
    needs-more-info
    on Sep 21, 2015
  2. added this to the Blocked milestone on Sep 21, 2015
  3. jfindlay commented on Sep 21, 2015

    @jfindlay
    Contributor

    @cubranic, thanks for the report. I am unfamiliar with the salt.bootstrap_options and salt.install.master options. Are those part of a vagrant config? If so, is it possible to post the whole config? It seems that a salt master is already running on the machine you are trying to provision a new master on.

  4. cubranic commented on Sep 21, 2015

    @cubranic
    Author

    salt.install_master = True effectively adds "-M" option to the bootstrap script. salt.bootstrap_options lets the user specify additional options (e.g., "-P" is now required on Ubuntu). You can see it being constructed in method bootstrap_options of plugins/provisioners/salt/provisioner.rb in Vagrant source.

  5. jfindlay commented on Sep 21, 2015

    @jfindlay
    Contributor

    @cubranic, thanks for the extra info. Are you provisioning a system that does/could already have a salt master on it? The error you are seeing happens when a master is already running when another salt master is started.

  6. cubranic commented on Sep 21, 2015

    @cubranic
    Author

    No, the box does not have salt installed on it. I think there is an interaction of the OS type, host name, and presided keys (it only happens on Ubuntu and not CentOS, and only when I also define the VM hostname and preseed the minion keys).

    I have a gist that replicates the problem.

  7. modified the milestones: Approved, Blocked on Sep 21, 2015
  8. added
    bug
    severity-medium
    Packaging
    Core
    P3
    Platform
    and removed
    needs-more-info
    Core
    on Sep 21, 2015
  9. jfindlay commented on Sep 21, 2015

    @jfindlay
    Contributor
  10. cubranic commented on Sep 21, 2015

    @cubranic
    Author

    I can't quite duplicate this by running the bootstrap script by hand, so I also opened a bug in the Vagrant project: hashicorp/vagrant#6292.

  11. nolar commented on Sep 24, 2015

    @nolar

    I had the same problem with vagrant 1.7.4 (the most recent one to the moment) & 1.7.2, with default bootstrap & saltstack versions as on 2015-09-23.

    To quick-fix the problem, you can add this in your Vagrant file:

        salt.install_type = 'git'
        salt.install_args = 'v2015.8.0'
    

    It takes 2 more minutes for git cloning, but at least the provisioning works.

    Actually, it seems that any version works fine with git installation type. I guess the problem is with installation from the Linux (Debian) repositories: the salt-master is started when the package is installed (successfully), and then again launched (not restarted!) from the bootstrap script — and fails.

  12. stale commented on Jan 8, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

    If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3PackagingPlatformbugseverity-mediumstale

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions