Monday, January 23, 2017

Linux Network Manager Manual Commands

I have a love/hate relationship with the Linux NetworkManager daemon.  It usually works and keeps your laptop PC network connections going smoothly when you move around, but it gets in the way when one does network tests and system integration using a laptop PC.

Each time you plug a cable in, or turn an embedded system off/on, NetworkManager restarts the connection and you can then lose your static IP address setting, which gets tiring really quickly in a lab setup.

Usually, I completely disable NetworkManager and assign a static IP address to my machine on a laboratory bench with a script in /usr/local/bin called static:

#! /bin/bash
echo Configure network for PDLU access

# Disable the Network Manager
systemctl disable NetworkManager.service
systemctl stop NetworkManager.service

# Set static IP address
ifconfig em1 192.168.111.1 netmask 255.255.255.0 up

# Set multi casting route
route add -net 224.0.0.0 netmask 240.0.0.0 dev em1

# Open up the firewall
iptables -F

# Show setup
ifconfig
route


and when I get back to a desk, I set things back to normal with a script called dynamic:

#! /bin/bash
echo Configure network normally

# Disable the Network Manager
systemctl enable NetworkManager.service
systemctl restart NetworkManager.service
sleep 1

# Set multi casting route
route add -net 224.0.0.0 netmask 240.0.0.0 dev em1

# Show setup
sleep 1
ifconfig
route


Sometimes NetworkManager gets confused and the Aplet ends up spinning forever, trying to bring up a non-existent interface.

The way to fix these kind of issues is to invoke the command line program nmcli:

# nmcli connection show active
NAME                UUID                                  DEVICES      DEFAULT  VPN  MASTER-PATH
Wired connection 1  34111952-8271-4f64-a616-a6cd5899bae2  vboxnet0     no       no   --         
Wired connection 2  9dd23ba2-3378-4657-96bb-3b687cfe0180  enp0s29u1u2  yes      no   --       


Disable the errant interface:
# nmcli connection down id "Wired connection 1"

and finally delete it altogether:
# nmcli connection delete id "Wired connection 1"

This way I have a quiet GUI again without the irritating spinning widget in the corner.

La voila!

Herman

Sunday, January 22, 2017

Free and Open Systems - Free and Open Minds

The power of marketing, advertising and glossy brochures subtly warp people's minds to wherever advertising Dollars go.  This affects Free and Open embedded operating system software as well.  

Users visit a software company web site that showcases a new software feature and they don't realize that the "new feature" is 30 years old and exists in numerous other systems also

Some people do not understand that there is a large corpus of almost identical operating systems known as UNIX-like or POSIX compatible operating systems and that they can use any one of them and port their software between them, without shedding too many tears.

Embedded OS selection criteria should therefore not concentrate on perceived feature differences, but rather on availability:  Copyrights, Patents, Licensing and Export Permits.

This is especially important in small countries which are subject to the political whims of the big five, who can make you wait indefinitely for an export permit and delay your projects.

POSIX

The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems.  https://standards.ieee.org/develop/wg/POSIX.html 

This corpus of more or less POSIX compatible embedded operating systems include some big names:
Linux, BSD, Darwin, VxWorks, PikeOS, LynxOS, Integrity-178 and several lesser known ones.  

Each of the better known ones are also divided into several lesser known distributions.  For example, there are two types of VxWorks, three types of Apple Mac OS and four or more types of BSD.

Shared Packages

These POSIX operating systems share an enormous library of software.  About 25 000 shared packages are listed in the FreeBSD repositories. https://www.freebsd.org/developers/cvs.html 

The actual differences between these operating systems are very subtle and are mostly a matter of who you go to for support, not technicalities, since they all share the same 25 000 packages, while the differences are only the OS kernels.
If any distribution would develop a new security feature or performance improvement, then that idea will get copied/included by everybody else in due course.  

Some features that are now in the news, such as ‘partitioning’ was first developed by BSD, decades ago - called Jails.  https://www.freebsd.org/doc/handbook/jails-build.html  

Ditto for hypervisors such as Qemu, KVM, VMware and others which have been around for decades.

All the abovementioned versions of UNIX can do partitioning and hypervisors.  Partitioning isn’t unique to VxWorks or PikeOS - they are just marketing it.  

The PikeOS microkernel isn’t unique either - Apple OSX and Darwin also use the Mach kernel.  It makes these systems a little slower, so microkernels are not popular in general purpose computing.  https://www.gnu.org/software/hurd/microkernel/mach/history.html 

Certifications

Another issue is certification by various authorities, for example DO-178B.  
It is clear that if for example VxWorks, LynxOS, PikeOS or Integrity-178 is certified to a standard, then by extension, BSD also benefits of the software reviews, since they share the same 25 000 base packages.

Regulation-Free Software

When building embedded systems, it is important to avoid using parts and equipment that are encumbered by overbearing regulations such as ITAR. https://www.pmddtc.state.gov/regulations_laws/itar.html 

VxWorks and PikeOS are both encumbered by licenses and permits that are hard to obtain. http://www.windriver.com/support/license-help/  https://www.sysgo.com/company/legal/#tab_c493_ 

However, all versions of Linux and BSD are free of encumbrances and are known as Free and Open software.  https://www.fsf.org/about 

 

Hardware Support

Of all the above UNIX-like operating systems, Linux currently has the widest hardware support and Apple OSX the most limited hardware support. 

Style, is the ability to distinguish quality, 
without having to look at the price tag.

Windriver VxWorks became a popular embedded OS when they added the BSD network stack to VRTX and declared that “VRTX now Works".  

WindRiver also has their own embedded Linux distribution since about 2008.  http://www.windriver.com/products/linux/ 

Escape From Export Permit Alcatrez

Therefore, it is entirely possible to install an embedded version of BSD or Linux on a CPU card and port software over from an encumbered embedded OS such as VxWorks, LynxOS or Integrity-178, thus avoiding all the licensing and permit issues.  https://www.freebsd.org/doc/en_US.ISO8859-1/articles/nanobsd/article.html

Similarly one could port software from an encumbered version of PikeOS over to Apple's Darwin, which also has a microkernel.  http://www.puredarwin.org/ 

In Search of Excellence

One day when another OS version has a new feature that is in fashion, then the software can be ported over again.  That is the whole purpose of the POSIX standard.  

The user isn’t captive to any one system or provider and wasting time on obtaining licenses and permits from an unco-operative country isn’t at all necessary.

. -.-. .-. .- ... . --..  .-.. .  .. -. ..-. .- -- .

Herman