Successfully installed ERPNext --production on RPi (Ubuntu 16.04.4, armhf, 32-bit), modified install.py playbooks

This is a documentation of how I modified playbooks tasks and manually applied changes to finally get ERPNext running on RPi 3. I expect it to work on RPi 2 as well, since I’m using RPi 2’s Ubuntu Server image (there’s no official RPi 3 Server image, only Ubuntu Core 16 is supported).

Please read the whole post first if you want to use my experience as reference.

playbooks modification:

  1. add armhf,arm64 or completely remove arch specification on node 6.x repo add
playbooks/roles/nodejs/tasks/main.yml
@@ -1,31 +1,31 @@
   apt_repository:
-    repo: "deb [arch=amd64,i386] https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
+    repo: "deb https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
     state: present
   register: node_repo
   when: ansible_os_family == 'Debian' or ansible_distribution == 'Ubuntu'

Both, adding [arch=amd64,arm64,armhf,i386] or completely removing arch argument to let system decide works.

  1. remove bench argument from bench init and bench get-app commands
playbooks/roles/bench/tasks/main.yml
@@ -35,7 +35,7 @@
     when: not bench_stat.stat.exists and not production
 
   - name: python2 bench init for production
-    command: bench init {{ bench_path }} --frappe-branch {{ branch }}
+    command: bench init {{ bench_path }}
     args:
       creates: "{{ bench_path }}"
     when: not bench_stat.stat.exists and production

playbooks/roles/bench/tasks/setup_erpnext.yml
@@ -4,7 +4,7 @@
     register: app
 
   - name: Get the ERPNext app
-    command: bench get-app erpnext https://github.com/frappe/erpnext --branch {{ branch }}
+    command: bench get-app erpnext https://github.com/frappe/erpnext
     args:
       creates: "{{ bench_path }}/apps/erpnext"
       chdir: "{{ bench_path }}"

I’ve absolutely no idea why, but running those commands will always fail and exit with errors. I might have the error output somewhere on this forum of GitHub issues; I don’t have extra SD card, RPi or time to rerun just to record the errors again.

  1. if you forked and modified your own bench repo to apply these modifications, you need to point install.py to use it
playbooks/install.py
@@ -207,7 +207,7 @@ def clone_bench_repo(args):
 		clone_path = tmp_bench_repo
 
 	branch = args.bench_branch or 'master'
-	repo_url = args.repo_url or 'https://github.com/frappe/bench'
+	repo_url = args.repo_url or 'https://github.com/oxwivi/bench'
 
 
 	success = run_os_command(

But these aren’t enough for bench and erpnext to get going.

MariaDB fuckery

The official MariaDB repo added by the easy install script doesn’t have either armhf or arm64 repositories, so MariaDB 10.0 gets installed from official Ubuntu repo. The script installing it and trying to restart it fails, so it’s better to mauinally install it before running install.py:

sudo apt install mariadb-server

I’ve no idea if the script’s MariaDB configuration gets applied or not, but there are two issues that needs solving:

  1. cannot access mysql without sudo:
TASK [mariadb : Set root Password] *********************************************
failed: [localhost] (item=localhost) => {"changed": false, "item": "localhost", "msg": "unable to connect to database, check login_user and login_password are correct or /home/ubuntu/.my.cnf has the credentials. Exception message: (1********45, \"Access denied for user 'root'@'localhost' (using password: NO)\")"}
...ignoring

$ mysql -u root -p
Enter password: 
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
$ sudo mysql -u root # I had to use "sudo" since is new installation
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 10.0.34-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

This is caused by Ubuntu’s MariaDB packages shipped with unix_socket authentication by default, according to this Stack Overflow answer. Probably MariaDB’s official packages don’t do that and running install.py on arch supported by MariaDB repo don’t face it.

To solve this, I had to empty the plugin column on mysql.user table:

$ sudo mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 35
Server version: 10.0.34-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> UPDATE mysql.user SET plugin = '' WHERE plugin = 'unix_socket';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> exit;
Bye

This allowed me to access mysql without sudo:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.0.34-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> Ctrl-C -- exit!
Aborted

However, this wasn’t the end of it.

  1. solve new-site site1.local failed because MariaDB is not properly configured to use the Barracuda storage engine.
$ bench new-site site1.local --admin-password 0 --mariadb-root-password 0
================================================================================
Creation of your site - site1.local failed because MariaDB is not properly 
configured to use the Barracuda storage engine. 
Please add the settings below to MariaDB's my.cnf, restart MariaDB then 
run `bench new-site site1.local` again.


[mysqld]
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

================================================================================

To solve this, I tried , a solution from this forum itself, but it didn’t work.

This time, I copied the default /etc/mysql/conf.d/settings.cnf to /etc/mysql/mariadb.conf.d/, and it worked with a couple of warnings:

$ sudo cp /etc/mysql/conf.d/settings.cnf /etc/mysql/mariadb.conf.d/
$ sudo systemctl restart mysql
frappe@ubuntu:~/frappe-bench$ bench new-site site1.local --admin-password 0 --mariadb-root-password 0
Warning: skipping '!includedir /etc/mysql/mariadb.conf.d/' directive as maximum includerecursion level was reached in file /etc/mysql/mariadb.conf.d/settings.cnf at line 64
Warning: skipping '!includedir /etc/mysql/mariadb.conf.d/' directive as maximum includerecursion level was reached in file /etc/mysql/mariadb.conf.d/settings.cnf at line 64

Installing frappe...
Updating DocTypes for frappe        : [========================================]
Updating country info               : [========================================]
*** Scheduler is disabled ***

Conclusion

Please note, on the same Ubuntu 16.04 amd64 arch, everything worked with zero modification.

The node 6.x case is obvious enough, but I don’t know why specifying branch would fuck everything up during installation on armhf arch.

Lastly, I’ve no idea if all three of the MariaDB changes I applied is necessary to get it to work. Perhaps only the last one is enough, and it can be further refined when the exact issue of why those configuration are not applied can be found.

3 Likes

Whats the reason behind removing branch param?

As its already configurable parameter no need to make changes in code.

@saurabh6790, this is what happened when {{ branch }} was specified: Bench can't install ERPNext due to ContextualVersionConflict

MariaDB authentication issue is supposedly due to the packages shipped via Ubuntu repo configure unix_socket authentication by default, and installations using MariaDB packages don’t face this issue.

Updated OP with that information.

@oxwivi

This is an interesting case.

When you set out to make this work on a RPi, was it to run as a stand-alone single user device, or were you actually able to get the RPi to play the part of an ERPNExt server serving other network users?

I am interested it trying something like this by using a pair of RPi units stuck to the back of small monitors to act as receiving and inventory control terminals. If the RPi can play the multi-user server part then maybe 3 units would be best (one to play server and the other two to be browser terminals).

I have about a dozen new RPi units in a stack here collecting dust, so this would be a really good application for them.

Just curious about your particular usage case. How did you eventually use the finished device?

BKM

I have not tried to reinstall it recently, but if the case and installation procedure to get it running is the same as the one I mention in this thread it is not worth it.

You see, to get it running, there are three main pain points, the last of which results in a broken system:

  • NodeJS PPA
  • Lack of ARM MariaDB, working around Ubuntu/Debian repo’s MariaDB default behavior
  • chromedriver@2.37.0 dependency in the stable branch (as of when the post was last updated, I don’t know if the dependency remains with later or latest stable releases)

The NodeJS and MariaDB workarounds I’ve detailed, but the workaround for the chromedriver thing (I don’t recall which component depended on it and its usage in the project) means running a Frankenstein monster setup of Frappe and ERPNext. The Frappe installed will be stable, but the ERPN will be of the development branch. The resulting database structure is so fragile, it will break if you were to attempt to bench update anything. In fact, attempting to do just that resulted in me creating this post: Recover item master, purchase and sales invoices from SQL dump

Now, however, the Frappe projects README mentions RPi in installation requirements, so I want to give it a try again, and see if they can add NodeJS’ ARM repo automatically, use distributor’s MariaDB package and finally done away with the chromedriver dependency.

Please do post back if your next install attempt makes it past the “Frankenstein” stage to something useful. If it turns out to be relatively stable, I might add something to the development of it as a mini network enabled system.

BKM

I’m afraid I must disappoint you. I just installed it on a regular Intel system, it still adds MariaDB repo instead of the default distribution’s package.

The chromedriver thing needs further investigation. If that dependency is eliminated, you can just fork the playbooks script and add relevant SQL commands to make it play nice with the distro-provided MariaDB packages and NodeJS’ ARM repos.

@bkm, I successfully installed ERPN on RPi3 without errors. Manual install, however. The easy install script would require quit a bit of modification before it can be used on ARM systems.

1 Like