所有者/组设置为“82”

所有者/组设置为“82”

我正在运行一个兰多开发环境简单虚拟 LAMP 应用,作为测试我的习惯的一种方式兰多插件(在分支机构工作console)。 (Lando 是一个用于运行本地开发环境的工具,其目标类似于 Vagrant,但构建在 Docker Compose 之上。)

每隔一段时间 - 我还没有辨别出一种模式 - 运行一个 lando 命令,例如lando startlando info,或lando stop从我的应用程序目录中运行,~/workspace/lamp,将该工作目录的所有者和组设置为82。发生这种情况时,它还会将相同的所有权/组应用于~/.landoLando 的用户态配置和数据文件目录。我的机器上没有这样的用户或组。

~/workspace/lamp $ ls -la
total 64
drwxrwxr-x  5      82      82  4096 Dec 10 19:14 .
drwxr-xr-x 36 ctamayo ctamayo  4096 Dec 13 12:11 ..
-rw-r--r--  1      82      82   289 Nov  3 17:45 composer.json
-rw-r--r--  1      82      82  4064 Nov  3 17:45 composer.lock
-rw-rw-r--  1      82      82    45 Nov  3 17:58 .env
drwxrwxr-x  8      82      82  4096 Dec 10 19:14 .git
-rw-rw-r--  1      82      82    35 Nov  3 17:46 .gitignore
-rw-rw-r--  1      82      82   284 Dec  8 16:52 .lando.yml
-rw-rw-r--  1      82      82 22770 Dec 15 09:51 stderr.log
drwxr-xr-x  5      82      82  4096 Nov  3 17:45 vendor
drwxrwxr-x  2      82      82  4096 Nov  3 18:09 www
~/workspace/lamp $ cd ~/.lando
~/.lando $ ls -la
total 52
drwxrwxr-x 10 82      82 4096 Dec  8 16:57 .
drwx------ 79 82      82 4096 Dec 15 10:49 ..
-rw-rw-r--  1 82      82  670 Dec  8 16:05 appRegistry.json
drwxrwxr-x  2 82      82 4096 Nov 27 20:53 cache
-rw-rw-r--  1 82      82  171 Dec  8 16:57 config.yml
-rw-rw-r--  1 82      82   36 Oct 24 10:59 .instance.id
drwxr-xr-x  3 82      82 4096 Oct 24 13:15 keys
drwxrwxr-x  2 82      82 4096 Oct 24 11:55 logs
drwxrwxr-x  2 82      82 4096 Dec  1 09:57 plugins
drwxrwxr-x  2 82      82 4096 Oct 24 11:04 proxy
drwxrwxr-x  3 82      82 4096 Oct 24 10:59 services
drwxrwxr-x 17 82      82 4096 Nov 21 10:38 tmp
drwxrwxr-x  2 82      82 4096 Oct 24 12:55 util
~/.lando $ sudo grep 82 /etc/passwd
~/.lando $ groups
ctamayo adm cdrom sudo dip plugdev lpadmin sambashare docker
~/.lando $ sudo groups
root
~/.lando $

故障排除,v1.0

我尝试使用 来strace精确定位进行这些更改的系统调用。我是一名stracen00b,所以我可能做错了,但这是迄今为止我的调试技术......

我将此帮助程序脚本放在我的路径中,它只是lando一遍又一遍地运行命令,直到它们失败(我还没有识别出其中的模式)多久失败所需的时间,或者失败的命令):

#!/bin/bash
set -e

while :
do
  echo starting lando
  lando start
  echo lando info
  lando info
  echo stopping lando
  lando stop
done

我运行这个并将 stderr 传输到文件中stderr.log......

~/workspace/lamp $ strace 2>stderr.log testlando.bash

...在跟踪该文件时查找82chown在另一个窗口中:

~/workspace/lamp $ tail -f tail -f stderr.log | egrep '\b82\b|chown'

# .........wait forever........

tail令人惊讶的是,尽管我的 bash 脚本最终失败并且在两个目录上设置了所有权和组(如上所述),但该命令实际上没有输出(^1)。

(我见过的唯一例外是这个输出,我思考纯属巧合--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=9941, si_uid=1000, si_status=0, si_utime=82, si_stime=6} ---:)

bash 脚本的输出(源自其中lando的命令 - 包括我的 Lando 插件的大量调试输出)始终类似于:

   starting lando

   BOOMSHAKALAKA!!!

   Your app has started up correctly.
   Here are some vitals:

    NAME            lamp                                       
    LOCATION        /home/ctamayo/workspace/lamp               
    SERVICES        appserver, database, cache, queue, console 

    APPSERVER URLS  https://localhost:32788                    
                    http://localhost:32789                     
                    http://lamp.lndo.site:8000                 
                    https://lamp.lndo.site                     

    CONSOLE URLS    http://beanstalk.lamp.lndo.site:8000       
                    https://beanstalk.lamp.lndo.site           

   lando info
   beanstalkd info
   { image: 'schickling/beanstalkd:latest',
     ports: [ '11333:11300' ],
     command: 'beanstalkd -p 11300',
     entrypoint: '/lando-entrypoint.sh',
     volumes: 
      [ '$LANDO_ENGINE_SCRIPTS_DIR/lando-entrypoint.sh:/lando-entrypoint.sh',
        '$LANDO_APP_ROOT_BIND:/app',
        '$LANDO_ENGINE_HOME:/user',
        '$LANDO_ENGINE_SCRIPTS_DIR/user-perms.sh:/user-perms.sh',
        '/home/ctamayo/.lando/services/config/scripts/load-keys.sh:/scripts/load-keys.sh',
        '/home/ctamayo/.lando/services/config/helpers/mysql-import.sh:/helpers/mysql-import.sh',
        '/home/ctamayo/.lando/services/config/helpers/mysql-export.sh:/helpers/mysql-export.sh' ],
     environment: 
      { LANDO_SERVICE_NAME: 'queue',
        LANDO_SERVICE_TYPE: 'beanstalkd',
        LANDO_MOUNT: '/app',
        LANDO: 'ON',
        LANDO_HOST_OS: 'linux',
        LANDO_HOST_UID: '1000',
        LANDO_HOST_GID: '1000',
        LANDO_HOST_IP: '10.0.10.20',
        LANDO_APP_ROOT: '/home/ctamayo/workspace/lamp',
        LANDO_APP_NAME: 'lamp',
        LANDO_WEBROOT_USER: 'www-data',            '$LANDO_ENGINE_SCRIPTS_DIR/user-perms.sh:/user-perms.sh',
        '/home/ctamayo/.lando/services/config/scripts/load-keys.sh:/scripts/load-keys.sh',
        '/home/ctamayo/.lando/services/config/helpers/mysql-import.sh:/helpers/mysql-import.sh',
        '/home/ctamayo/.lando/services/config/helpers/mysql-export.sh:/helpers/mysql-export.sh' ],
     environment: 
      { LANDO_SERVICE_NAME: 'console',
        LANDO_SERVICE_TYPE: 'beanstalkd_console',
        LANDO_MOUNT: '/app',
        LANDO: 'ON',
        LANDO_HOST_OS: 'linux',
        LANDO_HOST_UID: '1000',
        LANDO_HOST_GID: '1000',
        LANDO_HOST_IP: '10.0.10.20',
        LANDO_APP_ROOT: '/home/ctamayo/workspace/lamp',
        LANDO_APP_NAME: 'lamp',
        LANDO_WEBROOT_USER: 'www-data',
        LANDO_WEBROOT_GROUP: 'www-data',
        LANDO_WEBROOT_UID: '33',
        LANDO_WEBROOT_GID: '33',
        LANDO_LOAD_PP_KEYS: 'false',
        COLUMNS: 256,
        FOO: 'barrrrr',
        REDIS_HOST: 'cache',
        REDIS_PORT: '6379' },
     labels: { 'io.lando.container': 'TRUE' },
        LANDO_WEBROOT_GROUP: 'www-data',
        LANDO_WEBROOT_UID: '33',
        LANDO_WEBROOT_GID: '33',
        LANDO_LOAD_PP_KEYS: 'false',
        COLUMNS: 256,
        FOO: 'barrrrr',
        REDIS_HOST: 'cache',
        REDIS_PORT: '6379' },
     labels: { 'io.lando.container': 'TRUE' },
     type: 'beanstalkd',
     portforward: 11333,
     _app: 'lamp',
     _root: '/home/ctamayo/workspace/lamp',
     _mount: '/app',
     version: 'latest' }
   console info
   { image: 'schickling/beanstalkd-console:latest',
     ports: [ 2080 ],
     command: 'php -S 0.0.0.0:2080 -t /source/public',
     entrypoint: '/lando-entrypoint.sh',
     volumes: 
      [ '$LANDO_ENGINE_SCRIPTS_DIR/lando-entrypoint.sh:/lando-entrypoint.sh',
        '$LANDO_APP_ROOT_BIND:/app',
        '$LANDO_ENGINE_HOME:/user',
        '$LANDO_ENGINE_SCRIPTS_DIR/user-perms.sh:/user-perms.sh',
        '/home/ctamayo/.lando/services/config/scripts/load-keys.sh:/scripts/load-keys.sh',
        '/home/ctamayo/.lando/services/config/helpers/mysql-import.sh:/helpers/mysql-import.sh',
        '/home/ctamayo/.lando/services/config/helpers/mysql-export.sh:/helpers/mysql-export.sh' ],
     environment: 
      { LANDO_SERVICE_NAME: 'console',
        LANDO_SERVICE_TYPE: 'beanstalkd_console',
        LANDO_MOUNT: '/app',
        LANDO: 'ON',
        LANDO_HOST_OS: 'linux',
        LANDO_HOST_UID: '1000',
        LANDO_HOST_GID: '1000',
        LANDO_HOST_IP: '10.0.10.20',
        LANDO_APP_ROOT: '/home/ctamayo/workspace/lamp',
        LANDO_APP_NAME: 'lamp',
        LANDO_WEBROOT_USER: 'www-data',
        LANDO_WEBROOT_GROUP: 'www-data',
        LANDO_WEBROOT_UID: '33',
        LANDO_WEBROOT_GID: '33',
        LANDO_LOAD_PP_KEYS: 'false',
        COLUMNS: 256,
        FOO: 'barrrrr',
        REDIS_HOST: 'cache',
        REDIS_PORT: '6379' },
     labels: { 'io.lando.container': 'TRUE' },
     type: 'beanstalkd_console',
     _app: 'lamp',
     _root: '/home/ctamayo/workspace/lamp',
     _mount: '/app',
     version: 'latest' }
   undefined
   {
     "appserver": {
       "type": "php",
       "version": "7.1",
       "via": "apache",
       "webroot": "www",
       "urls": [
         "https://localhost:32788",
         "http://localhost:32789",
         "http://lamp.lndo.site:8000",
         "https://lamp.lndo.site"
       ]
     },
     "database": {
       "type": "mysql",
       "version": "latest",
       "creds": {
         "user": "lamp",
         "password": "lamp",
         "database": "lamp"
       },
       "internal_connection": {
         "host": "database",
         "port": 3306
       },
       "external_connection": {
         "host": "localhost",
         "port": "32773"
       }
     },
     "cache": {
       "type": "redis",
       "version": "latest",
       "internal_connection": {
         "host": "cache",
         "port": 6379
       },
       "external_connection": {
         "host": "localhost",
         "port": "not forwarded"
       }
     },
     "queue": {
       "type": "beanstalkd",
       "version": "latest",
       "internal_connection": {
         "host": "queue",
         "port": 11300
       },
       "external_connection": {
         "host": "localhost",
         "port": "11333"
       }
     },
     "console": {
       "type": "beanstalkd_console",
       "version": "latest",
       "internal_connection": {
         "host": "console",
         "port": 2080
       },
       "external_connection": {
         "host": "localhost",
         "port": 2080
       },
       "urls": [
         "http://beanstalk.lamp.lndo.site:8000",
         "https://beanstalk.lamp.lndo.site"
       ]
     }
   }
   stopping lando
   App stopped!
   starting lando

   BOOMSHAKALAKA!!!

   Your app has started up correctly.
   Here are some vitals:

    NAME            lamp                                       
    LOCATION        /home/ctamayo/workspace/lamp               
    SERVICES        appserver, database, cache, queue, console 

    APPSERVER URLS  https://localhost:32797                    
                    http://localhost:32798                     
                    http://lamp.lndo.site:8000                 
                    https://lamp.lndo.site                     

    CONSOLE URLS    http://beanstalk.lamp.lndo.site:8000       
                    https://beanstalk.lamp.lndo.site           

   lando info

这里没有直接的错误消息,它只是失败并停止。当我lando start再次运行时,我得到:

   error:  Error: EACCES: permission denied, open '/home/ctamayo/.lando/services/config/scripts/add-cert.sh'
       at Error (native)
       at Object.fs.openSync (fs.js:642:18)
       at copyFileSync (/usr/lib/lando/node_modules/fs-extra/lib/copy.js:16:16)
       at copySync (/usr/lib/lando/node_modules/fs-extra/lib/copy.js:85:7)
       at /usr/lib/lando/node_modules/fs-extra/lib/copy.js:91:7
       at Array.forEach (native)
       at Object.copySync (/usr/lib/lando/node_modules/fs-extra/lib/copy.js:90:14)
       at moveConfig (/usr/lib/lando/plugins/lando-services/lib/services.js:65:10)
       at module.exports (/usr/lib/lando/plugins/lando-services/lib/services.js:134:16)
       at AsyncEvents.<anonymous> (/usr/lib/lando/plugins/lando-services/lib/bootstrap.js:21:43)
       at AsyncEvents.handle (/usr/lib/lando/lib/events.js:109:19)
       at /usr/lib/lando/lib/events.js:170:19
       at tryCatcher (/usr/lib/lando/node_modules/bluebird/js/release/util.js:16:23)
       at Object.gotValue (/usr/lib/lando/node_modules/bluebird/js/release/reduce.js:155:18)
       at Object.gotAccum (/usr/lib/lando/node_modules/bluebird/js/release/reduce.js:144:25)
       at Object.tryCatcher (/usr/lib/lando/node_modules/bluebird/js/release/util.js:16:23)
       at Promise._settlePromiseFromHandler (/usr/lib/lando/node_modules/bluebird/js/release/promise.js:512:31)
       at Promise._settlePromise (/usr/lib/lando/node_modules/bluebird/js/release/promise.js:569:18)
       at Promise._settlePromise0 (/usr/lib/lando/node_modules/bluebird/js/release/promise.js:614:10)
       at Promise._settlePromises (/usr/lib/lando/node_modules/bluebird/js/release/promise.js:693:18)
       at Async._drainQueue (/usr/lib/lando/node_modules/bluebird/js/release/async.js:133:16)
       at Async._drainQueues (/usr/lib/lando/node_modules/bluebird/js/release/async.js:143:10)
~/.lando/config.yml注意:只有当我告诉 Lando 通过(见下文) 运行插件时才会发生这种情况。如果没有引用该插件,bash 脚本会持续运行几个小时。

问题比比皆是

我该如何进行进一步的调试?strace我需要从 bash 脚本中调用吗?除了 和 朋友之外还有其他系统调用chown可能会这样做吗?到底有什么意义82

是的,是82。

预先感谢(所有的鱼)。

兰多配置内容

不确定这最终会有多大相关性,但这是我的 LAMP 应用程序的 Lando 配置:

# ~/workspace/lamp/.lando.yml
name: lamp
recipe: lamp
config:
  webroot: www
services:
  cache:
    type: redis
    persist: true
  queue:
    type: beanstalkd
    portforward: 11333
  console:
    type: beanstalkd_console
proxy:
  console:
    - beanstalk.lamp.lndo.site
tooling:
  redis-cli:
    service: cache

还有我的 ~/.lando/config 文件,它告诉 lando 加载我的自定义lando-beanstalkd插件(位于~/.lando/plugins/lando-beanstalkd):

plugins:
  - lando-core
  - lando-events
  - lando-proxy
  - lando-recipes
  - lando-services
  - lando-tooling
  - lando-beanstalkd
logLevelConsole: warn
logLevel: debug

更新:v2.0 故障排除

所以。情节变得更加复杂。~/.ssh也改变了我的目录的所有权。

total 44
drwxr-xr-x  2      82      82  4096 Nov 28 14:40 .
drwx------ 79 ctamayo ctamayo  4096 Dec 15 15:06 ..
-rw-------  1      82      82   472 Nov 28 14:40 config
-rw-------  1      82      82  1766 Jun 19 13:20 id_rsa
-rw-r--r--  1      82      82   410 Jun 19 13:20 id_rsa.pub
-rw-r--r--  1      82      82 14600 Nov 28 14:40 known_hosts
-rwx------  1      82      82  3239 Oct 24 12:31 lando_rsa
-rw-r--r--  1      82      82   750 Oct 24 12:31 lando_rsa.pub

就像,WTF。

不管怎样,只是为了把这个扔出去,在我的插件代码中对chownchmod或 的引用为零。chgrp兰多本身有一些。前几个 GitHub 搜索结果似乎相关,因此我将此代码添加到相关sh脚本(load-keys.sh 和 user-perms.sh)中:

if [ $LANDO_WEBROOT_USER = 82 ]; then
  echo '$LANDO_WEBROOT_USER is 82! Bailing...'
  exit 1
fi

if [ $LANDO_WEBROOT_GROUP = 82 ]; then
  echo '$LANDO_WEBROOT_GROUP is 82! Bailing...'
  exit 1
fi

再次运行我的 bash 脚本会产生相同的输出。没有提及$LANDO_WEBROOT_USER$LANDO_WEBROOT_GROUP。不过,这些脚本似乎在容器内运行,因此它们的输出可能会被抑制...请继续关注更多信息...

相关内容