Update Beaglebone Green To Latest Image

It is time to upgrade default image on BBGW – BeagleBone Green Wireless board. This guide details out steps on Update Beaglebone Green To Latest Image. My default image on BBGW is “BeagleBoard.org Debian Image 2016-06-14”. The command dog cat will tell you what image you are at in BBGW. $cat /etc/dogtag
The default Wi-Fi access point password for latest flasher images is “BeagleBone-A490”. This image comes as default when you buy BBGW in India. Few of the reason to upgrade to new image is, Difficulty in connecting to internet with old image. New uEnv.txt format will not work on this image, and you will have difficulty while communicating with UART, I2C and other peripherals. There are quite guides on Writing a new Image to the Beaglebone black but very few about beaglebone green wireless.

If you are looking for answers to the question like, How do I update my BeagleBone? or How do you flash a BeagleBone green? Upgrade to latest image is very simple.

BBGW Preparation For Upgrade

Make a backup of your custom stuff. If you are working on BBGW for some time, then your custom stuff will in home folder. It’s good to have a backup. Once you re-flash you can install the packages you need and put custom stuff. I suggest to create shell script for the packages you install.

Steps – Update Beaglebone Green To Latest Image

Beagle bone green wireless board upgrade to latest flasher image is simple three step process.

Step 1 –

Easiest way to re-flash to the latest system is by downloading the latest firmware flasher image. The latest flasher image “AM3358 Debian 10.3 2020-04-06 4GB eMMC IoT Flasher” from the “Flasher Debian images” section.

Step 2-

Write this image to sd card using Etcher (etcher.io)

BBGW upgrade to latest flasher image

Step 3 –

Now insert this SD card and boot BBGW from this new image. If you boot the beaglebone from SD card, it will automatically proceed to erase and reflash the eMMC.
But wait, since the current system is very old, to get it to boot from the sd card it is required to power on with the S2 button held down (the one closest to the sd card) during power-on, you can let go of the button once any LED’s turn on. Once booting process starts, user LED’s will start blinking to create sequence.
After 20-25 minutes LED’s will stop blinking. Once upgrade is completed, all the LED’s on the BBGW including power LED will be off.

Troubleshooting BBGW Connection –

Unplug BBGW power, take out SD card and plug in power to BBGW. Once BBGW powers up login to BBGW using following command.

$ ssh debian@beaglebone
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The ECDSA host key for beaglebone has changed,
and the key for the corresponding IP address fe80::e615:f6ff:fefd:a492%59
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:TregYNPVgnma80ovgoaiICs0rjjpHm4FwYt+90chs/Y.
Please contact your system administrator.
Add correct host key in /c/Users/Admin/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/Admin/.ssh/known_hosts:10
ECDSA host key for beaglebone has changed and you have requested strict checking.
Host key verification failed.

This was working with old image, since this is new image, login to begalebone using “beaglebone.local”

ssh debian@beaglebone.local

Once you are in check out dogtag and you should see the latest buster IoT image

debian@beaglebone:~$ cat /etc/dogtag
BeagleBoard.org Debian Buster IoT Image 2020-04-06

Now that you are connected to BBGW, lets try to update using – apt-get update.

debian@beaglebone:~$ ping google.com
ping: google.com: Temporary failure in name resolution
debian@beaglebone:~$ cat /etc/resolv.conf
Generated by Connection Manager

This implies that, BBGW is not connected to internet.

Setup WiFi on BBGW

We will be setting up WiFi using “connmanctl”, there are other ways, but since BBGW provides this utility lets use it.

debian@beaglebone:~$ connmanctl state
State = idle
OfflineMode = False
SessionMode = False

Above command output confirms that BBGW is not connected to internet.

BBGW connmanctl
debian@beaglebone:~$ connmanctl
Error getting VPN connections: The name net.connman.vpn was not provided by any .connmanctl> enable wifi
Error wifi: Already enabled
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
SARVESH wifi_64694e0e8e55_53415256455348_managed_psk
Gowda wifi_64694e0e8e55_476f776461_managed_psk
wifi_64694e0e8e55_hidden_managed_psk
connmanctl> agent on
Agent registered
connmanctl> connect wifi_64694e0e8e55_53415256455348_managed_psk
Agent RequestInput wifi_64694e0e8e55_53415256455348_managed_psk
Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]
WPS = [ Type=wpspin, Requirement=alternate ]
Passphrase? <your wifi password>
Connected wifi_64694e0e8e55_53415256455348_managed_psk
connmanctl> quit

Hope you have enjoyed reading on how to update Beaglebone Green To Latest Image.

BBGW And MQTT Broker Using Desktop

In the previous post we have seen different ways to connect BBGW – BeagleBone Green Wireless board with Wi-Fi and unboxing BBGW for the fist time. This post is about how to test BBGW and MQTT Broker using desktop or laptop.

When building IoT applications it is good practice to send test data using your desktop or laptop. This makes sure that your IoT application built using either flutter or android works fine. This will also help to reduce the waiting time for actual firmware and hardware getting ready. The mobile application developer can test and run his application without actual hardware. This technique can save you a lot of time and energy for the rest of your project development.

MQTT Setup On Desktop

To perform this test driven development of your IoT product using MQTT we need some MQTT broker. I have installed MQTTLense a chrome extension for testing MQTT applications.

MQTTLense is Google Chrome application, which connects to a MQTT broker and is able to subscribe and publish to MQTT topics. This will help for using the MQTT Monitor to view messages to the MQTT broker.

MQTTLense Installed

On your BBGW board install mosquitto service and confirm if its running. I assume you have already installed mosquitto broker on your BBGW.

t@beaglebone:~# sudo service mosquitto status
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto)
Active: active (running) since Sat 2021-07-03 02:20:34 UTC; 12h ago
CGroup: /system.slice/mosquitto.service
└─340 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
Jul 03 02:20:33 beaglebone mosquitto[318]: Starting network daemon:: mosquitto.

After installing and launching the application, click on the “+” button to add a new connection. Fill in the connection name as BBGW. This name can be anything of your choice. Fill in the IP address of beaglebone green wireless board. Rest other details are not required to update, click on the “CREATE CONNECTION” button.

MQTT Lense Create connection for BBGW

This will create new connection with BBGW and if it is success MQTT Lense will show it as Connection established to 192.168.0.106. Here 192.168.0.106 is my BBGW IP address.

MQTT Lense Connection established to BBGW

Send And Receive Message

Now connection is successfully established to MQTT broker running on BBGW, I can send (publish) data to BBGW device. On BBGW side I have subscribed to “test” topic. From MQTT Lense send message on this topic. This will receive message to BBGW device side.

@beaglebone:~# mosquitto_sub -h localhost -t "test" -v
mosquitto received message on BBGW

To send data from BeagleBone Green Wireless device to MQTTLense, First MQTTLense should subscribe to topic from BBGW board. Here I have created new topic as “test_bbgw” on MQTTLense and click on subscribe. On BBGW side publish message on this topic.

beaglebone:~# mosquitto_pub -h localhost -t "test_bbgw" -m "testing from BBGW"
From BBGW to MqttLense

The message payload and topic can be complex, in this example I have used simple topic name and message payload. Now you are sure that your application modules setup works fine over mqtt. This method helps you to debug MQTT programs and test it. Hope you have enjoyed this post on BBGW And MQTT Broker Using Desktop.

How To Connect BBGW To Internet

This post covers getting started with Beaglebone Green Wireless and connecting to internet using BBGW Wi-Fi. Received BBGW (BeagleBone Green Wireless) a customized BeagleBone from SeeedStudio. If you have used BBB (BeagleBone Black) then you might notice few difference like there is no 5V DC Jack socket in BBGW. I had trouble connecting to internet from BBGW. Lets get started with How To Connect BBGW To Internet.

If you have LCD cape and USB keyboard, you can setup Wi-Fi easily on BBGW. Lets get started with setting up without LCD cape and using command line.

First Power Up BBGW

There are lot of guide on setting up BBGW via USB. It is pretty straightforward, connect the USB to your computer/laptop, It will boot Linux from onboard eMMC. Wait for some time to see Wi-Fi access point on Wi-Fi, it will appear as “BeagleBoneXXXXXX”. Connect to this Wi-Fi and you will get default page asking for SSID of your Wi-Fi and enter the password.

BeagleBone Green Wireless Setup

This will setup your BBGW. Note down the IP address from this page as you will require to ssh. The detailed steps are available at seedstudio wiki. So far it is good and all steps works as mentioned. Once you press “done” it will redirect to “support” page. On this page you can connect to your BBGW board and run LED blink program from the browser itself. Its pretty cool to use BoneScript provided by BBGW to try and test your LED blink program.

Connect To BBGW

Here will check different ways to connect to BBGW. I had connected using default steps. I had verified if BBGW is connected or not. It will show display at the top of the BeagleBoard page like this:

Connect using Cloud9 IDE – You can connect to BBGW using Cloud9 IDE as well, just type http://192.168.8.1:3000 and you are connected to BBGW.

Cloud9 connected to BBGW

Connect using SSH – From the previous section you can easily ssh to BBGW.

$ ssh root@192.168.0.106

Just hit enter, as there is no default password for root. If you are doing ssh using default. The default username:password is [debian:temppwd].

BeagleBone Green Wireless Connect To Internet

So far, everything went rather smoothly, but setting up networking was more of a challenge. Before we get into details, I have tried to upgrade flasher image to latest image.

My default image on BBGW is “BeagleBoard.org Debian Image 2016-06-14”. The command dog cat will tell you what image you are at in BBGW, “cat /etc/dogtag”. The default Wi-Fi access point password for latest flasher images is “BeagleBone”.

When I tried to run apt-get update

@beaglebone:~# sudo apt-get update
Ign http://security.debian.org jessie/updates InRelease
Ign https://deb.nodesource.com jessie InRelease
Ign http://repos.rcn-ee.com jessie InRelease
Ign http://httpredir.debian.org jessie InRelease
Ign http://httpredir.debian.org jessie-updates InRelease
Err http://security.debian.org jessie/updates Release.gpg
Unable to connect to security.debian.org:http:

It is saying “unable to connect to repos.rcn-ee.com. The next thing I tried is to ping “googl.com” but with no response.

@beaglebone:~# ping google.com
PING google.com (172.1.8.1) 56(84) bytes of data.
From 192.168.0.105 icmp_seq=1 Destination Host Unreachable
From 192.168.0.105 icmp_seq=2 Destination Host Unreachable
From 192.168.0.105 icmp_seq=3 Destination Host Unreachable

This start to google and verify network settings for BBGW. I had two options: change the routing table or route the traffic through my laptop. Wi-Fi settings can be verified using “connmanctl”.

connmanctl> enable wifi
Error wifi: Already enabled
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
*AO SARVESH              wifi_2cf7f106b7a1_53415256455348_managed_psk
Gowda                wifi_2cf7f106b7a1_476f776461_managed_psk
connmanctl> agent on
Agent registered
connmanctl> connect wifi_2cf7f106b7a1_53415256455348_managed_psk
Error /net/connman/service/wifi_2cf7f106b7a1_53415256455348_managed_psk: Already connected
connmanctl> quit

In order to route BBGW traffic via my laptop, I have updated Wi-Fi properties on my laptop to allow other network users to connect through my computer’s internet connection.

 cat /etc/resolv.conf
# Generated by Connection Manager
nameserver 0.0.0.0
nameserver 192.168.0.1
nameserver 8.8.8.8

This did not work well.

@beaglebone:~# ping google.com
PING google.com (172.1.8.1) 56(84) bytes of data.
From 192.168.0.105: icmp_seq=36 Redirect Network(New nexthop: 192.168.0.1)
From 192.168.0.105: icmp_seq=39 Redirect Network(New nexthop: 192.168.0.1)

Then next option is to change the routing table and add details in /etc/network/interfaces. I had edited interfaces file using vi.

auto wlan0
iface wlan0 inet static
address 192.168.0.222
netmask 255.255.255.0
gateway 192.168.0.1
wpa-ssid {ssid}
wpa-psk {password}

Here I had specified static IP to the BBGW so that, I can easily SSH to BBGW. With this change most of the things broken and now I am not able to ping to BBGW also. It is not showing IP address on the start page now.

It just says, board is ready and can’t display my Wi-Fi access point. This point I can’t ping to previous board IP. But there is workaround for this and you can do SSH using SoftAp0 IP. SSH to the BBGW using SoftAp0 and revert back the changes in /etc/network/interfaces file.

$ ssh root@192.168.8.1

Now both the methods have failed so we had contacted IRC channel (#beagle). The problem seems to be with nameserver.

root@beaglebone:~# connmanctl state
State = online
OfflineMode = False
SessionMode = False
root@beaglebone:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether e4:15:f6:fd:a4:91 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.2/24 brd 192.168.7.255 scope global usb0
valid_lft forever preferred_lft forever
inet6 fe80::e615:f6ff:fefd:a491/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 2c:f7:f1:06:b7:a1 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.106/24 brd 192.168.0.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::2ef7:f1ff:fe06:b7a1/64 scope link
valid_lft forever preferred_lft forever
4: SoftAp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether e4:15:f6:fd:a4:90 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.1/24 brd 192.168.8.255 scope global SoftAp0
valid_lft forever preferred_lft forever
inet6 fe80::e615:f6ff:fefd:a490/64 scope link
valid_lft forever preferred_lft forever
root@beaglebone:~# ip route
0.0.0.0 via 192.168.0.1 dev wlan0
default via 192.168.0.1 dev wlan0
192.168.0.0/24 dev wlan0  proto kernel  scope link  src 192.168.0.106
192.168.0.1 dev wlan0  scope link
192.168.7.0/24 dev usb0  proto kernel  scope link  src 192.168.7.2
192.168.8.0/24 dev SoftAp0  proto kernel  scope link  src 192.168.8.1
root@beaglebone:~# cat /etc/resolv.conf
# Generated by Connection Manager
nameserver 0.0.0.0
nameserver 192.168.0.1

The router (TP-Link) is telling the BeagleBone that the nameservers are “0.0.0.0” and “192.168.0.1”. The other devices in network connects to next nameserver when “0.0.0.0” is not reachable. This is not working in case of BBGW as somehow “0.0.0.0” isn’t reachable and BBGW is not trying to the next dns server.

The solution is to set the nameserver for BBGW. This will be done using “connmanctl config SERVICE nameservers 192.168.0.1. Here SERVICE is the name of your Wi-Fi connection, shown by “connmanctl services” (in the right column)

connmanctl> services
*AO SARVESH              wifi_2cf7f106b7a1_53415256455348_managed_psk
connmanctl> config wifi_2cf7f106b7a1_53415256455348_managed_psk nameservers 192.168.0.1
connmanctl> exit
root@beaglebone:~# ping google.com
PING google.com (142.250.67.238) 56(84) bytes of data.
64 bytes from bom07s24-in-f14.1e100.net (142.250.67.238): icmp_seq=1 ttl=116 tim

This shows updated nameserver entries in “/etc/resolv.conf” file.

@beaglebone:~#  cat /etc/resolv.conf
# Generated by Connection Manager
nameserver 192.168.0.1

With this I am able to finally run apt-get update on my BeagleBone Green Wireless board. Hope you have enjoyed this How To Connect BBGW To Internet short guide.

You can connect your BBGW using “ssh debian@beaglebone” and/or “ssh debian@beaglebone.local”, Enter password as “debian:temppwd”. if you use multiple beaglebones, be sure to give them individual hostnames with “ sudo hostnamectl set-hostname HOSTNAME ” (replace HOSTNAME by the desired name for the beaglebone).

systemctl status $(pidof gpsd)

WordPress Error Establishing Database Connection

There are lot of good articles on web with generic solutions to the problem of WordPress Error Establishing Database Connection, this post discuss about issue occurred during site migration to latest webhosting server.

WordPress Webserver Environment

This issue is related to wordpress site migration to new cloud hosting server. The old webhosting server has following configuration

The PHP version associated with wordpress site as PHP 5.3, WordPress version is 5.1.8 and MySQL version 5.1 which is also deprecated. The current website is running good from past few years, but with recent development it was required to upgrade. Since few plugins were not supported on PHP 5.3 and so we have decided to migrate the wordpress website to new cloud hosting server with PHP 7 and MySQL version 5.6.

Solution Approach

We have migrated to new webhosting server with old PHP 5.3 and MySQL 5.1 version. This is to test and verify the website works well on new environment.

Once this is tested, we have switched to new PHP version ie from PHP 5.3 to PHP 7.2.34. Please note before you do this change, don’t forget to take backup of your website either by using some good plugins like ‘updraftplus‘ or ‘export’ option form tools. Also take backup of your databse using phpMyAdmin tool provided by your webhosting company or take databse backup from command line.

Error Location

While most of the online sources will point you to wp-config.php file for verifying DB credentials. In our case DB details were correct since we were able to access DB using phpMyAdmin. Still we were getting following error message

mysqli_real_connect(): (HY000/2002): Permission denied in /home/yoursite-com/public_html/wp-includes/wp-db.php on line 1612

To view this error you need to add following lines in ‘wp-config.php’ file

/*define( 'WP_DEBUG', false );*/ 
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

This will enable logging and you can view the log file as ‘debug.log’ in ‘wp-content’ folder.

Simple Solution

While all the database details were correct and still it was giving database error. So in wp-config.php, Use the IP address of your local server instead of localhost . That means set 127.0.0.1 at DB_HOST in wp-config.php . So the solution will be like-

/** MySQL hostname */
define('DB_HOST', '127.0.0.1');

After this change reload your webpage, and you can login to admin page. First thing you should do here is upgrade wordpress to latest version. Please note wordpress shows latest PHP version now. For first time upgrade it will show error for databse needs upgrade. Click on upgrade and refresh the page. For some time your site will be in recovery mode. But it will load up once upgrade is complete. The site still needs MySQL latest version and don’t forget to disable debug mode from wp-config.php. I am sure there are various solution that works out for you on this WordPress Error Establishing Database Connection, for example entering correct databse details, deleting DB user and creating new DB user, changing database host from localhost to exact host provided by webhosting provider etc, so let us know which solution worked for you while connecting to database using wordpress wp-config file.

Touch Less Elevator New Norms of Life

We at Neudeep Technologies Pvt. Ltd. continue to innovate and as part of our innovations we are happy to announce launch of touchless elevator for your needs. This is part of one of our product series  #IEC1000 (Intelligent Elevator Controller). We are proud to say “made in India” by startup company in Pune, India.

As we continue to navigate with new norms of life during these pandemic times, the vertical transport industry has continued to innovate new products and features. One of such feature is, touch less technology. Touch less technology is especially attractive options in this current pandemic environment. An example of touch less technology is our own product ie touch less elevator. This enables passengers to use their cell phone as their personal elevator call button. This is also sometimes called eCall. This eCall helps minimize use of public access to elevator buttons.

This QR code based touch less elevator/lift can act as destination dispatching system, which can help minimize the number of stops per trip, reduce car crowding and decrease travel times and saves energy.

This QR code based system is ready to integrate with security and community management app for gated premises like MyGate, ApnaComplex and NoBrokerHOOD. Neudeep’s IEC1000 touchless elevator software with mobile app integrated with MyGate, ApnaComplx or NoBrokerHOOD will help residents as well as the management committee in handling gate security for visitors. When integrated with these apps Neudeep’s touchless elevator system will act as access system, where visitors movement will be restricted to their destination floor only.

Below is short video of our invention.

Thank you for watching. If you are looking for such solution to be implemented at your place email your details at info@blog.neudeep.com

Ubuntu To Debian Upgrade Issues

If you have received following message from dreamhost on VPS upgrade and your Ruby apps are broken then here are few tips that might save your day. “We will be upgrading your Virtual Private Server from version 14.04 (also known as trusty) to Debian 9.12 (aka Stretch!) “. Yes as they mentioned in their email that there are some environment changes that effect your system if you are using Ruby, Python, PHP, or run a site that relies heavily on specific server packages. Lets start with Ubuntu To Debian Upgrade Issues on VPS of Dreamhost.

This post will help you only if you have already installed redmine on dreamhost VPS and your server is now upgraded to Debain Stretch.

SVN Write Issue on Debian Stretch

First error you will see is, related to SVN. If you have SVN on VPS then your will see that you do not have write permission anymore. To solve this you can go to more -> subversion, select the SVN repo, click on edit and then click on update my repo now. Check your write permissions after 5-10 minutes.

If this trick did not help you, then please write to dreamhost support team and they will change the settings from backend.

Django MySQL Issue

If you are running application with Django and MySQL as database then with this upgrade it will not work.

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: libmysqlclient.so.18: cannot open shared object file: No such file or directory.
Did you install mysqlclient or MySQL-python?

As per suggested solution by deleting pip .cache directory, it will still shows error. For this issue we did not found solution yet, but as workaround we have created backup databse in sqlite and started using Django with sqlite. Please note with Ubuntu 14.04, Sqlite was not working so we have no choice other than to use MySQL, but with this new server upgrade Sqlite is working.

Ruby Apps Issue On Debain VPS

First issue you will encounter is openssl issue on Debian server. This is because openssl library is changed on the Debian Stretch server. You will need to reinstall the version of ruby that you had with rvm which was installed on Ubuntu. Once this is done you need to install ruby gems again to allow your rails site to work.

$gem list
Error loading RubyGems plugin "/home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/rubygems_plugin.rb": libssl.so.1.0.0: cannot open shared object file: No such file or directory - /home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/x86_64-linux/openssl.so (LoadError)
Error loading RubyGems plugin "/home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/gem-wrappers-1.4.0/lib/rubygems_plugin.rb": libssl.so.1.0.0: cannot open shared object file: No such file or directory - /home/ilmp_app/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/x86_64-linux/openssl.so (LoadError)

To solve this error, you need to uninstall rvm and re-install.

$ rvm uninstall 2.6.0
$ rvm install 2.6.0

Now reinstall bundler and then reinstall your old gems else you could see following errors

find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/ilmp_app/ilmp.neudeep.com/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, run bundle update –bundler . To install the missing version, run gem install bundler:2.1.4`

$ gem install bundler
$ bundle update

Now you are all set to run the ruby application. Bundle update will take care of mysql2 issue as well.

 when i start my application it is giving me error for libmysqlclient.so 
/home/spsm01/.rvm/gems/ruby-2.6.0/gems/mysql2-0.5.2/lib/mysql2.rb:33:in `require': libmysqlclient.so.18: cannot open shared object file: No such file or directory - /home/spsm01/.rvm/gems/ruby-2.6.0/gems/mysql2-0.5.2/lib/mysql2/mysql2.so (LoadError)

Once you re-install as per above instructions your Django and Ruby application on the newly upgraded server should work as normal. Thats all Ubuntu To Debian Upgrade Issues we have faced, let us know if you have faced any new issues apart from above mentioned one.

Advanced-cache.php Already Exists Warning

Everything was broken when we tried to install yet another WP cache plugin. All the tabs and pages from admin panel are showing advanced-cache.php already exists warning.

Warning!
The file ../../wp-content/advanced-cache.php already exists. Please manually delete it before using this plugin.

Origin

Most of the wordpress installation done from dreamhost will have wp super cache plugin installed. This plugin will speed up wordpress blog, and so is recommended. If you do not have cache plugin installed then your wordpress blog will eat up lot of RAM(memory). There are multiple cache plugins available. We were trying out different plugins other than wp super cache. We tried to install hyper cache. Other than hyper cache there are tons of cache plugins, like, wp rocket, w3 total cache, WP fastest cache, Hummingbird page cache, & PageSpeed Ninja and so on.

Well, If you try to install another cache plugin without fist disabling current plugin then you will start to see this warning.

Solution for advanced-cache.php already exists warning

There are multiple solutions available for this warning. Like do FTP or ssh login to your server and remove folder from ‘plugins’ directory. or manually copy the file from the plugin folder ‘wp-content/plugins/wp-super-cache/advanced-cache.php’ to ‘wp-content folder’. And last one suggested to define ‘WP_CACHE’ constant to ‘false’ in ‘wp-config.php’. But none of the solution worked out in our case.

So, we have to do it hard way by editing database table. Login to dreamhost panel, navigate to ‘more’->’MySQL Database’ Click on phpMyadmin link in front of your database. Please note your database username and password will be different from your wordpress credentials. Login to your database and select ‘wp_3cajzx_options’ table. Search for ‘active_plugins’ in option_name as shown in below image.

Under ‘option_value’ you can see that, WP Super cache and Hyper Cache entries are there. First delete ‘hyper cache’ entry and re-order the indexing for ‘i’.

i:5;s:20:"wp-super-cache/plugin.php";i:6;s:22:"hyper-cache/plugin.php";i:7;s:19:"jetpack/jetpack.php";

Corrected entry after removing hyper cache will look like as below.

i:5;s:20:"wp-super-cache/plugin.php";i:6;s:19:"jetpack/jetpack.php";

After doing this change click on ‘go’ with ‘save’ option for this table. This will save the plugins table with removed entry for hyper cache plugin.

With this trick our admin panel is working, and we could see that all the plugins are available, only change was all the plugins were deactivated so we have to activate them. Hope this trick will solve your problem with this warning.

Install Redmine on DreamHost VPS Server

Recently we moved to dreamhost VPS server and signed in for 3 year service. We were using redmine in our projects for handling project management activities. After successful installation of latest redmine release on local server, it was time to move on to install and test it on webservers. But when we contacted Dreamhost support they have standard reply,

Thank you for writing into DreamHost Support!

Unfortunately, we cannot assist with custom configs for that application,
My apologies. If you need root access for the install then you would need
to use a dedicated server or DreamCompute and that would not be allowed on your current VPS.

Dreamhost Support Reply

There are multiple resources available across the web about Redmine on Dreamhost, but they’re all quite outdated. Well redmine is flexible project management web application and is free to use opensource software. We did not stop here, as we were so much impressed with capabilities of redmine for project management and reporting. So we have started with installation of ruby on rails on VPS (virtual private server).

Step 0 – Pre-Build

  1. Enable Passenger (Ruby/NodeJS/Python apps only) under ‘domains’->’Manage Domains’ from dreamhost cpanel
  2. Install RVM (Ruby version Manager) using steps mentioned in dreamhost help center
  3. Install ImageMagick current gem as redmine requires it and DreamHost servers don’t have it
    1. mkdir src && cd src
    2. Get latest source from imagemagic website using $ wget http://www.imagemagick.org/download/
    3. mkdir ~/lib
    4. tar xfz ImageMagick-7.0*
    5. Now navigate to ImageMagick-7.0* folder and configure
    6. ./configure –prefix=/home/username/lib/ImageMagick-7.0.8-68
    7. make
    8. make install
    9. export PKG_CONFIG_PATH=’/home/username/lib/ImageMagick-7.0.8-68/lib/pkgconfig’
    10. export C_INCLUDE_PATH=’/home/username/lib/ImageMagick-7.0.8-68/include’
    11. source ~/.bash_profile
  4. Download latest redmine archive and decompress it in /public folder
    1. wget http://www.redmine.org/releases/redmine-4.0.4.tar.gz
    2. tar xfz redmine-4.0.4.tar.gz –strip-components=1
  5. Install dependencies –
    1. $ gem install bundler
    2. $ bundle install
  6. If you are still getting issue with ImageMagick then bypass rmagick and continue
    1. bundle install –without development test rmagick
  7. Generate session store key
    1. $ bundle exec rake generate_secret_token
  8. After this command, if your VPS is Debian 9.12 (aka Stretch) you will get following error, but don’t worry, just run – $ bundle update
$ bundle exec rake generate_secret_token
Could not find gem 'mysql2 (~> 0.5.0)' in any of the gem sources listed in your Gemfile.

All above steps are required if you are using Dreamhost VPS/Shared server, If you are using dedicated servers then above tricks are not required for you.

Step 1 – Create Database

Create empty database using ‘MySQL database’ section of cpanel from dreamhost. This will create database and hostname, Note down these details along with username and password, as these are required in next step.

Step 2 – Configure Database

Configure the database in config/database.yml file, first rename ‘database.yml.example’ to ‘database.yml’. Open this configuration file and enter details as noted in step 1. The ‘database.yml’ file should look as below,

production:
adapter: mysql2
database: <db_name from step1>
host: <host_name from step1>
username: <user_name from step1>
password: <user_password from step1>

Step 3 – Migrate Database and Load Defaults

Create the database structure by running the redmine migrations

$  RAILS_ENV=production rake db:migrate

OR

$ bundle exec rake db:migrate

At this moment, if you see issue with Sprockets, use steps to upgrade sprockets and you are good to go for final rake command.

rake aborted!
Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js`

It is easy as mentioned in the error log also, just create ‘ app/assets/config/manifest.js’ and copy below three lines in manifest file

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

Step 4 – Final Rake Command

$RAILS_ENV=production bundle exec rake redmine:load_default_data

Now test your redmine server using wbrick command.

$bundle exec rails server webrick -e production
http://<host_name>:3000/ 
Redmine on VPS server of Dreamhost

Step 5 – (Optional) Run webrick service as background process

With webrick running in background you need not to start the server again and it runs even after you close the session.

$ruby script/server webrick -e production -du
Or Try following  
$ruby script/server webrick -e development -d

Step 6 – Configuration Steps For Apache Server

1. You need to modify two files for apache. The first is /etc/apache2/mods-available/passenger.conf which needs the text PassengerDefaultUser www-data added as seen below.
<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>

2. Now create a symlink to connect Redmine into the web document space:

$ sudo ln -s /home/ilmp_redmine/<PWD>/public /var/www/html/redmine
3. And modify /etc/apache2/sites-available/000-default.conf as follows
<Directory /var/www/html/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
4. Create and set the ownership of a Gemfile.lock file so that apache’s www-data user can access it:
$ sudo chown www-data:www-data /home/ilmp_redmine/<PWD>/public/Gemfile.lock

5. Now restart apache:

$ sudo service apache2 restart

Feel free to drop a comment or email @ info@blog.neudeep.com, if you get stuck somewhere, we will try to help you as much as possible. Check out our services and offerings at RedmineLab.com

Thank you for reading this post about ‘install redmine on VPS’ happy redmining using dreamhost.

SAME54 I2C Driver Issue Solved

If you are reading this post that means you are using ATMEL or Microchip controller. We are using ATSAME54 micro from microchip, it is ARM based cortex-M4 series controller. In our application we have around eight I2C ( Inter-integrated Circuit) slave devices connected. I2C slave devices includes, RTC, onboard temperature sensor, FRAM, LED drivers etc. Well as you know all I2C slave devices can be addressed using their addresses.

Well as most of guys does we too have downloaded sample code from start.atmel.com and tested. We have SAME54 explained pro and we brought PCA9685 LED driver. This is simple I2C based LED driver and is easily available, its schematic and design also available from adafruit. With sample code and its default address it works like charm, meaning, in first go it starts communicating with LED driver.

Now fun part starts, after verifying this we have incorporated same design in our hardware. After we receive hardware, LED driver is not at all responding, it was not coming out of sleep mode. We have tried all the options, but no luck. Now when we are running same code on explained pro it is working. So only difference was the address. With PCA9685 module connected with explained pro as I2C master, we were using default address ie 0x40. Now when we change this address by shorting address lines, it stops working. We are getting “RXNACK” bit set on (received not acknowledged). Strange thing is if we revert back its address to default address ie 0x40 it works.

When we connected oscilloscope to SDA line we were getting data, ie address then registers.

I2C without driver change

Solution

Well after lot of googling and spending almost two weeks, we found solution, that was issue with ATMEL I2C driver source code generated from start.atmel.com. The solution is very simple once you found out the root cause :-). Yes it is bug in microchip’s I2C driver and its very unique.

I2C is very simple and we suspected hardware. Started with pull up registers for SDA and SCL lines, After trying out with various combinations of pull up registers (4K, 10K, 2.2k) we diverted our attention to I2C drivers. Yes, The culprit is – ‘i2c_m_sync_cmd_read()’ and ‘i2c_m_sync_cmd_write()’ functions from ‘hal\src\hal_i2c_m_sync.c’. The present code it is sending two bytes, but it is expected is to send three bytes. We have modified these read/write commands and it is working. Please note this change is necessary if you are using I2C and code downloaded from atmel start.

Follow below steps to fix this issue,

Open – ‘hal\src\hal_i2c_m_sync.c’

In function ‘i2c_m_sync_cmd_read()’ and ‘i2c_m_sync_cmd_write()’ comment out following code, so after commenting out the functions should look as below,

	struct _i2c_m_msg msg;
int32_t           ret;
#if 0
msg.addr   = i2c->slave_addr;
msg.len    = 1;
msg.flags  = 0;
msg.buffer = ®
ret = _i2c_m_sync_transfer(&i2c->device, &msg);
if (ret != 0) {
/* error occurred */
return ret;
}
#endif
msg.addr   = i2c->slave_addr;
msg.flags  = I2C_M_STOP;
msg.buffer = buffer;
msg.len    = length;
ret = _i2c_m_sync_transfer(&i2c->device, &msg);
if (ret != 0) {
/* error occurred */
return ret;
}
return ERR_NONE;

Now connect oscilloscope and check SDA line, it gives results as expected.

I2C after change in driver

If your I2C slave devices are configured with default addresses ie 0x00, then this change is not required, but remember to make this change every time you download I2C driver code from start.atmel.com. Share your findings on I2C issues while using ATMEL SAME54P20A controller.

Install wxPython With Solved ImportError

This post describes how to install wxPython on ubuntu system and helps with solved build errors while installation. This post assumes you have bare Ubuntu 18.04.3 LTS system and it is newly installed. wxPython is a opensource, cross platform, GUI toolkit for the Python programming.

This post describes in detail for how to install wxpython ubuntu 18.04 for python2 and python3. wxPython allows Python programmers to create programs highly functional graphical

user interface, simply and easily. Being cross platform with little changes it works on Microsoft windows and Linux systems. So if you have GUI application that requires to be executed on both windows and Linux wxPython is right choice for python programmers.

‘pip’ is required as a prior condition for installation of wxPython, install ‘pip’ by running following command

$ sudo apt install python-pip

As per How to install wxPython wiki guide, to install wxPython using ‘pip’ you will need to execute following command

$  pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 \
wxPython

This command after successful execution says –

Installing collected packages: six, numpy, pillow, wxPython
Successfully installed numpy-1.16.5 pillow-6.1.0 six-1.12.0 wxPython-4.0.6

Now to test the installation execute below commands

$python2
>>> import wx
>>> wx.VERSION_STRING
'4.0.1'

After executing ‘import wx’ it gives following error

Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bhagwat/.local/lib/python2.7/site-packages/wx/__init__.py", line 17, in <module>
from wx.core import *
File "/home/bhagwat/.local/lib/python2.7/site-packages/wx/core.py", line 12, in <module>
from ._core import *
ImportError: libpng12.so.0: cannot open shared object file: No such file or directory

Problem is with above installation it is pointing to ‘ubuntu-16.04’ and we are using ‘ubuntu-18.04’, so to fix this issue just execute below command and it will install for ‘ubuntu-18.04’

$ pip install -U  -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ wxPython

Verify installation

$ python
Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.VERSION_STRING
'4.0.6'
>>> 

Install wxPython for python 3

Above steps works for Python 2, but how to install wxPython on python 3 or higher version. so, It seems wxPython is not fully ported for python 3 and above. But, First you will need ‘pip3’ to install wxPython for python 3.

$ sudo apt install python3-pip

So, This will install python3.6-dev and python3-dev, and once ‘pip3’ is installed simply execute following command

$  pip3 install wxPython

This command is failing with following error

    File "build.py", line 30, in <module>
import pathlib2
ModuleNotFoundError: No module named 'pathlib2'
Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.
----------------------------------------
Failed building wheel for wxPython
Running setup.py clean for wxPython
so install 'pathlib2' by running following command
$ pip3 install pathlib2
If above command fails use below command to upgrade 'wxPython' 
$ python3 -m pip install --upgrade --pre -f https://wxpython.org/Phoenix/snapshot-builds/ wxPython

Now if you got following errors:
python-config : not found
Checking for library python3.7m in LIBDIR : not found
Checking for library python3.7m in python_LIBPL : not found
Checking for library python3.7m in $prefix/libs : not found
Checking for library python3.7m in LIBDIR : not found
Checking for library python3.7m in python_LIBPL : not found
Checking for library python3.7m in $prefix/libs : not found
Checking for library python37 in LIBDIR : not found
Checking for library python37 in python_LIBPL : not found
Checking for library python37 in $prefix/libs : not found
Checking for header Python.h : Distutils not installed? Broken python installation? Get python-config now!
The configuration failed

Install new python3.7.4 if above error still there then uninstall wxpython.

$sudo apt-get install python-dev
$pip uninstall wxpython
$sudo apt install libgtk-3-dev

Still, If you are getting following error:
File “/home/.local/lib/python3.8/site-packages/wx/core.py”, line 12, in <module>
from ._core import *
ImportError: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
To solve:

$sudo apt-get install git curl libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0
$pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

Thats it happy to help you during install wxpython ubuntu 18.04 for python2 and python3. Keep reading and comment out your experiences.