{"action":"created","issue":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/479","repository_url":"https://api.github.com/repos/svinota/pyroute2","labels_url":"https://api.github.com/repos/svinota/pyroute2/issues/479/labels{/name}","comments_url":"https://api.github.com/repos/svinota/pyroute2/issues/479/comments","events_url":"https://api.github.com/repos/svinota/pyroute2/issues/479/events","html_url":"https://github.com/svinota/pyroute2/issues/479","id":313518601,"number":479,"title":"\"failed to open netns\" in chroot w/ sudo","user":{"login":"itdaniher","id":22683,"avatar_url":"https://avatars2.githubusercontent.com/u/22683?v=4","gravatar_id":"","url":"https://api.github.com/users/itdaniher","html_url":"https://github.com/itdaniher","followers_url":"https://api.github.com/users/itdaniher/followers","following_url":"https://api.github.com/users/itdaniher/following{/other_user}","gists_url":"https://api.github.com/users/itdaniher/gists{/gist_id}","starred_url":"https://api.github.com/users/itdaniher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itdaniher/subscriptions","organizations_url":"https://api.github.com/users/itdaniher/orgs","repos_url":"https://api.github.com/users/itdaniher/repos","events_url":"https://api.github.com/users/itdaniher/events{/privacy}","received_events_url":"https://api.github.com/users/itdaniher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-04-11T23:11:10Z","updated_at":"2018-04-12T15:51:40Z","closed_at":null,"author_association":"NONE","body":"Have a 32b chroot on a 64b (ARM) machine. Pyroute2 doesn't seem to play ball with network namespaces when inside a chroot. `ip netns exec <ns> <cmd>` works fine either way.\r\n\r\nHere's a basic example.\r\n\r\n> sudo ip netns add test\r\n> sudo python3 test.py\r\n\r\nwhere test.py is\r\n```python\r\nfrom pyroute2 import IPDB, NetNS\r\nwith IPDB(nl=NetNS(\"test\")) as ipdb_ns:\r\n    print(ipdb_ns)\r\n```\r\n\r\nExpected result (what happens when not in chroot):\r\n```\r\n<pyroute2.ipdb.main.IPDB object at 0x7ffoobar>\r\n```\r\nActual result (what happens in chroot):\r\n```python\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 2, in <module>\r\n    with IPDB(nl=NetNS(\"test\")) as ipdb_ns:\r\n  File \"/home/name/.virtualenvs_32b/test-oS4OC6Nn/lib/python3.6/site-packages/pyroute2/netns/nslink.py\", line 193, in __init__\r\n    super(NetNS, self).__init__()\r\n  File \"/home/name/.virtualenvs_32b/test-oS4OC6Nn/lib/python3.6/site-packages/pyroute2/netlink/nlsocket.py\", line 296, in __init__\r\n    super(NetlinkMixin, self).__init__()\r\n  File \"/home/name/.virtualenvs_32b/test-oS4OC6Nn/lib/python3.6/site-packages/pyroute2/remote/__init__.py\", line 253, in __init__\r\n    raise init['error']\r\nOSError: [Errno 22] failed to open netns: 'test'\r\n```\r\n\r\nI haven't tested a 64b host with a 64b chroot.\r\n"},"comment":{"url":"https://api.github.com/repos/svinota/pyroute2/issues/comments/380853871","html_url":"https://github.com/svinota/pyroute2/issues/479#issuecomment-380853871","issue_url":"https://api.github.com/repos/svinota/pyroute2/issues/479","id":380853871,"user":{"login":"svinota","id":814602,"avatar_url":"https://avatars0.githubusercontent.com/u/814602?v=4","gravatar_id":"","url":"https://api.github.com/users/svinota","html_url":"https://github.com/svinota","followers_url":"https://api.github.com/users/svinota/followers","following_url":"https://api.github.com/users/svinota/following{/other_user}","gists_url":"https://api.github.com/users/svinota/gists{/gist_id}","starred_url":"https://api.github.com/users/svinota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/svinota/subscriptions","organizations_url":"https://api.github.com/users/svinota/orgs","repos_url":"https://api.github.com/users/svinota/repos","events_url":"https://api.github.com/users/svinota/events{/privacy}","received_events_url":"https://api.github.com/users/svinota/received_events","type":"User","site_admin":false},"created_at":"2018-04-12T15:51:40Z","updated_at":"2018-04-12T15:51:40Z","author_association":"OWNER","body":"Interesting. Thanks, I'll try to reproduce"}}
{"actor":{"display_login":"svinota"}}