Setup VirtualBox in Devuan

I played with QEMU for few hours and previous VirtualBox experince made me back to it.  QEMU’s virtual machine was sloppy.

vm-alpha1

Find the header package of current kernel version of the system. ‘ uname -a’ will show the version number of kernel image.

In my Devuan, the header pacakge is linux-headers-3.16.0-4-amd64

$ sudo aptitude install linux-headers-3.16.0-4-amd64

Install VirtualBox packages

$ sudo aptitude install virtualbox virtualbox-qt virtualbox-dkms

Check the kernel modules of VirtualBox are loaded.

$ lsmod | grep
vboxpci 23077 0
vboxnetadp 25443 0
vboxnetflt 23324 1
vboxdrv 340067 4 vboxnetadp,vboxnetflt,vboxpci

Add the user to vboxusers group. This is critical part of the VirtualBox operation.

$ sudo adduser user_name vboxusers

There are VirtualBox tutorials in Linux that explain how to creat a virtual machine. So I would not write here.

Start VBoxMange in a console or click VirtualBox on the popup menu of your window manager.

virtualboxmanager

virtualbox-about

I used devuan-jessie-netboot-amd64-alpha2.iso to create a Devuan virtual machine. At the end of package installation of Select and install software section, I a failure message which was trivial one.

I chose GRUB installation and it was successful.

virtualbox-alpha2-installation-error1

Assign external IP address to a virtual machine

Default network adapter for the guest (virtual machine) is NAT which separates the guest machine from the host’s private network.  The link explains various network setting of the guest machine.(https://www.virtualbox.org/manual/ch06.html#nichardware)

I uses Briged Adapter because it’s easy to set up. Start or activate the Virtual Box Manager, select the guest machine. If the machine is running, power it off.

Select Network menu.

Select Adapter 1.

Change NAT to Briged Adapter in ‘Attached to’. Assign an active network device of the host, i.e. eth0. To find active network devices, run ‘sudo ifconfig’.  For example, here is my result.


$ sudo ifconfig
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
...
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

inet 127.0.0.1 netmask 255.0.0.0

Next time you start the guest machine, it will have a private IP address automatically, i.e. 192.168.1.105.

Start a virtual machine in a console

You can skip the two steps of starting a virtual machine. Normally VBoxManage starts the Virtual Box Manager then you select a virtual machine, press Run.

Below command will show all virtual machines. In my case I had one virtual machine.

$ VBoxManage list vms
“alpha1” {5a818ca5-dbf6-4ba4-95f8-030b1b4aa6e5}

VBoxMange startvm virtual_machine_name launces the virtual machine.

$ VBoxManage startvm alpha1
Waiting for VM “alpha1” to power on…
VM “alpha1” has been successfully started.

I made start-vm1.sh in ~/bin directory.
#!/bin/bash

VBoxManage startvm alpha1

 

Posted in GNU/Linux, Uncategorized | Tagged , , , | Leave a comment

Change the default keyboard layout in Devuan

In Devuan, run the two commands to permanetly change the default keyboard layout..

$ sudo dpkg-reconfigure keyboard-configuration
$ sudo service keyboard-setup restart


Posted in GNU/Linux, Uncategorized | Tagged , , , | Leave a comment

Build IPython for Python 3.x

I use IPython as SymPy interface which serves as command-line CAS (Computer Algebra System) application. It’s one of critical software I depend on whenever I study mathematics.

I decided to uprade IPython for Python 3.x because I felt making Python 2.x codes become obsolete.

My Linux workstation runs in AMD 64-bit Devuan 1.0 (Debian 8.x without systemd.)

It was first time for me to install Python package from source build.

Install pip package.
It installs Python module or program.

$ sudo aptitude install python3-pip

The following NEW packages will be installed:
python3-chardet{a} python3-colorama{a} python3-distlib{a} python3-html5lib{a}
python3-pip python3-pkg-resources{a} python3-requests{a}
python3-setuptools{a}
python3-six{a} python3-urllib3{a}
The following packages are RECOMMENDED but will NOT be installed:
python3-dev python3-wheel
0 packages upgraded, 10 newly installed, 0 to remove and 17 not
upgraded.
Need to get 842 kB of archives. After unpacking 3,737 kB will be used.

$ sudo pip3 --version
pip 1.5.6 from /usr/lib/python3/dist-packages (python 3.4)

Source build installation of IPython
It connects to a python repository and download the ipython source file.
$ sudo pip3 install ipython

...
Running setup.py install for pexpect

Running setup.py install for pickleshare

Running setup.py install for ptyprocess

Successfully installed ipython simplegeneric pexpect traitlets pickleshare decorator ptyprocess ipython-genutils path.py
Cleaning up...

If the installation is failed, it saves /root/.pip/pip.log

When I started IPython 4.0.1, it complained matplotlib was missing, which is the plotting library.

Install matplotlib module

The first attempt failed due to two missing libraries: freetype and png.

After multiple installation failure, slow download speed of the package file forced me to download the package file and use it over and over.

Only download matplotlib package file in ~/Admin directory.
$ sudo pip3 install -d ~/Admin matplotlib

I ran the below command several times until I successfully built matplotlib module.

$ sudo pip3 install ./matplotlib-1.5.0.tar.gz


$ sudo pip3 install matplotlib

Downloading/unpacking matplotlib
Downloading matplotlib-1.5.0.tar.gz (54.0MB): 54.0MB downloaded
Running setup.py (path:/tmp/pip-build-v30xilsb/matplotlib/setup.py) egg_info for package matplotlib
======================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
matplotlib: yes [1.5.0]
python: yes [3.4.3+ (default, Oct 10 2015, 09:15:38) [GCC
5.2.1 20151028]]
platform: yes [linux]

======================================================================
* The following required packages can not be built:
* freetype, png

Install libfreetype6-dev


$ sudo aptitude install libfreetype6-dev
The following NEW packages will be installed:
libfreetype6-dev{b} libpng12-dev{a} zlib1g-dev{a}
0 packages upgraded, 3 newly installed, 0 to remove and 17 not upgraded.
Need to get 1,094 kB of archives. After unpacking 4,706 kB will be used.
The following packages have unmet dependencies:
libfreetype6-dev : Depends: libfreetype6 (= 2.5.2-3) but 2.6-2 is installed.
The following actions will resolve these dependencies:

Keep the following packages at their current version:
1) libfreetype6-dev [Not Installed]

Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

Downgrade the following packages:
1) libfreetype6 [2.6-2 (now) -> 2.5.2-3 (stable)]

I did not install libpng packages because in second attempt, it did not report missing png library. And it reported missing fortran compiler.

Install gfortran package

$ sudo aptitude install gfortran

In the third attempt of installion, during numpy module compilation, missing Python.h file terminated the build process.
It turned out libpython3.4-dev package contains Python.h header file.

On the net Debian or Ubuntu users recommended python3-dev package so I installed it that included libpython3-dev.

$ aptitude install python3-dev

Downgrade the following packages:
1) libexpat1 [2.1.0-7 (now) -> 2.1.0-6+deb8u1 (stable)]
2) libpython3-stdlib [3.4.3-7 (now) -> 3.4.2-2 (stable)]
3) libpython3.4-minimal [3.4.3-10+b1 (now) -> 3.4.2-1 (stable)]
4) libpython3.4-stdlib [3.4.3-10+b1 (now) -> 3.4.2-1 (stable)]
5) python3 [3.4.3-7 (now) -> 3.4.2-2 (stable)]
6) python3-minimal [3.4.3-7 (now) -> 3.4.2-2 (stable)]
7) python3.4 [3.4.3-10+b1 (now) -> 3.4.2-1 (stable)]
8) python3.4-minimal [3.4.3-10+b1 (now) -> 3.4.2-1 (stable)]

Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
libexpat1 libpython3-stdlib libpython3.4-minimal libpython3.4-stdlib python3
python3-minimal python3.4 python3.4-minimal
The following NEW packages will be installed:
libexpat1-dev{a} libpython3-dev{a} libpython3.4{a} libpython3.4-dev{a}
python3-dev python3.4-dev{a}
0 packages upgraded, 6 newly installed, 8 downgraded, 0 to remove and 17 not upgraded.
Need to get 46.0 MB of archives. After unpacking 56.1 MB will be used.

Finally, I ran IPython test program to make sure its integrity and features. Each test discovered missing module that IPython requires: nose, pygments, ipykernel, testpath. Note that ipykernel installs three additional modules, jupyter-client, pyzmq, and jupyter-core.


$ sudo pip3 install nose
Downloading/unpacking nose
Downloading nose-1.3.7-py3-none-any.whl (154kB): 154kB downloaded
Installing collected packages: nose
Successfully installed nose
Cleaning up...

$ sudo pip3 install pygments
Downloading/unpacking pygments
Downloading Pygments-2.0.2-py3-none-any.whl (672kB): 672kB downloaded
Installing collected packages: pygments
Successfully installed pygments
Cleaning up...

$ sudo pip3 install ipykernel
Downloading/unpacking ipykernel
Downloading ipykernel-4.2.1-py2.py3-none-any.whl (90kB): 90kB downloaded
Requirement already satisfied (use --upgrade to upgrade): traitlets in /usr/local/lib/python3.4/dist-packages (from ipykernel)
Downloading/unpacking jupyter-client (from ipykernel)
Downloading jupyter_client-4.1.1-py2.py3-none-any.whl (70kB): 70kB downloaded
Requirement already satisfied (use --upgrade to upgrade): ipython>=4.0.0 in /usr/local/lib/python3.4/dist-packages (from ipykernel)
Downloading/unpacking pyzmq>=13 (from jupyter-client->ipykernel)
Downloading pyzmq-15.1.0.tar.gz (1.1MB): 1.1MB downloaded
Running setup.py (path:/tmp/pip-build-njsaza8r/pyzmq/setup.py) egg_info for package pyzmq
...snip...
warning: no previously-included files matching 'Makefile.in' found anywhere in distribution
Successfully installed ipykernel jupyter-client pyzmq jupyter-core
Cleaning up...

$ sudo pip3 install testpath
Downloading/unpacking testpath
Downloading testpath-0.2-py2.py3-none-any.whl
Installing collected packages: testpath
Successfully installed testpath
Cleaning up...

Test command I ran

$ iptest 2>&1 | tee iptest3.log

It stores error messages and screen output to iptest3.log file.
1 is standard output discriptor normally means text in the termal.
2 is standard error discriptor.

All seven tests passed.

Test suite completed for system with the following information:
IPython version: 4.0.1
IPython commit : 03b6385 (installation)
IPython package: /usr/local/lib/python3.4/dist-packages/IPython
Python version : 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1]
sys.executable : /usr/bin/python3
Platform : Linux-3.16.0-4-amd64-x86_64-with-debian-8.2

Tools and libraries available at test time:
matplotlib pygments sqlite3

Status: OK (7 test groups). Took 46.269s.


Test group: core
.......................................................................S..S...........
......................................................................................
.....................................................................................S
................S.........................S.
KeyboardInterrupt
....S............................................S............S../usr/local/lib/python
3.4/dist-packages/IPython/core/magics/extension.py:47: UserWarning: %install_ext` is d
eprecated, please distribute your extension(s)as a python packages.
"as a python packages.", UserWarning)
.S....................................................................................
..............S................S.....................S............
----------------------------------------------------------------------
Ran 519 tests in 17.019s

OK (SKIP=12)

Test group: extensions
..
----------------------------------------------------------------------
Ran 2 tests in 0.007s

OK

Test group: lib
...........................S..........................................
----------------------------------------------------------------------
Ran 70 tests in 2.073s

OK (SKIP=1)

Test group: terminal
........S..........
----------------------------------------------------------------------
Ran 19 tests in 5.038s

OK (SKIP=1)

Test group: testing
..S..S............S..
----------------------------------------------------------------------
Ran 21 tests in 3.476s

OK (SKIP=3)

Test group: utils
...............................................................................S......
..SSS...S.....S...............S..S...........................................
----------------------------------------------------------------------
Ran 163 tests in 1.390s

OK (SKIP=8)

Test group: autoreload
..
----------------------------------------------------------------------
Ran 2 tests in 6.387s

OK

______________________________________________________________________
Test suite completed for system with the following information:
IPython version: 4.0.1
IPython commit : 03b6385 (installation)
IPython package: /usr/local/lib/python3.4/dist-packages/IPython
Python version : 3.4.2 (default, Oct 8 2014, 10:45:20) [GCC 4.9.1]
sys.executable : /usr/bin/python3
Platform : Linux-3.16.0-4-amd64-x86_64-with-debian-8.2

Tools and libraries available at test time:
matplotlib pygments sqlite3

Status: OK (7 test groups). Took 46.269s.

One of error messges that I encountered by iptest.

======================================================================
ERROR: IPython.core.tests.test_display.test_set_matplotlib_close
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/usr/local/lib/python3.4/dist-packages/IPython/testing/decorators.py", line 20
8, in skipper_func
return f(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/IPython/core/tests/test_display.py", li
ne 68, in test_set_matplotlib_close
cfg = _get_inline_config()
File "/usr/local/lib/python3.4/dist-packages/IPython/core/tests/test_display.py", li
ne 63, in _get_inline_config
from ipykernel.pylab.config import InlineBackend
ImportError: No module named 'ipykernel'

Posted in GNU/Linux, Python | Tagged , , , , , , , , , | 1 Comment

Celestron Digital Microscope Imager 44421

https://www.howtoforge.com/tutorial/how-to-install-a-microscope-camera-imager-in-ubuntu/

How to Install a Microscope Camera Imager in Ubuntu 15.04
On this page

Installation using the Ubuntu Software Center
Installation using Terminal Command

First we will define the concept of a microscopic imager and how we can use it.

A Digital Microscope Camera Imager is used to take pictures from an analog microscope and play on our computers, whether laptops or desktops. These cameras are adapted to the main lens receptacle of the microscope either monocular or binocular. The primary intent of using a device of this type is to facilitate image viewing and user comfort to play back images on their computer, manipulate and save the images. Also to show, in real time, small groups or audiences, as the behavior of microscopic images, or in any case such as microorganisms displayed.

The camera treated in this tutorial is a Celestron®, model 44421, monocular, to be installed in a microscope Globe ®, type of binoculars. This camera comes with a universal adapter for the lens holder and a USB 2.0 connector. The camera will be installed on a Netbook Lenovo, model S10-3C, running Linux Ubuntu 15.04. Needless to say, this device does not offer manufacturer support of any Linux version, which is the reason for this tutorial.

The first thing we do is install playback software supporting images and videos from the camera running Ubuntu 15.04. The available software of choice for such applications is Cheese, both in Ubuntu Software Center 15.04 and through command Terminal.

$ sudo apt- get install cheese

Posted in Uncategorized | Leave a comment

Starting ipython for interactive sympy

$ ipython –pylab
Python 2.7.10+ (default, Oct 10 2015, 09:11:24)
Type “copyright”, “credits” or “license” for more information.

IPython 2.3.0 — An enhanced Interactive Python.
? -> Introduction and overview of IPython’s features.
%quickref -> Quick reference.
help -> Python’s own help system.
object? -> Details about ‘object’, use ‘object??’ for extra details.
Using matplotlib backend: TkAgg

In [1]: from symp
sympy sympyprinting

In [1]: from sympy import *

In [2]: ini
init_printing init_session

In [2]: init_session()
IPython console for SymPy 0.7.5 (Python 2.7.10-64-bit) (ground types: python)

These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols(‘x y z t’)
>>> k, m, n = symbols(‘k m n’, integer=True)
>>> f, g, h = symbols(‘f g h’, cls=Function)

Documentation can be found at http://www.sympy.org
WARNING: Hook shutdown_hook is deprecated. Use the atexit module instead.

In [3]: %run example-1.4.2.1.py
Fontconfig error: “local.conf”, line 35: invalid attribute ‘name’
Fontconfig error: “local.conf”, line 43: invalid attribute ‘name’
Fontconfig error: “local.conf”, line 51: invalid attribute ‘name’

Posted in GNU/Linux, Python | Tagged , , , | Leave a comment

apt-get install –no-install-recommends

Wow thanks man!

# apt-get install –no-install-recommends nmap
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libblas3 libblas3gf libgfortran3 liblinear1 liblua5.1-0
Suggested packages:
liblinear-dev
Recommended packages:
liblinear-tools
The following NEW packages will be installed:
libblas3 libblas3gf libgfortran3 liblinear1 liblua5.1-0 nmap
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,584 kB of archives.
After this operation, 17.8 MB of additional disk space will be used.

Posted in Uncategorized | Leave a comment

Stepper motor RF interference suppresor

stepper-motor_RF-interference-reducer

Source

RF Interference
“RFI” speaks to the radiated energy coming from
the engine’s ignition systems (spark plugs etc),
or equipment fitted with high frequency power invert
ers (used with colour graphics displays), and
high speed data leads (commonly found in the wiring of GPS and AHRS units). This type of
“radiated” noise is “induced” into the wiring, and is picked up by the radio.
A defense against this type of noise is the use
of ferrite core suppression. These devices are
fitted over wiring harnesses to “attenuate”
the RF noise signals passing along the wires.

Posted in Reprap 3D Printer, Science and technologies | Tagged , , , , , , | Leave a comment