{"action":"opened","issue":{"url":"https://api.github.com/repos/kapilt/juju-digitalocean/issues/38","labels_url":"https://api.github.com/repos/kapilt/juju-digitalocean/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/kapilt/juju-digitalocean/issues/38/comments","events_url":"https://api.github.com/repos/kapilt/juju-digitalocean/issues/38/events","html_url":"https://github.com/kapilt/juju-digitalocean/issues/38","id":101096469,"number":38,"title":"Unable to add services because ubuntu user is not being added","user":{"login":"brookemckim","id":245680,"avatar_url":"https://avatars.githubusercontent.com/u/245680?v=3","gravatar_id":"","url":"https://api.github.com/users/brookemckim","html_url":"https://github.com/brookemckim","followers_url":"https://api.github.com/users/brookemckim/followers","following_url":"https://api.github.com/users/brookemckim/following{/other_user}","gists_url":"https://api.github.com/users/brookemckim/gists{/gist_id}","starred_url":"https://api.github.com/users/brookemckim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brookemckim/subscriptions","organizations_url":"https://api.github.com/users/brookemckim/orgs","repos_url":"https://api.github.com/users/brookemckim/repos","events_url":"https://api.github.com/users/brookemckim/events{/privacy}","received_events_url":"https://api.github.com/users/brookemckim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-14T20:21:07Z","updated_at":"2015-08-14T20:21:07Z","closed_at":null,"body":"As part of the manual provider JuJu will ensure the `ubuntu` user exists on all machines added. This is triggered here https://github.com/juju/juju/blob/master/provider/manual/provider.go#L26 and you can see the script it adds here https://github.com/juju/juju/blob/8da94246468a4da71e62894f7a8a1bbbce112697/environs/manual/init.go#L177\r\n\r\nWithout the `ubuntu` user the services will fail to work because the bootstrap machines attempts to connect to the new machines via ```ssh ubuntu@[host]```. I haven't been able to track down why that codepath isn't being run, but I assume it has to do with the fact the python-jujuclient is being used to RPC into the apiserver library. \r\n\r\nHere is what the user-data script looks like to bootstrap new machines\r\n\r\n```\r\n#!/bin/bash\r\nrm -f '/var/log/cloud-init-output.log'\r\ndump_file() {\r\n    code=$?\r\n    if [ $code -ne 0 -a -e '/var/log/cloud-init-output.log' ]; then\r\n        cat '/var/log/cloud-init-output.log' >&2\r\n    fi\r\n    exit $code\r\n}\r\ntrap dump_file EXIT\r\n#!/bin/bash\r\nset -e\r\ntest -e /proc/self/fd/9 || exec 9>&2\r\n(\r\ntest -e /proc/self/fd/9 || exec 9>&2\r\necho 'Logging to /var/log/cloud-init-output.log on remote host' >&9\r\nexport DEBIAN_FRONTEND=noninteractive\r\n\r\nfunction package_manager_loop {\r\n    local rc=\r\n    while true; do\r\n        if ($*); then\r\n                return 0\r\n        else\r\n                rc=$?\r\n        fi\r\n        if [ $rc -eq 100 ]; then\r\n                sleep 10s\r\n                continue\r\n        fi\r\n        return $rc\r\n    done\r\n}\r\n\r\necho 'Running apt-get update' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet update\r\necho 'Installing package: curl' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install curl\r\necho 'Installing package: cpu-checker' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install cpu-checker\r\necho 'Installing package: bridge-utils' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install bridge-utils\r\necho 'Installing package: rsyslog-gnutls' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install rsyslog-gnutls\r\necho 'Installing package: cloud-utils' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install cloud-utils\r\necho 'Installing package: cloud-image-utils' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install cloud-image-utils\r\necho 'Installing package: tmux' >&9\r\npackage_manager_loop apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install tmux\r\ntest -e /proc/self/fd/9 || exec 9>&2\r\n([ ! -e /home/ubuntu/.profile ] || grep -q '.juju-proxy' /home/ubuntu/.profile) || printf '\\n# Added by juju\\n[ -f \"$HOME/.juju-proxy\" ] && . \"$HOME/.juju-proxy\"\\n' >> /home/ubuntu/.profile\r\nmkdir -p /var/lib/juju/locks\r\n(id ubuntu &> /dev/null) && chown ubuntu:ubuntu /var/lib/juju/locks\r\nmkdir -p /var/log/juju\r\nchown syslog:adm /var/log/juju\r\nbin='/var/lib/juju/tools/1.24.4-trusty-amd64'\r\nmkdir -p $bin\r\necho 'Fetching tools: curl -sSfw '\"'\"'tools from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s '\"'\"' --noproxy \"*\" --insecure -o $bin/tools.tar.gz <[https://45.55.206.245:17070/tools/1.24.4-trusty-amd64]>' >&9\r\n\r\nfor n in $(seq 5); do\r\n\r\n    printf \"Attempt $n to download tools from %s...\\n\" 'https://45.55.206.245:17070/tools/1.24.4-trusty-amd64'\r\n    curl -sSfw 'tools from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s ' --noproxy \"*\" --insecure -o $bin/tools.tar.gz 'https://45.55.206.245:17070/tools/1.24.4-trusty-amd64' && echo \"Tools downloaded successfully.\" && break\r\n\r\n    if [ $n -lt 5 ]; then\r\n        echo \"Download failed..... wait 15s\"\r\n    fi\r\n    sleep 15\r\ndone\r\nsha256sum $bin/tools.tar.gz > $bin/juju1.24.4-trusty-amd64.sha256\r\ngrep '121cebb5c8ab12761827431a0375f9a18ac0b77ee552f50ff8d6856a36d53907' $bin/juju1.24.4-trusty-amd64.sha256 || (echo \"Tools checksum mismatch\"; exit 1)\r\ntar zxf $bin/tools.tar.gz -C $bin\r\nprintf %s '{\"version\":\"1.24.4-trusty-amd64\",\"url\":\"https://10.132.222.174:17070/environment/f5f99640-4ede-4d46-8432-aea864e1a2c3/tools/1.24.4-trusty-amd64\",\"sha256\":\"121cebb5c8ab12761827431a0375f9a18ac0b77ee552f50ff8d6856a36d53907\",\"size\":16645207}' > $bin/downloaded-tools.txt\r\nmkdir -p '/var/lib/juju/agents/machine-5'\r\ncat > '/var/lib/juju/agents/machine-5/agent.conf' << 'EOF'\r\n# format 1.18\r\ntag: machine-5\r\ndatadir: /var/lib/juju\r\nlogdir: /var/log/juju\r\nnonce: manual:a4cfeef6e5124445a172ca77302fa847\r\njobs:\r\n- JobHostUnits\r\nupgradedToVersion: 1.24.4\r\ncacert: |\r\n  -----BEGIN CERTIFICATE-----\r\n  MIICaTCCAdSgAwIBAgIBADALBgkqhkiG9w0BAQUwSjENMAsGA1UEChMEanVqdTE5\r\n  MDcGA1UEAwwwanVqdS1nZW5lcmF0ZWQgQ0EgZm9yIGVudmlyb25tZW50ICJkaWdp\r\n  dGFsb2NlYW4iMB4XDTE1MDgwNzE4NTcwOFoXDTI1MDgxNDE4NTcwOFowSjENMAsG\r\n  A1UEChMEanVqdTE5MDcGA1UEAwwwanVqdS1nZW5lcmF0ZWQgQ0EgZm9yIGVudmly\r\n  b25tZW50ICJkaWdpdGFsb2NlYW4iMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\r\n  gQDQRr6OvRXoH9XmIIRT8DKGhbBCZ8LZ0G7yFMA205sJezNJWO5+0923HbtTx1t7\r\n  uHcHSIs9YE1F8OABJ978rs8jKElNC9c2HQZIjd5hULW3KCrnqopIxY8f0wDAF+q5\r\n  O5Ui25QXuI3ou7w30ZBdmh2ystRgWXzpz1AHk4qiz1hU/wIDAQABo2MwYTAOBgNV\r\n  HQ8BAf8EBAMCAKQwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPSjnk4u8mHqf\r\n  AiT9hQJtlAMPBrkwHwYDVR0jBBgwFoAUPSjnk4u8mHqfAiT9hQJtlAMPBrkwCwYJ\r\n  KoZIhvcNAQEFA4GBAH/pAlU8HA9kEoPhY3WBw7cAL5WxFwHYnlxIahMVxLe1R6Ea\r\n  AFeWHwea1o8EQMoP8+fGzS3bM+Vm04FqXvCNWGrwtybkopIwx/kNXb5Pg5BgPJp7\r\n  8LLyDr80u1DS/bi7RcHXIPR+h0fERI1E9yAIdETcWCFk+2b9/h5fSABOOf0l\r\n  -----END CERTIFICATE-----\r\nstateaddresses:\r\n- 127.0.0.1:37017\r\nenvironment: environment-f5f99640-4ede-4d46-8432-aea864e1a2c3\r\napiaddresses:\r\n- 45.55.206.245:17070\r\noldpassword: R1LF8w9IARi3wxizxS/IZ7hN\r\nvalues:\r\n  AGENT_SERVICE_NAME: jujud-machine-5\r\n  CONTAINER_TYPE: \"\"\r\n  PROVIDER_TYPE: manual\r\n  SECURE_STATESERVER_CONNECTION: \"true\"\r\n\r\nEOF\r\nchmod 0600 '/var/lib/juju/agents/machine-5/agent.conf'\r\nln -s 1.24.4-trusty-amd64 '/var/lib/juju/tools/machine-5'\r\necho 'Starting Juju machine agent (jujud-machine-5)' >&9\r\ncat > /etc/init/jujud-machine-5.conf << 'EOF'\r\ndescription \"juju agent for machine-5\"\r\nauthor \"Juju Team <juju@lists.ubuntu.com>\"\r\nstart on runlevel [2345]\r\nstop on runlevel [!2345]\r\nrespawn\r\nnormal exit 0\r\n\r\nlimit nofile 20000 20000\r\n\r\nscript\r\n\r\n\r\n  # Ensure log files are properly protected\r\n  touch /var/log/juju/machine-5.log\r\n  chown syslog:syslog /var/log/juju/machine-5.log\r\n  chmod 0600 /var/log/juju/machine-5.log\r\n\r\n  exec '/var/lib/juju/tools/machine-5/jujud' machine --data-dir '/var/lib/juju' --machine-id 5 --debug >> /var/log/juju/machine-5.log 2>&1\r\nend script\r\nEOF\r\n\r\nstart jujud-machine-5\r\nrm $bin/tools.tar.gz && rm $bin/juju1.24.4-trusty-amd64.sha256\r\n) >> /var/log/cloud-init-output.log 2>&1\r\n```\r\n\r\nAs you can see it does not include adding the ubuntu user.\r\n"}}