Page 1 of 3

nmcontrol on linux

Posted: Thu Oct 29, 2015 5:51 pm
by barkingdoggy
Downloaded https://github.com/namecoin/nmcontrol.git. Following instructions on README.md, install pukes on "pip install bottle" command.

Code: Select all

Collecting bottle
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached bottle-0.12.9.tar.gz
Installing collected packages: bottle
  Running setup.py install for bottle
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-kX1Iil/bottle/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-V4QsjO-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-i686-2.7
    copying bottle.py -> build/lib.linux-i686-2.7
    running build_scripts
    creating build/scripts-2.7
    copying and adjusting bottle.py -> build/scripts-2.7
    changing mode of build/scripts-2.7/bottle.py from 644 to 755
    running install_lib
    copying build/lib.linux-i686-2.7/bottle.py -> /usr/local/lib/python2.7/dist-packages
    error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/bottle.py'
    
    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-kX1Iil/bottle/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-V4QsjO-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-kX1Iil/bottle
User problem or bug?

Re: nmcontrol on linux

Posted: Fri Oct 30, 2015 12:54 am
by cassini
Try this:
(assuming PIP has already been installed successfully)

Code: Select all

sudo -H pip install virtualenv
virtualenv env	
. env/bin/activate
pip install bottle
git clone https://github.com/namecoin/nmcontrol/
cd nmcontrol
./nmcontrol.py --daemon=0 --debug=1 start
# (alternatively: python ./nmcontrol.py --daemon=0 --debug=1 start)

Re: nmcontrol on linux

Posted: Fri Oct 30, 2015 1:47 pm
by barkingdoggy
No go on the second command ("virtualenv env").

Code: Select all

Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 994, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1170, in install_python
    mkdir(lib_dir)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 448, in mkdir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: 'env'
Ideas? TIA

Re: nmcontrol on linux

Posted: Fri Oct 30, 2015 10:07 pm
by cassini
barkingdoggy wrote:OSError: [Errno 13] Permission denied: 'env'

Ideas? TIA
The answer depends on which Linux variant you use, also what type of user you are logged in as. (See "id" command.)
The most generic answer is: always try "sudo" if there is a permission denied problem, e.g.

Code: Select all

...

sudo virtualenv env   
. env/bin/activate
# (or try: source env/bin/activate)
sudo pip install bottle
git clone https://github.com/namecoin/nmcontrol/
cd nmcontrol
./nmcontrol.py --daemon=0 --debug=1 start
# (or try: python ./nmcontrol.py --daemon=0 --debug=1 start)

Re: nmcontrol on linux

Posted: Sat Oct 31, 2015 8:58 pm
by phelix
you need to use "sudo pip install bottle" (needs to be added to the readme)

You can change the port in service-dns.conf to 127.0.1.1 (instead of 127.0.0.1). otherwise you will have to start nmcontrol with "sudo", too. at least this trick worked on my ubuntu machine. if others can confirm zhis we could maybe change the default ip.

also we might add a part about editing resolv.conf to explain how the system dns can be changed.

Re: nmcontrol on linux

Posted: Sun Nov 01, 2015 11:08 pm
by barkingdoggy
I'm running Mint. Sudo fixes permissions re bottle.py.

nmcontrol runs without errors(?) and handles .com queries, but .bit queries return one IP address.

Code: Select all

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ python ./nmcontrol.py
2015-11-01 17:23:12,572 - __main__ - INFO - #######################################################
2015-11-01 17:23:12,656 - __main__ - INFO - Entering background mode
john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup google.com
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	google.com
Address: 74.125.226.2
Name:	google.com
Address: 74.125.226.0
Name:	google.com
Address: 74.125.226.4
Name:	google.com
Address: 74.125.226.14
Name:	google.com
Address: 74.125.226.9
Name:	google.com
Address: 74.125.226.6
Name:	google.com
Address: 74.125.226.3
Name:	google.com
Address: 74.125.226.7
Name:	google.com
Address: 74.125.226.1
Name:	google.com
Address: 74.125.226.5
Name:	google.com
Address: 74.125.226.8

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup isit.bit
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	isit.bit
Address: 92.242.140.21

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup nx.bit
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	nx.bit
Address: 92.242.140.21
The readme file (https://github.com/namecoin/nmcontrol/b ... /README.md) says "# alternatively start in debug mode:
nmcontrol.py --daemon=0 --debug=1 start"
But when I try that, I get an error saying "--d is not an option."

How do I start in nmcontrol.py debug mode in linux?

Re: nmcontrol on linux

Posted: Mon Nov 02, 2015 2:54 pm
by cassini
barkingdoggy wrote:How do I start in nmcontrol.py debug mode in linux?
Look for plugin-main.conf (probably located in ~/Library/Application Support/Nmcontrol/ ). Edit this file and remove the semicolons in front of debug and daemon. It should then look like this:

Code: Select all

[main]
; Debug mode - choices: <0|1>
debug=1

; Launch at startup
;start=1

; Background mode - choices: <0|1>
daemon=0
Now start with ./nmcontrol.py or python ./nmcontrol.py or sudo python ./nmcontrol.py
You'll get a file log.txt that contains the debug messages (most likely in the same directory as the .conf files).

Re: nmcontrol on linux

Posted: Mon Nov 02, 2015 8:56 pm
by phelix
cassini wrote:
barkingdoggy wrote:How do I start in nmcontrol.py debug mode in linux?
Look for plugin-main.conf (probably located in ~/Library/Application Support/Nmcontrol/ ). Edit this file and remove the semicolons in front of debug and daemon. It should then look like this:

Code: Select all

[main]
; Debug mode - choices: <0|1>
debug=1

; Launch at startup
;start=1

; Background mode - choices: <0|1>
daemon=0
Now start with ./nmcontrol.py or python ./nmcontrol.py or sudo python ./nmcontrol.py
You'll get a file log.txt that contains the debug messages (most likely in the same directory as the .conf files).
unfortunately it seems this conf option never actually worked.

just start like this for debug mode:

Code: Select all

python ./nmcontrol.py --debug=1
on Linux it will then go into daemon mode. (check with "ps -aux" whether you have multiple instances running already). you can then do the lookup test and see what the problem is in the log.

I have created a pull request to make setting debug mode via the conf file actually work. also I will look at why "--daemon=0" does not work any more.

Re: nmcontrol on linux

Posted: Wed Nov 04, 2015 1:47 am
by barkingdoggy
Debug log does not record any "transactions". All it shows is:

Code: Select all

2015-11-03 20:21:29,652 - __main__ - INFO - #######################################################
2015-11-03 20:21:29,653 - __main__ - DEBUG - DEBUG MODE
2015-11-03 20:21:29,667 - __main__ - DEBUG - launching service serviceDNS
2015-11-03 20:21:29,697 - __main__ - DEBUG - launching plugin pluginHttp
2015-11-03 20:21:29,765 - __main__ - DEBUG - launching plugin pluginNamespaceDomain
2015-11-03 20:21:29,768 - __main__ - DEBUG - launching plugin pluginData
2015-11-03 20:21:29,774 - __main__ - DEBUG - launching plugin pluginSystray
2015-11-03 20:21:29,777 - __main__ - DEBUG - launching plugin pluginDns
2015-11-03 20:21:29,780 - __main__ - DEBUG - launching plugin pluginRpc
2015-11-03 20:21:29,783 - __main__ - INFO - Entering background mode
Here's what I tested it with.

Code: Select all

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup google.com
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	google.com
Address: 65.199.32.151
Name:	google.com
Address: 65.199.32.149
Name:	google.com
Address: 65.199.32.153
Name:	google.com
Address: 65.199.32.150
Name:	google.com
Address: 65.199.32.152
Name:	google.com
Address: 65.199.32.148
Name:	google.com
Address: 65.199.32.155
Name:	google.com
Address: 65.199.32.154

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup isit.bit
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	isit.bit
Address: 92.242.140.21

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup nx.bit
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	nx.bit
Address: 92.242.140.21

john@john-ThinkPad-X300 ~/Desktop/nmcontrol-master $ nslookup google.bit
Server:		127.0.1.1
Address:	127.0.1.1#53

Non-authoritative answer:
Name:	google.bit
Address: 92.242.140.21

Note that it returns 92.242.140.21 for any/all .bit queries.

Re: nmcontrol on linux

Posted: Wed Nov 04, 2015 10:00 am
by phelix
phelix wrote: You can change the port in service-dns.conf to 127.0.1.1 (instead of 127.0.0.1).
This turned out to be complete bogus (127.0.1.1 is by default directed to the system dns). :roll:

So please stick to 127.0.0.1

The only simple solution is to start nmcontrol.py with sudo:

Code: Select all

sudo python ./nmcontrol.py --debug=1
Maybe one of the Linux gurus has a better suggestion. A quick websearch brings up this: http://www.golinuxhub.com/2012/08/chang ... erver.html I can't test at the moment as I don't have a Linux machine in reach today.