Install Redmine On Ubuntu With Solved Gem BuildError

This post describes in detail on howto install Redmine latest version on Ubuntu 18.04 -x86_64 GNU/Linux system. Redmine is one of the most widely used open source software tool and platform for project management, issue tracking and project execution. With lot of freely available plugins one can also use Redmine as CMS, Invoicing, finance, HR and most of the activities that are involved in small scale software company. If you are startup company and looking for all in one tool Redmine is answer.

This guide is little bit lengthy as there are few workaround during installation, so grab your coffee before you start.

If your system does not have apache server installed then follow step 1, else skip to step 2.

To ensure apache server is installed and running open any webbrowser like mozilla, chrome and type ‘localhost’ if you see “can’t establish a connection to the server at localhost” then you need to install apache else you will see “Apache2 Ubuntu Default Page”

Step 1: Install Apache2 Server on Ubuntu

$sudo apt install apache2 libapache2-mod-passenger

Now that Apache2 is installed, to test whether the web server is working, open your browser and type http://localhost

you will see “Apache2 Ubuntu Default Page”

Step 2 – Get Redmine application

Get the Redmine source code by either downloading a packaged release from download page.

Copy this file to /usr/share

$sudo cp redmine-4.0.3.tar.gz /usr/share/

Then to unpack a tar.gz file, use the tar command from the shell

$sudo tar -xvzf redmine-4.0.3.tar.gz

And remove redmine-4.0.3.tar.gz file from /usr/share. You can now see following folder structure

Redmine 4.0.3 folder structure

you can also check out stable redmine version from svn , by running below command,

$svn co https://svn.redmine.org/redmine/branches/4.0-stable redmine-4.0

Step 3 – Install MySQL and Create an empty Redmine database

Create MySQL database with user name as ‘redmine’

Assuming this is fresh Ubuntu 18.04.2 LTS and MySQL is not installed, execute following command to install MySQL

/usr/share/redmine-4.0.3$ sudo apt-get install mysql-server mysql-client

Once installed check out MySQL version

/usr/share/redmine-4.0.3 $ mysql –version

mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper, Redmine 4.0 does not support for MySQL < 5.5

Note-

Then create empty database – To do this change to sudo user and execute mysql commands as listed out below.

$sudo -i
$mysql 
mysql> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Query OK, 1 row affected (0.01 sec)
mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my password';
Query OK, 0 rows affected (0.01 sec)
mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
Query OK, 0 rows affected (0.02 sec)

Step 4 – Database Configuration

Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment.

production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "my_password" 

Step 5 – Dependencies installation

This is step you will need coffee 🙂 make sure you have refilled your cup. install Bundler

/usr/share/redmine-4.0.3 $sudo gem install bundler

Then install required Redmine gems, there are 59 gems required at this step

/usr/share/redmine-4.0.3 $sudo bundle install --without development test

/usr/share/redmine-4.0.3$ sudo bundle install --without development test 
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`. Fetching gem metadata from https://rubygems.org/................ Fetching gem metadata from https://rubygems.org/.. Resolving dependencies...
Fetching rake 12.3.2
Installing rake 12.3.2
Fetching concurrent-ruby 1.1.5
Installing concurrent-ruby 1.1.5
Fetching i18n 0.7.0
Installing i18n 0.7.0
Fetching minitest 5.11.3
Installing minitest 5.11.3
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.5
Installing tzinfo 1.2.5
Fetching activesupport 5.2.2.1
Installing activesupport 5.2.2.1
Fetching builder 3.2.3
Installing builder 3.2.3
Fetching erubi 1.8.0
Installing erubi 1.8.0
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.3
Installing nokogiri 1.10.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.10.3/ext/nokogiri /usr/bin/ruby2.5 -r ./siteconf20190424-9657-1w4lnbg.rb extconf.rb mkmf.rb can&apos;t find header files for ruby at /usr/lib/ruby/include/ruby.h extconf failed, exit code 1

Well this is first encounter ‘nokogiri’ has failed To solve this error mannually install ‘nokogiri’ after installing following dependencies

/usr/share/redmine-4.0.3 $sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
/usr/share/redmine-4.0.3$ sudo gem install nokogiri -v 1.10.3 
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.3
Parsing documentation for nokogiri-1.10.3
Installing ri documentation for nokogiri-1.10.3
Done installing documentation for nokogiri after 2 seconds
1 gem installed

Now continue with installing dependencies, Check out our services and offerings at RedmineLab.com

/usr/share/redmine-4.0.3$ sudo bundle install --without development test
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2.1
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.4
Installing crass 1.0.4
Fetching loofah 2.2.3
Installing loofah 2.2.3
Fetching rails-html-sanitizer 1.0.4
Installing rails-html-sanitizer 1.0.4
Fetching actionview 5.2.2.1
Installing actionview 5.2.2.1
Fetching rack 2.0.7
Installing rack 2.0.7
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.2.1
Installing actionpack 5.2.2.1
Fetching nio4r 2.3.1
Installing nio4r 2.3.1 with native extensions
Fetching websocket-extensions 0.1.3
Installing websocket-extensions 0.1.3
Fetching websocket-driver 0.7.0
Installing websocket-driver 0.7.0 with native extensions
Fetching actioncable 5.2.2.1
Installing actioncable 5.2.2.1
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.2.2.1
Installing activejob 5.2.2.1
Fetching mini_mime 1.0.1
Installing mini_mime 1.0.1
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.2.2.1
Installing actionmailer 5.2.2.1
Fetching method_source 0.9.2
Installing method_source 0.9.2
Using thor 0.20.3
Fetching railties 5.2.2.1
Installing railties 5.2.2.1
Fetching actionpack-xml_parser 2.0.1
Installing actionpack-xml_parser 2.0.1
Fetching activemodel 5.2.2.1
Installing activemodel 5.2.2.1
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.2.1
Installing activerecord 5.2.2.1
Fetching mimemagic 0.3.3
Installing mimemagic 0.3.3
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 5.2.2.1
Installing activestorage 5.2.2.1
Fetching public_suffix 3.0.3
Installing public_suffix 3.0.3
Fetching addressable 2.6.0
Installing addressable 2.6.0
Using bundler 2.0.1
Fetching css_parser 1.7.0
Installing css_parser 1.7.0
Fetching csv 3.0.9
Installing csv 3.0.9
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/mysql2-0.5.2/ext/mysql2
/usr/bin/ruby2.5 -I /usr/local/lib/site_ruby/2.5.0 -r ./siteconf20190424-20515-dxgpwf.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
checking for -lmysqlclient... no

This is second encounter of builderror, here mysql client is missing. You need to install mysql client by running following command

/usr/share/redmine-4.0.3
$apt-get install libmysqlclient-dev
/usr/share/redmine-4.0.3$ sudo bundle install --without development test
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2.1
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.2.1
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.2.1
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.7.0
Using actioncable 5.2.2.1
Using globalid 0.4.2
Using activejob 5.2.2.1
Using mini_mime 1.0.1
Using mail 2.7.1
Using actionmailer 5.2.2.1
Using method_source 0.9.2
Using thor 0.20.3
Using railties 5.2.2.1
Using actionpack-xml_parser 2.0.1
Using activemodel 5.2.2.1
Using arel 9.0.0
Using activerecord 5.2.2.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.2.1
Using public_suffix 3.0.3
Using addressable 2.6.0
Using bundler 2.0.1
Using css_parser 1.7.0
Using csv 3.0.9
Using htmlentities 4.3.4
Fetching mysql2 0.5.2
Installing mysql2 0.5.2 with native extensions
Fetching net-ldap 0.16.1
Installing net-ldap 0.16.1
Fetching ruby-openid 2.3.0
Installing ruby-openid 2.3.0
Fetching rack-openid 1.4.2
Installing rack-openid 1.4.2
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Fetching rails 5.2.2.1
Installing rails 5.2.2.1
Fetching rbpdf-font 1.19.1
Installing rbpdf-font 1.19.1
Fetching rbpdf 1.19.8
Installing rbpdf 1.19.8
Fetching redcarpet 3.4.0
Installing redcarpet 3.4.0 with native extensions
Fetching request_store 1.0.5
Installing request_store 1.0.5
Fetching rmagick 2.16.0
Installing rmagick 2.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
ERROR:  Error installing rmagick:
current directory: /var/lib/gems/2.5.0/gems/rmagick-2.16.0/ext/RMagick
/usr/bin/ruby2.5 -I /usr/local/lib/site_ruby/2.5.0 -r ./siteconf20190424-21434-cp20lm.rb extconf.rb
checking for gcc... yes
checking for Magick-config... no
checking for pkg-config... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc&apos;
to the PKG_CONFIG_PATH environment variable
No package &apos;MagickCore&apos; found
checking for outdated ImageMagick version (<= 6.4.9)... *** extconf.rb failed ***

This is third and last encounter of BuildError and it is for RMagick, one can continue without RMagic by running following command.

RMagick (allows the use of ImageMagick to manipulate images for PDF and PNG export)

If you want to skip the installation of the rmagick gem, then execute below command:

/usr/share/redmine-4.0.3 $sudo bundle install --without development test rmagick

Else you can install ImageMagick after installing its dependency as follows

/usr/share/redmine-4.0.3 $sudo apt-get install libmagickwand-dev
/usr/share/redmine-4.0.3$ sudo gem install rmagick 
Fetching rmagick-3.1.0.gem Building native extensions.
This could take a while...
Successfully installed rmagick-3.1.0
Parsing documentation for rmagick-3.1.0 Installing ri documentation for rmagick-3.1.0
Done installing documentation for rmagick after 1 seconds
1 gem installed
/usr/share/redmine-4.0.3$ sudo bundle install --without development test 
Don&apos;t run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x64-mingw32, x86-mswin32. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x64-mingw32 x86-mswin32`.
Fetching gem metadata from https://rubygems.org/............. Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.5
Using i18n 0.7.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2.1
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.3
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.2.1
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.2.1
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.7.0
Using actioncable 5.2.2.1
Using globalid 0.4.2
Using activejob 5.2.2.1
Using mini_mime 1.0.1
Using mail 2.7.1
Using actionmailer 5.2.2.1
Using method_source 0.9.2
Using thor 0.20.3
Using railties 5.2.2.1
Using actionpack-xml_parser 2.0.1
Using activemodel 5.2.2.1
Using arel 9.0.0
Using activerecord 5.2.2.1
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.2.1
Using public_suffix 3.0.3
Using addressable 2.6.0
Using bundler 2.0.1
Using css_parser 1.7.0
Using csv 3.0.9
Using htmlentities 4.3.4
Using mysql2 0.5.2
Using net-ldap 0.16.1
Using ruby-openid 2.3.0
Using rack-openid 1.4.2
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.2.2.1
Using rbpdf-font 1.19.1
Using rbpdf 1.19.8
Using redcarpet 3.4.0
Using request_store 1.0.5
Fetching rmagick 2.16.0
Installing rmagick 2.16.0 with native extensions
Fetching roadie 3.4.0
Installing roadie 3.4.0
Fetching roadie-rails 1.3.0
Installing roadie-rails 1.3.0
Fetching rouge 3.3.0
Installing rouge 3.3.0
Bundle complete! 27 Gemfile dependencies, 59 gems now installed. Gems in the groups development and test were not installed. Use `bundle info [gemname]` to see where a bundled gem is installed.

Step 6 - Database schema objects creation

Generate a random key used by Rails to encode cookies storing session data thus preventing their tampering.
$bundle exec rake generate_secret_token

Create the database structure, by running the following command under the application root directory (in my case its -/usr/share/redmine-4.0.3 $):

/usr/share/redmine-4.0.3 $RAILS_ENV=production bundle exec rake db:migrate

This step wil take some time as it creates database schema and strucutre, make sure that username and password is correct in ‘config/database.yml’ file.

/usr/share/redmine-4.0.3# RAILS_ENV=production bundle exec rake db:migrate
== 1 Setup: migrating =========================================================
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- create_table("attachments", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
-> 0.3043s
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- create_table("auth_sources", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
-> 0.2463s
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- create_table("custom_fields", {:options=>"ENGINE=InnoDB", :force=>true, :id=>:integer})
-> 0.3116s
== 20170419144536 AddViewMessagesToAllExistingRoles: migrating ================
== 20170419144536 AddViewMessagesToAllExistingRoles: migrated (0.1432s) =======
== 20170723112801 RenameCommentsToContent: migrating ==========================
-- rename_column(:comments, :comments, :content)
-> 0.1457s
== 20170723112801 RenameCommentsToContent: migrated (0.1458s) =================
== 20180913072918 AddVerifyPeerToAuthSources: migrating =======================
-- change_table(:auth_sources)
-> 0.8880s
== 20180913072918 AddVerifyPeerToAuthSources: migrated (0.8882s) ==============
== 20180923082945 ChangeSqliteBooleansTo0And1: migrating ======================
== 20180923082945 ChangeSqliteBooleansTo0And1: migrated (0.0000s) =============
== 20180923091603 ChangeSqliteBooleansDefault: migrating ======================
== 20180923091603 ChangeSqliteBooleansDefault: migrated (0.0000s) =============

Then insert default configuration data in database, by running the following command: This step will ask to select language. In my case I have selected 'en' for English.

/usr/share/redmine-4.0.3$ RAILS_ENV=production bundle exec rake redmine:load_default_data 

Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] en ==================================== Default configuration data loaded.

Step 7 – Test The Installation

Test the installation by running WEBrick web server:

/usr/share/redmine-4.0.3
$bundle exec rails server webrick -e production

http://localhost:3000/

Use default administrator account to log in:

  • login: admin
  • password: admin
Redmine 4.0.3

Above steps explains about how to install latest Redmine on Ubuntu, there is alternative to this mannual installation.

Alternative to manual installation

There is alternative to above steps, if you do not want to go for above lengthy steps one can follow Easy redmine installation stpes on Ubuntu, But keep in mind, this alternative installation step will install –Redmine 3.4.4. And most of the free plugins simply do not work on this redmine version.

Redmine 3.4.4 version

That’s it!

You have successfully installed Redmine on Ubuntu 18.04 and 18.10….

Happy bugging.

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

Install Plugin

Following steps explain about how to install new plugin in to make full use of Redmine. Redmine is powerfull tool but with diffrent plugins its very easy to untilize Redmine’s full power.

Navigate to ‘plugins’ directory of redmine

/usr/share/redmine-4.0.3/plugins $git clone git://github.com/deecay/redmine_pivot_table

/usr/share/redmine-4.0.3 $sudo RAILS_ENV=production rake redmine:plugins:migrate

Test it using webrick server

/usr/share/redmine-4.0.3 $bundle exec rails server webrick -e production

Install Review Board on Ubuntu Linux System

Review Board as their website mentions it really takes the pain out of code review. It is one of the widely used open source software tool for your code reviews. Using tool like Review Board save lot of time in review. This post describes review board version 3.0.14 installation steps on fresh system along with the solution for Bad Request (400) message. Yes, On fresh Ubuntu system once installation is complete this Review board shows up this error. Lets start with installation steps.

Step 1 – Install MySQL and Apache

Assuming this is fresh Linux system and MySQL Apache is not installed yet follow below steps.

$sudo apt-get install mysql-server

$sudo apt-get install apache2 libapache2-mod-wsgi

Create empty database for review board

Use following Reviewboard mysql commands

mysql> CREATE DATABASE reviewboard CHARACTER SET utf8;

Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER ‘$USER’@’localhost’ IDENTIFIED BY ‘Password’

mysql> CREATE USER ‘$USER’@’localhost’ IDENTIFIED BY ‘Password’;

Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON reviewboard.* to ‘$USER’@’localhost’;

Query OK, 0 rows affected (0.00 sec)

Step 2 – Install Dependencies

$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

$python get-pip.py

$ pip install -U pip setuptool
$ apt-get install build-essential python-dev libffi-dev libssl-dev patch

$sudo apt-get install python-mysqldb
$sudo apt-get install memcached
$sudo apt-get install python-memcache

Step 3 – Install Review Board

$sudo apt-get install patch 
$sudo apt-get install subversion
$sudo apt-get install python-svn
$sudo apt-get install python-setuptools
$sudo easy_install reviewboard

$sudo rb-site install /var/www/reviews.com

chown -R www-data /var/www/reviews.com/htdocs/media/uploaded 
chown -R www-data /var/www/reviews.com/htdocs/media/ext
chown -R www-data /var/www/reviews.com/htdocs/static/ext
chown -R www-data /var/www/reviews.com/data

$cd /etc/apache2/sites-available
$cd /etc/apache2/sites-available

$cp /var/www/reviews.com/conf/ reviews.com.conf

$cd ../sites-enabled

$ln -s ../sites-available/reviews

Start review board
sudo a2dissite default
sudo a2ensite reviews.com.conf
sudo /etc/init.d/apache2 restart

Accessing url:=== http://192.168.206.24/reviews.

if you are getting following error

[Mon Mar 25 17:48:45.230130 2019] [mpm_event:notice] [pid 20381:tid 139766387678144] AH00491: caught SIGTERM, shutting down

[Mon Mar 25 17:48:45.313877 2019] [mpm_event:notice] [pid 20717:tid 139964285795264] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 configured — resuming normal operation and

Bad Request (400) message.

This is a very important step; Open ‘settings_local.py’ and make following change

$sudo vi /var/www/reviewboard/conf/settings_local.py

ALLOWED_HOSTS = [‘reviewboard’]

To

ALLOWED_HOSTS = [‘*’]

Thats it your reviewboard ver. 3.0.14 is up and running. Happy reviewing!!!

USB Host API’s in the android.hardware.usb

When Android-powered device is in USB host mode, it acts as the USB host, powers the bus, and enumerates connected USB devices.

Manifest Requirements

Following things need to be add in Manifest file:

  • <uses-feature> element that declares that your application uses the android.hardware.usb.host feature.
  • Set the minimum SDK of the application to API Level 12 or higher.
  • add <intent-filter>(USB_DEVICE_ATTACHED) and <meta-data> .<meta-data> points to an xml file which contains vendor-id,produt-id,class,subclass,protocol.
  • to give information <usb-device> tag can be used.
<manifest ...>
<uses-feature android:name="android.hardware.usb.host" />
<uses-sdk android:minSdkVersion="12" />
...
<application>
<activity ...>
...
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/xml_file_name" />
</activity>
</application>
</manifest>

android.hardware.usb package

USB host API’s in the android.hardware.usb

Redmine Could Not Spawn Process Error Solved

Redmine is popular open source project management tool used as project monitoring and tracking tool. After recent update of bundler, redmine was not starting. We are using Redmine on Ubuntu from past one month without any issue, suddenly it was not starting. When we checked production log file under ‘ /var/log/redmine/default/'

We could see following error –

[ 2016-02-24 08:25:17.8434 6628/7efdf3c1e700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /usr/share/redmine: An error occurred while starting up the preloader: it did not write a startup response in time.

Message from application: Bundler could not find compatible versions for gem "bundler":

In Gemfile:

rails (~> 4.2.8) was resolved to 4.2.10, which depends on

bundler (< 2.0, >= 1.3.0)

Current Bundler version:

bundler (2.0.1)

This Gemfile requires a different version of Bundler.

Perhaps you need to update Bundler by running `gem install bundler`?

We have tried to update Bundler as per suggestion but no luck getting same error. So actual issue was with passenger.

To debug this issue we have started Redmine without passenger, navigate to redmine install folder/directory and execute following command.

$rails server webrick -e production

or

$rails server webrick -p 3001 -e production 

And it worked.

Following is Redmine environment

[redmine]$ sudo ruby bin/about 
sh: 1: darcs: not found
sh: 1: hg: not found
sh: 1: bzr: not found
Environment: Redmine version 3.4.4.stable
Ruby version 2.5.1-p57 (2018-03-29) [x86_64-linux-gnu]
Rails version 4.2.10
Environment production
Database adapter Mysql2
SCM:
Subversion 1.9.7
Cvs 1.12.13
Git 2.17.1 Filesystem
Redmine plugins:
no plugin installed

Happy bugging.

Check out our services and offerings at RedmineLab.com

EmbSysRegView Alternative Plugin For Eclipse

If you are looking for alternate option for EmbSysRegView (embedded system register view) plugin or wondering ‘How to Add Register Details View in Eclipse” this post describes simple trick to it. The standard Eclipse registers view shows only the core registers, which is not enough in embedded system development. So, EmbSysRegView – is an open source solution for 8, 16 and 32 bit microcontroller to display special function registers (SFR) while debugging.

EmbSysRegView is a good plugin which supports GCC toolchain including GDB with Eclipse for emebedded system development, but it is not maintained and lacks support for new controllers. One can always refer to previous post we have seen how to add register details view in Eclipse for SAME54 series. However those steps can be used to add support for any other microcontrollers. This post describes about alternative to EmbSysRegView.

Eclipse provide peripherals view, this view shows details based on memory location meaning, you can monitor memory locations using this view. By default this view looks like as shown in this screenshot.

Peripherals view in Eclipse

To make use of this view to show SFR and other registers we will use “SVD Path” option from “debug configurations” of eclipse. In Eclipse click on “Run”-> “Debug Configurations” and select “SVD path” tab. It is assumed that you have completed debug configurations.

Here you have to provide svd file path of your controller. In my case we are using SAME54 controller. The best place to get latest updated SVD file is from installation directory of the IDE. For 32bit Microchip controllers svd files can be found in following path – “C:/Program Files(x86)/Atmel/Studio/7.0/packs/atmel/SAME54_DFP/1.0.87/svd/ATSAME54P20A.svd”. Location “Atmel/Studio/7.0/packs/” have all svd file eg. SAM3A, SAM4C, SAMD, SAME, SAMG, SAMH, SAML, SAMR and SAMS controller series. Select the svd file as per your controller.

SVD Path update for SAME54 controller

Once this is updated click on “debug” to start debugging. One can also provide variables instead of absolute path for .svd files. CMSIS-SVD – Cortex Microcontroller Software Interface Standard – System View Description format- files provides consistent view to device and peripherals.
In debug mode stop at any breakpoints and you can view peripherals now. All the updates are marked in yellow.

EmbSysRegView Alternative

Although EmbSysRegView provides good interface in eclipse there is always better to have alternate solution if one plugin is not working. With the Embedded Systems Register View and this peripherals view you have a gateway to inspect peripheral registers of device under debug. This is possible with open source software like eclipse, gdb, openocd and CMSIS-SVD files.

EmbSysRegView In Eclipse For SAME54 On Ubuntu

After successfully able to debug using OpenOCD and Eclipse, Now it is time to explore more. To start with, lets install EmbSysRegView plugin, This plugin gives similar functionality to the ‘I/O view’ in Atmel Studio 7. It displays special functions registers (SFR), peripheral registers values and memory values. This needed in embedded system development.

Installation

Bad news is, You can not install the EmbSysRegView plugin from the eclipse marketplace since eclipse marketplace is referring to old sourceforge download URL.

Installation from Marketplace fails: 
An error occurred while collecting items to be installed
session context was:(profile=_Applications_Eclipse.app_Contents_Eclipse, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Artifact not found: http://embsysregview.sourceforge.net/update/plugins/org.eclipse.cdt.embsysregview_0.2.6.jar.

The new link to download is from sourceforge latest download, But it does not download full files and this is also failing. Even if you try to download the source from git

$git clone https://git.code.sf.net/p/embsysregview/git embsysregview-git
It says downloaded folder is empty :-(.

Tried to do google and found out one workaround, But according to workaround for this problem tried to update the plugin in eclipse but failed, so tried with the updated script as

wget
https://sourceforge.net/projects/embsysregview/files/latest/download/org.eclipse.cdt.embsysregview_feature_0.2.6.jar

But this is also failing.

Embsysregview not working

Simple solution is download all four files from sourceforge project folder to your local folder.

EmbsysregView download from parent folder

Copy these four files to “Dropins” folder inside Eclipse and restart Eclipse.

Then use the menu Window > Show View -> other -> Debug and open the EmbSys Registers view: you will get ERROR: please select chip using prefrence page (C++/Debug/EmbSys Register View), so select the proper chip.

Adding Support For SAME54 in EmbSysReg

EmbSysRegView does not come with Atmel/Microchip SAM E54 microcontroller, so This short article explains how to add support for SAM E54 seris in EmbSysRegView with Eclipse on latest Ubuntu.

For this we need to get CMSIS SVD files -The CMSIS System View Description format(CMSIS-SVD) – is the memory mapped registers of peripherals contained in ARM Cortex-M processor-based microcontrollers. That contain standardized descriptions for peripherals and their registers for Cortex-M microcontrollers. All device support from Atmel is available in packs. So Download the pack for SAME54 series and unzip it.

This file we need to copy into ‘ org.eclipse.cdt.embsysregview.data_0.2.6.r191.jar'

Open Terminal at the folder with the jar file and run the following commands, this will add svd files and update .jar with added support of SAME54

$unzip org.eclipse.cdt.embsysregview.data_0.2.6.r191.jar -d temp
//Navigate to ‘Atmel.SAME54_DFP.1.0.87’->svd folder
//Then copy these files to ‘temp->data->SVD (CMSIS)->Atmel’
//Change the extension from .svd to .xml
//create .jar file out which includes this update
$jar cvf org.eclipse.cdt.embsysregview.data_0.2.6.r191.jar -C temp/ .

Now copy this updated .jar file to “dropins” folder in Eclipse and restart IDE.

SAME54 Support added in EmbSysRegView

You can now able to select ATSAME54 controller to view all registers. Happy debugging.



Debugging in Eclipse Using OpenOCD on Ubuntu

This is second part of ongoing tutorial on setting up GCC + Eclipse + OpenOCD environment for use with the SAME54 Xplained pro board on latest Ubuntu system. In order to be able to follow this blog entry you must already have the gcc-arm toolchain and openOCD configured

When we talk about debugging it is important to know that the actual “debugger” or emulation hardware is “on chip” and is called the “on chip debug” (OCD) hardware. While there are other methods to debug your embedded code using DDD, Kgdb, & Gdb on Ubuntu in this post will see debugging using Eclipse.

Prerequisite – Download and install the latest version of Eclipse (open-source integrated development environment). Compile and install openOCD (Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing). Eclipse along with OpenOCD is an ultimate opensource alternative to the MPLAB IDE and Atmel Studio IDEs.

Make Eclipse Settings Right

Then Install the GNU MCU plugin from the Eclipse Marketplace. Go to Help>Marketplace then search for “GNU”.

Configure the Eclipse global path location.

Go to Window>Preferences or type ‘OpenOCD’ in the search box and select Global, Leave Executable as is if it says ‘openocd’, otherwise add ‘openocd’. For the path, browse to the location where you installed it.

Select the project that you have download in previous step and create Makefile project with the existing code.

Enter a name for the project then browse to the location where you extracted downloaded AtmelStart project. Choose ARM Cross GCC for the toolchain.

Edit the project properties (go to Project>Properties) and select ‘C/C++ Build’ and change the Build Directory location to “gcc” as shown bleow

This should update the ‘Build directory’ path to ${workspace_loc:/RTC_Event/gcc}

Now you can build the project. Since this is first time using eclipse and we have selected to create makefile project, At this stage, there is chance that you can see following two errors.

arm-gcc not found – this could be because you have not set PATH variable, and the arm-gcc bin path is not set in Eclipse. Set this under global preference in eclipse, in my case gnu toolchain is kept in /usr/lib/. Make sure you give path till /bin. go to (Window →) Preferences → MCU → Global ARM toolchains Path (or Workspace ARM toolchains Path) it should look as follows –

Now try to build the project. This time project build is success from command line using ubuntu terminal but it is failing in eclipse with following error :

 "all" terminated with exit code 127
clean terminated with exit code 127

This could be because we have to select GNU parser under settings->binary parser and set to ‘GNU elf parser’ from default ‘elf parser’

With these settings your makefile project must compile successfully.

OpenOCD Settings in Eclipse

Let us setup OpenOCD by configuring the debug settings in Run>Debug Configurations.

1 Double-click on ‘GDB OpenOCD Debugging’. This will create a target with the same name as your project. OpenOCD setting will be here.

2. In the Config options field, we need to add a line to point to the target board script. Here we will give absolute path for OpenOCD location.
For example:
-f ${openocd_path}/tcl/board/atmel_same54_xplained_pro.cfg

All other options can be left alone.

Now hit debug button in eclipse. If you encounter “Error: unable to open CMSIS-DAP device” then it is very likely that you need to run eclipse as “sudo”. To solve this error as explained in previous blog entry, close eclipse and start it using $ sudo eclipse

Happy debugging using eclipse and openOCD.

Few steps are referred from microchip developer site. More detailed descriptions at Eclipse.

ARM Cortex-M4 HOWTO Debug Under Ubuntu

With SAME54 board and using OpenOCD will debug the LED Flasher example. This post assumes that basic setup is ready using GNU-ARM Embedded Tool chain and OpenOCD.

Basic gdb with OpenOCD

To Begin with connect the SAME54 explained pro board and start the OpenOCD server using telnet

telnet localhost 444

>reset halt

Then it is time for gdb to use GDB via openocd there are couple of options like, gdb, ddd, insight and kdgb. Will start with gbd

$arm-none-eabi-gdb --eval-command="target remote localhost:3333" AtmelStart.elf

This will start gdb with remote debugging and you can see following message

Type "apropos word" to search for commands related to "word"…
Reading symbols from AtmelStart.elf…
Remote debugging using localhost:3333
main () at ../led_switcher_main.c:55
55 delay_ms(100);
(gdb) list

Add breakpoint and continue “cont” execution

This time you may see following error, if you are running it for first time.

> same54.cpu : clearing lockup after double fault

If you happen to get this error, that means, Your CPU was in locked state. That means it could not run its “Hard Fault” Interrupt Handler (maybe there is a 0 in its Vector).
Simple solution to this is – you can either reset your board or execute openocd with “gdb_memory_map enable option”

$sudo openocd -f tcl/board/microchip_same54_xplained_pro.cfg -c "gdb_memory_map enable"  

OpenOCD with DDD debugger

DDD is quite nice little gdb front end.

$ddd --eval-command="target remote localhost:3333" --debugger arm-none-eabi-gdb AtmelStart.elf 

OpenOCD with Kdbg

This is another nice front end for gdb and one of my favorite. Before you start using it first edit Settings->global Options and change the option “How to invoke GDB” to “arm-none-eabi-gdb –fullname -nx”

Then you close and reopen with kdbg in command line as

$kdbg -r localhost:3333 AtmelStart.elf 

Put breakpoint in main and start debugging your program. Happy debugging.