在 Nao(机器人)上切换到 root 用户时出现问题

问题描述 投票:0回答:2

我现在正在尝试连接到 Nao 机器人以安装 mqtt 客户端/监听器。我的目标是使用 pip 安装 paho-mqtt(按照本 tutorial 使用命令

pip install paho-mqtt
。因此,我需要管理员权限(root 用户),但是,我无法使用
su
切换用户帐户,因为我我收到错误“身份验证失败”,错误代码为 1。

这是我尝试过的:

  1. 如果我从

    nao
    用户调用pip install paho-mqtt,我只能检索只读文件并且安装失败。

  2. 如果我从

    nao
    用户调用 sudo pip install paho-mqtt,我会收到错误消息:“抱歉,不允许用户 nao 在 nao 上以 root 身份执行‘/usr/bin/pip install paho-mqtt’。

  3. 我尝试了

    pip install paho-mqtt --user
    ,理论上可行,但将其安装到 /.local/ 目录,并且它不会激活并主动侦听发送的内容。 (下面是这些尝试结果的一些屏幕截图)

  4. 我尝试过

    pip install paho-mqtt --root /usr/lib/python2.7/site-packages
    ,但在这里我遇到了用户权限问题,即作为用户 nao,该目录是只读的,不可写。

  5. 我在机器人通过以太网电缆连接和不连接时尝试过。

  6. 我尝试通过原始连接(同时与以太网连接)和 telnet 进行连接,但这些连接被阻止。

其他事项:

  • 机器人和笔记本电脑在同一网络中
  • root密码仍然是标准密码
  • 我尝试使用未连接到互联网且仅通过以太网连接的机器人
  • 我执行了恢复出厂设置
  • 我尝试通过文件传输从另一个 nao 机器人加载安装文件。
  • 我尝试授予 nao 用户管理员权限 - 但如果没有 root 用户也无法工作

我目前的结论是,文档也指出,root 用户已被阻止通过 ssh 连接进行访问。 现在我试图找到一种不同的方式来连接到机器人中的 root 用户并安装 paho-mqtt 包。 其他人有问题或有任何想法如何在不使用 ssh 的情况下连接到机器人吗?

我知道人们设法规避了这个问题,我非常感谢您的帮助并告诉我如何做到。

> nao [0] ~ $ su root
Password:
su: Authentication failure
> nao [err 1] ~ $ pip install paho-mqtt
Collecting paho-mqtt
  Using cached https://files.pythonhosted.org/packages/f8/dd/4b75dcba025f8647bc9862ac17299e0d7d12d3beadbf026d8c8d74215c12/paho-mqtt-1.6.1.tar.gz
Installing collected packages: paho-mqtt
  Running setup.py install for paho-mqtt ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-VYAcPd/paho-mqtt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-5pl4_S/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/paho
    copying src/paho/__init__.py -> build/lib/paho
    creating build/lib/paho/mqtt
    copying src/paho/mqtt/subscribeoptions.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/subscribe.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/reasoncodes.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/publish.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/properties.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/packettypes.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/matcher.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/client.py -> build/lib/paho/mqtt
    copying src/paho/mqtt/__init__.py -> build/lib/paho/mqtt
    running egg_info
    writing requirements to src/paho_mqtt.egg-info/requires.txt
    writing src/paho_mqtt.egg-info/PKG-INFO
    writing top-level names to src/paho_mqtt.egg-info/top_level.txt
    writing dependency_links to src/paho_mqtt.egg-info/dependency_links.txt
    reading manifest file 'src/paho_mqtt.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no files found matching 'epl-v10'
    writing manifest file 'src/paho_mqtt.egg-info/SOURCES.txt'
    running install_lib
    creating /usr/lib/python2.7/site-packages/paho
    error: could not create '/usr/lib/python2.7/site-packages/paho': Read-only file system

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-VYAcPd/paho-mqtt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-5pl4_S/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-VYAcPd/paho-mqtt/
> nao [err 1] ~ $ pip list
Package         Version
--------------- -----------
asn1crypto      0.24.0
backports-abc   0.4
catkin-pkg      0.2.10
certifi         2018.11.29
cffi            1.11.5
chardet         3.0.4
cryptography    2.3
enum34          1.1.6
fail2ban        0.10.3.fix1
idna            2.7
ipaddress       1.0.22
ndg-httpsclient 0.5.1
numpy           1.14.5
pil-compat      1.0.0
Pillow          3.1.1
pip             18.0
ply             3.11
pyasn1          0.4.4
pycparser       2.18
pycryptodome    3.4.11
pygobject       3.28.3
pyinotify       0.9.6
pyOpenSSL       18.0.0
pyserial        3.4
PySocks         1.6.8
python-dateutil 2.7.3
PyYAML          3.13
requests        2.19.1
setuptools      40.0.0
simplejson      3.16.0
singledispatch  3.4.0.3
six             1.11.0
systemd-python  234
TornadIO2       0.0.3
tornado         4.5.3
urllib3         1.23
vobject         0.9.6.1
> nao [0] ~ $ sudo pip install paho-mqtt
Password:
Sorry, user nao is not allowed to execute '/usr/bin/pip install paho-mqtt' as root on nao.
> nao [err 1] ~ $ sudo pip install paho-mqtt --root /usr/lib/python2.7/site-packages
Password:
Sorry, user nao is not allowed to execute '/usr/bin/pip install paho-mqtt --root /usr/lib/python2.7/site-packages' as root on nao.
python ssh pip root nao-robot
2个回答
0
投票

在最新版本的 NAOqi 操作系统上,不允许 root 访问。 请尝试使用

--user
或在
venv
内。


0
投票

我遇到了同样的问题,但发现他们只是禁用了以root身份登录,你仍然可以以root身份运行命令使用sudo

© www.soinside.com 2019 - 2024. All rights reserved.