Roots Discourse

Mode must be in octal or symbolic form

Trying to deploy to staging after upgrading trellis and ran into the error displayed above.

Using:

ansible 2.9.10
  config file = /Users/josephroberts/localdev/papasteamstores.com/trellis/ansible.cfg
  configured module search path = ['/Users/josephroberts/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.9.1 (default, Feb  3 2021, 07:04:48) [Clang 11.0.0 (clang-1100.0.33.17)]

No idea what the issue is here. Seems maybe “mode” is being interpreted incorrectly? What are your thoughts?

TASK [deploy : Copy project templates] ****************************************************************************************************************************************************************************
task path: /Users/josephroberts/localdev/papasteamstores.com/trellis/roles/deploy/tasks/build.yml:16
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: web
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 67.205.169.5 '/bin/sh -c '"'"'echo ~web && sleep 0'"'"''
<67.205.169.5> (0, b'/home/web\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: web
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 67.205.169.5 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/web/.ansible/tmp `"&& mkdir /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690 && echo ansible-tmp-1612814915.056745-13392-116295741050690="` echo /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690 `" ) && sleep 0'"'"''
<67.205.169.5> (0, b'ansible-tmp-1612814915.056745-13392-116295741050690=/home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
Using module file /usr/local/lib/python3.9/site-packages/ansible/modules/files/stat.py
Pipelining is enabled.
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: web
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 67.205.169.5 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<67.205.169.5> (0, b'\n{"invocation": {"module_args": {"checksum_algorithm": "sha1", "get_checksum": true, "follow": false, "path": "/srv/www/papasteamstores.com/releases/20210208044324/.env", "get_md5": false, "get_mime": true, "get_attributes": true}}, "stat": {"exists": false}, "changed": false}\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<67.205.169.5> PUT /Users/josephroberts/.ansible/tmp/ansible-local-131896bgf9act/tmpja146caq/env.j2 TO /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/source
<67.205.169.5> SSH: EXEC sftp -b - -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 '[67.205.169.5]'
<67.205.169.5> (0, b'sftp> put /Users/josephroberts/.ansible/tmp/ansible-local-131896bgf9act/tmpja146caq/env.j2 /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/source\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "fstatvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "hardlink@openssh.com" revision 1\r\ndebug2: Server supports extension "fsync@openssh.com" revision 1\r\ndebug3: Sent message fd 3 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /home/web size 0\r\ndebug3: Looking up /Users/josephroberts/.ansible/tmp/ansible-local-131896bgf9act/tmpja146caq/env.j2\r\ndebug3: Sent message fd 3 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn\'t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/source\r\ndebug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:1104\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 4 1104 bytes at 0\r\ndebug3: Sent message SSH2_FXP_CLOSE I:4\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: web
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 67.205.169.5 '/bin/sh -c '"'"'chmod u+x /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/ /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/source && sleep 0'"'"''
<67.205.169.5> (0, b'', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
Using module file /usr/local/lib/python3.9/site-packages/ansible/modules/files/copy.py
Pipelining is enabled.
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: web
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 67.205.169.5 '/bin/sh -c '"'"'/usr/bin/python && sleep 0'"'"''
<67.205.169.5> (1, b'\n{"exception": "WARNING: The below traceback may *not* be related to the actual failure.\\n  File \\"/tmp/ansible_copy_payload_bULgsV/ansible_copy_payload.zip/ansible/module_utils/basic.py\\", line 1081, in set_mode_if_different\\n    mode = self._symbolic_mode_to_octal(path_stat, mode)\\n  File \\"/tmp/ansible_copy_payload_bULgsV/ansible_copy_payload.zip/ansible/module_utils/basic.py\\", line 1232, in _symbolic_mode_to_octal\\n    raise ValueError(\\"bad symbolic permission for mode: %s\\" % mode)\\n", "group": "www-data", "uid": 1001, "mode": "0644", "failed": true, "state": "file", "gid": 33, "details": "bad symbolic permission for mode: 384", "invocation": {"module_args": {"directory_mode": null, "force": true, "remote_src": null, "_original_basename": "env.j2", "owner": null, "follow": false, "local_follow": null, "group": null, "unsafe_writes": null, "setype": null, "content": null, "serole": null, "dest": "/srv/www/papasteamstores.com/releases/20210208044324/.env", "selevel": null, "regexp": null, "validate": null, "src": "/home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/source", "checksum": "22c9f4b6426dd4210a524c1889d88879803caa75", "seuser": null, "delimiter": null, "mode": "384", "attributes": null, "backup": false}}, "owner": "web", "path": "/srv/www/papasteamstores.com/releases/20210208044324/.env", "size": 1104, "msg": "mode must be in octal or symbolic form"}\n', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\n')
<67.205.169.5> Failed to connect to the host via ssh: OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/josephroberts/.ssh/config
debug1: /Users/josephroberts/.ssh/config line 2: Applying options for *
debug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolve_canonicalize: hostname 67.205.169.5 is address
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 13208
debug3: mux_client_request_session: session request sent
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 1
<67.205.169.5> ESTABLISH SSH CONNECTION FOR USER: web
<67.205.169.5> SSH: EXEC ssh -vvv -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="web"' -o ConnectTimeout=10 -o ControlPath=/Users/josephroberts/.ansible/cp/8f785726a4 67.205.169.5 '/bin/sh -c '"'"'rm -f -r /home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/ > /dev/null 2>&1 && sleep 0'"'"''
<67.205.169.5> (0, b'', b'OpenSSH_7.9p1, LibreSSL 2.7.3\r\ndebug1: Reading configuration data /Users/josephroberts/.ssh/config\r\ndebug1: /Users/josephroberts/.ssh/config line 2: Applying options for *\r\ndebug1: /Users/josephroberts/.ssh/config line 45: Applying options for 67.205.169.5\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 48: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 67.205.169.5 is address\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 13208\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
System info:
  Ansible 2.9.10; Darwin
  Trellis version (per changelog): "Use Python 3 for `ansible_local` Vagrant provisioner"
---------------------------------------------------
mode must be in octal or symbolic form
The full traceback is:
WARNING: The below traceback may *not* be related to the actual failure.
  File "/tmp/ansible_copy_payload_bULgsV/ansible_copy_payload.zip/ansible/module_utils/basic.py", line 1081, in set_mode_if_different
    mode = self._symbolic_mode_to_octal(path_stat, mode)
  File "/tmp/ansible_copy_payload_bULgsV/ansible_copy_payload.zip/ansible/module_utils/basic.py", line 1232, in _symbolic_mode_to_octal
    raise ValueError("bad symbolic permission for mode: %s" % mode)
failed: [67.205.169.5] (item={'name': '.env config', 'src': 'roles/deploy/templates/env.j2', 'dest': '.env', 'mode': 384}) => {
    "ansible_loop_var": "item",
    "changed": false,
    "checksum": "22c9f4b6426dd4210a524c1889d88879803caa75",
    "details": "bad symbolic permission for mode: 384",
    "diff": [],
    "gid": 33,
    "group": "www-data",
    "invocation": {
        "module_args": {
            "_original_basename": "env.j2",
            "attributes": null,
            "backup": false,
            "checksum": "22c9f4b6426dd4210a524c1889d88879803caa75",
            "content": null,
            "delimiter": null,
            "dest": "/srv/www/papasteamstores.com/releases/20210208044324/.env",
            "directory_mode": null,
            "follow": false,
            "force": true,
            "group": null,
            "local_follow": null,
            "mode": "384",
            "owner": null,
            "regexp": null,
            "remote_src": null,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": "/home/web/.ansible/tmp/ansible-tmp-1612814915.056745-13392-116295741050690/source",
            "unsafe_writes": null,
            "validate": null
        }
    },
    "item": {
        "dest": ".env",
        "mode": 384,
        "name": ".env config",
        "src": "roles/deploy/templates/env.j2"
    },
    "mode": "0644",
    "owner": "web",
    "path": "/srv/www/papasteamstores.com/releases/20210208044324/.env",
    "size": 1104,
    "state": "file",
    "uid": 1001
}

PLAY RECAP ********************************************************************************************************************************************************************************************************
67.205.169.5               : ok=11   changed=3    unreachable=0    failed=1    skipped=25   rescued=0    ignored=0   
localhost                  : ok=0    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   

Can you give https://github.com/roots/trellis/pull/1271 a try please?

1 Like

That worked beautifully.

This topic was automatically closed after 42 days. New replies are no longer allowed.