ERPNext persistent Installation Issues

Hi guys;

I am facing funny installation problems with our beloved ERPNext lately; It appears the clean installs are more error prone than upgrades.

I have failed on 4 occasions to make clean installations, on Ubuntu 18, 16 and 14. They all fail with this:

Traceback (most recent call last): File "install.py", line 432, in <module> install_bench(args) File "install.py", line 128, in install_bench run_playbook('site.yml', sudo=True, extra_vars=extra_vars) File "install.py", line 344, in run_playbook success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks')) File "/usr/lib/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=kent']' returned non-zero exit status 2

For installation, Python 2.7, python-dev, setup-tools and the other dependencies are installed, user has the right privileges, Also I noticed lately the installation can take well over an hour, and on fast hardware, at the init bench for production stage.

Anyone know what this is about?

Perhaps give us some detail with the steps up to and including the command that results in the message. Which installation method and source?

ok, production install, easy install, on 18.04 LTS Ubuntu Server. Python was missing but rightly installed and setup fails with that command.

This seems to be a somewhat common problem, have a look at this thread or search the forums for ā€œbecome-user=ā€.

Oh yes, it is, and I have tried all those things in the posts, currently trying without the --user switch againā€¦

So like some have experienced, nothing has worked. I wouldnā€™t blame the team much, itā€™s complicated especially given the amount of packages; but I must be honest, I would expect after so many years I should be a ā€˜veteranā€™ installer or at least, things should be way better lol :smile: given that I have installed ERPNext over 100 times in my years using it, including over 30 production installs; yet installations and updates still give me a huge belly punch, you never know what to expect. But, I aint complaining , guess I will download the production VM and try to update it. I have better luck with upgrades these daysā€¦

I have seen this error many times and (me, mostly installing inside of LXD/LXC containers) most of the times was able to solve this by using the --container option with the easy install script and installing as a root user with for an existing user which I specify with the --user option.

python install.py --production --container --user [username]

Great vrms, this is one option I havenā€™t tried, indeed this is a vbox installation; although I opted to get the VM production image and ramp it up to what I need, I prefer the VM due to our unique environment and power challenges, having backups with the Vm installs is a lot easier even for a non technical personā€¦ but this is something I will try out today. Thank you. I will post a feedback

I faced this situation for over a week attempting several clean installs on different platforms. Only way i could get my installation to go past that error was to first create the user, run install from root and using install script, i specified the user.

python install.py --production --user [username]

Note that if you run it from the created user, whether you use the --user or not, it will fail.

1 Like

Best advice EVER !!!

This actually works and stops all of the install errors I have been having over the past several months. Thanks @flexy2ky

BTWā€¦ It also works with the doing the v10 install as well - like this:

sudo python install.py --production --user [your-user] --frappe-branch v10.x.x --erpnext-branch v10.x.x

Thank again for the clue!
BKM

2 Likes

Thanks, yes indeed I have tried these methods, probably many times before starting the topic. I guess itā€™s due to the container thing hinted on other threads as I always do this in a VMā€¦ I canā€™t yet understand how and why this should impact the setup but I will give it a shot.

Meanwhileā€¦ Well, all good, what I did was get a production VM image, expand the size beyond 40gb, fix potential timestamp and time zone issues, and so itā€™s good to go, production ready.

But I will try adding the --container flag and update the thread.

Not so sure about doing anything with the VM image. I just install straight up on the VSP server.

The thing is, all this time, we have been told to NEVER install as ā€˜rootā€™ so every attempt I have tried over the past several months has been as a created user. Every one of them have been failing.

So, to have someone try installing as root, but using the --user switch to place everything into the correct created user account was genius. It may have happened out of desperation, or it may have been inspired by something else, but it proved to be the best path to a successful install on several of my VPS servers in the past few hours.

It even corrected the problems of not being able to get the system configuration script to work on the first login as administrator.

Now the question isā€¦ ā€œHow long will this fix last?ā€

BKM

@bkm

I am happy the solution was of help to you. I can also confirm that it works for develop branch too. I believe the playbook is missing critical steps when it comes to checking if a user exists, what it should do if one does not exist and how to ensure that the right directories are created. I figured that eliminating two critical checks by first creating the user and then issuing the right access to a user not requiring sudo authentication (in this case, the root user) in order to create and write into such user, it will skip both checks and continue with the install, and i was right. My assumption is that linux has changed the way read-write permissions are automatically assigned to directories and it has made it more difficult for non-root users to create new directories or root users to assume root permission levels for certain directories except certain conditions are met.

I am not a developer and only stumbled upon ERPNext about 2 years ago and indeed reading your guides made it easier for me to get used to ERPNext and iā€™ve been in love with it ever since. I will be happy for a developer to take a look at how the script behaves when it comes to assigning permissions when the erpnext directories are created. This is the key to solving the errors in my opinion (but to emphasize, i am not a developer, only theorizing based on usage and limited experience playing with several linux distros).

1 Like

BKM, thanks again, in fact thatā€™s where it was fascinating, I always enable the root user with a strong password and yes, like you in desperation I have tried, used it and created the frappe user or any other user(as recommended for better brute force security). It fails. But itā€™s good to know that it works for some, for experimentation and feedback, I will try this on 14,16 and 18 and see if we could come up with something reliable as per installation method.

may be the version of Ubuntu, I must say I havenā€™t tried the root method in 18LTS, I think only on 16, but I have used root several times over the years, previously in ignorance though, but yes, it is a very seamless method practicallyā€¦

This worked for me on Ubuntu 16.04 and 18.04

BTWā€¦ Ubuntu 18.10 seems to have other problems that get in the way for now so I go back to the 18.04 LTS

BKM

Alright I will give it a shot, thanks again.

I use LTS server versions always. Overall 18 seems to have some network issues; yes.

@noetico

Let me see if i can troubleshoot with you. are you trying to run it on a VM? if yes what VM? let me see if i can replicate your challenge and try the various options iā€™ve used so far?

All my deployments have been on VPS as i generally donā€™t trust VMs and bare metal installations tend to run slower regardless of machine configuration for me (beats me why though). I have some free time today so i can join you to try to crack this nut.

Thanks, I was trying in a VM, I think I have over 25 production installations, all in VM, 4 cloud, 1 Ubuntu desktop install.

I will spin up a VM, and run this again. Only thing I havenā€™t tried is the --container switch which I will excitedly apply. I always use vbox, and since most of the clients are retail outlets, itā€™s usually onsite.

I must confess that Erpnext performs better in the cloud, the 4 digitalocean installations are so sweet, although not in use for high volume operations. the VMs are more prone to funny problems, but then for high volume retailers, given the unique connectivity reliability issues we have, cloud is not an option and offline POS is just too risky although that can also be protected from tampering by locking up Chromeā€¦ The issue of depending on cashiers to sync still remains a huge issue, except Iā€™m outdated, does the POS now sync periodically on its own?

So Iā€™m running this again, VM running Ubuntu 18 LTS Server. So I will keep updatingā€¦
What Iā€™m doing is:

  1. Logged in as root
  2. User created and install.py in user directiory (not root)
  3. cd to user dir
  4. Run production script with --container this time and same --user flag as always

Sideā€¦
Did I mention, I always open this page, GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps whenever I install erpnext? :joy: so even though I have done this more times than I can count, I still always look at this page and try out different ways, right now I have it open. I havent even bothered to memorize the instructions :rofl:

@noetico

I canā€™t really say if cd into new user directory is necessary as using the --user flag will definitely direct all installs to defined user directory. But letā€™s see how it goes.

:rofl::rofl::rofl::rofl: We are in the same boat on this one lol. But you definitely need the playbook download url and thatā€™s pretty long to memorize in my opinion (never bothered to even try). Fingers crossed though that it will run through for you this time.