【问题标题】:Volttron - refusing to run as root to prevent potential damageVolttron - 拒绝以 root 身份运行以防止潜在的损坏
【发布时间】:2017-12-22 15:30:21
【问题描述】:

我正在虚拟机上运行 Ubuntu Desktop 16.04,并尝试使用标准安装说明运行 Volttron,但是在执行以下步骤后我一直收到错误消息:

sudo apt-get update
sudo apt-get install build-essential python-dev openssl libssl-dev libevent-dev git
git clone https://github.com/VOLTTRON/volttron
cd volttron
python bootstrap.py

我的问题在于最后一步python bootstrap.py。一旦我到达这一步,我就会从终端窗口中收到错误bootstrap.py: error: refusing to run as root to prevent potential damage.

还有其他人遇到过这个问题吗?想法?

【问题讨论】:

    标签: python git error-handling terminal volttron


    【解决方案1】:

    来自this part of bootstrap.py(和this commit

    # Refuse to run as root
    if not getattr(os, 'getuid', lambda: -1)():
        sys.stderr.write('%s: error: refusing to run as root to prevent '
                         'potential damage.\n' % os.path.basename(argv[0]))
        sys.exit(77)
    

    所以检查你是否有os.getuid(当前进程的真实用户ID),因为getattr提到:

    如果命名属性不存在,则返回默认值(如果提供),否则引发AttributeError

    见“What is difference between os.getuid() and os.geteuid()?”。
    也许您的终端窗口是以 root 身份启动的。 (查看id -a的输出)

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题,因为 volttron 没有设置虚拟环境的权限,所以我输入了这个:

      sudo chmod -R 777 /path_of_volttron_location
      

      【讨论】:

        猜你喜欢
        • 2014-07-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-09
        • 1970-01-01
        • 1970-01-01
        • 2017-07-29
        • 2013-12-19
        相关资源
        最近更新 更多