Nuno Bastos's picture

First of all, I apologise in advance for any misinformation or nonsense I may write here, as I consider myself a "conoisseur" of linux in general, but I am deffinetly not an expert so, if by mistake I write some kind of nonesense or error, I kindly ask you to correct me, I'm always willing to learn!


Being so, I decided to try out Odoo appliance. I already have a multimedia server with turnkey linux to which I added multiple apliances/apps (emby, pydio among others), so I was kinda familiar to it.

I decided to install it to a spare server I had laying around. About installation, so far so good, everything went smooth. Created a test database and tried it out a bit. After that I decided to update all the system. First of all updated Debian from Jessie to Stretch and after that from Stretch to Buster. Installed Python3 latest version and after all those upgrades, I decided to Install Odoo v13, as my goal was to add some 3rd party addons. Note that I didn't uninstall the previous v11 version that came with Turnkey linux. Tried to import a database I had previously created while messing around with odoo v11 but with no luck so I created a new one on v13.

That's when problems arouse. Everytime I boot the server, when I try to access odoo webpage I get a "server connection error" (Error 503). I believe is probably a databse (postgresql) related problem but couldn't figure out where it was. So I stopped the odoo instance.

service odoo stop

However if I start the following instance:

odoo -d MyDatabase

I can access to the odoo v13 panel and all services. This comes with another difficulty. In order to install 3rd Party addons, I added the addons path to odoo.conf. With the command above, when updating apps list using developer mode, nothing happens which lead me to believe that the config file was not being loaded. So I tried to run the following command: 

odoo -d MyDatabase -c /etc/odoo/odoo.conf

But got the following result:

Traceback (most recent call last):
  File "/usr/bin/odoo", line 8, in <module>
    odoo.cli.main()
  File "/usr/lib/python3/dist-packages/odoo/cli/command.py", line 60, in main
    o.run(args)
  File "/usr/lib/python3/dist-packages/odoo/cli/server.py", line 178, in run
    main(args)
  File "/usr/lib/python3/dist-packages/odoo/cli/server.py", line 142, in main
    odoo.service.db._create_empty_database(db_name)
  File "/usr/lib/python3/dist-packages/odoo/service/db.py", line 98, in _create_empty_database
    with closing(db.cursor()) as cr:
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 649, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 186, in __init__
    self._cnx = pool.borrow(dsn)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 532, in _locked
    return fun(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 600, in borrow
    **connection_info)
  File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
	psycopg2.OperationalError: could not translate host name "True" to address: Name or service not known

All of the above was made on root account.


So my questions are:

 - How can I run successfully and smoothly odoo from boot as it does out of the box on turnkey linux?

 - Is there any other odoo.conf file I should change (did a find and /etc/odoo/odoo.conf was the only result)?

 - Is there any other "trick" for installing 3rd party addons I should be aware of?

Thank you!

Forum: 
Jeremy Davis's picture

Firstly a few house keeping matters. I hope you don't mind, but I've edited your post mildly to improve the display of it. I've also modified the tags (on our site they're a comma separated list, so the tag you had created was single big one - no biggie, just thought I'd fix it and mention it for future reference). I've also updated your account so you should be able to bypass most of the spam filtering from here on in (not that it appeared to cause you issue, but better to be proactive...).

Now to respond to your specific issues; TBH I'm a little confused... You note that you upgraded from Jessie to Stretch?! The current latest Odoo Appliance (v15.1) is (or at least should be) based on Stretch. As something of an aside, newer Buster based builds are well overdue, and are in the pipeline. But then you also mention upgrading from Odoo v11 to Odoo v13?! The old v14.x (Jessie based) Odoo appliance shipped with Odoo v8 IIRC (actually the Odoo updates page suggests that my memory is correct)?!

Could you please clarify those points? FWIW, you can find out what the starting appliance was by running:

turnkey-version

You can also double check the Debian version number and codename if you want like this:

lsb_release -rc

Part of my reason for asking, is that unless you already had data in Odoo (which it sounds like you don't) I would suggest that our v15.1 appliance would be a much better starting point. That already runs Odoo on python3, plus it installs Odoo via the apt repo, rather than the git source. Research and feedback suggests that that provides a cleaner update path within a Odoo major version release cycle.

I would also be inclined to suggest that removing the old Odoo would also be a preferable way to go, before installing the new one.

Regarding your error message (stacktrace) that suggests to me that there is something wrong with the config file; either a typo, or perhaps a significant change in the layout for Odoo13? Specifically the error seems to be related to the DB connection. Note the last line says 'psycopg2.OperationalError: could not translate host name "True" to address: Name or service not known'. That suggests to me that rather than getting a hostname, for some reason, it's reading the value "True". Having said that, perhaps it's a red herring and something else is going on. Perhaps post your /etc/odoo/odoo.conf file so I can have a look (also FWIW, I can't see what it looks like by default, so even with of copy of yours, it still may not be obvious unless it's compared to the default one provided by Odoo).

Nuno Bastos's picture

Just a small addition to this case, when I run the following code:

systemctl status odoo

 

I get the following result:

odoo.service - Odoo Open Source ERP and CRM
   Loaded: loaded (/lib/systemd/system/odoo.service; enabled; vendor preset: ena
   Active: failed (Result: exit-code) since Tue 2020-02-11 03:19:06 UTC; 5min ag
  Process: 450 ExecStart=/usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /v
 Main PID: 450 (code=exited, status=1/FAILURE)

Feb 11 03:19:06 odoo odoo[450]:     self._cnx = pool.borrow(dsn)
Feb 11 03:19:06 odoo odoo[450]:   File "/usr/lib/python3/dist-packages/odoo/sql_
Feb 11 03:19:06 odoo odoo[450]:     return fun(self, *args, **kwargs)
Feb 11 03:19:06 odoo odoo[450]:   File "/usr/lib/python3/dist-packages/odoo/sql_
Feb 11 03:19:06 odoo odoo[450]:     **connection_info)
Feb 11 03:19:06 odoo odoo[450]:   File "/usr/lib/python3/dist-packages/psycopg2/
Feb 11 03:19:06 odoo odoo[450]:     conn = _connect(dsn, connection_factory=conn
Feb 11 03:19:06 odoo odoo[450]: psycopg2.OperationalError: could not translate h
Feb 11 03:19:06 odoo systemd[1]: odoo.service: Main process exited, code=exited,
Feb 11 03:19:06 odoo systemd[1]: odoo.service: Failed with result 'exit-code'.

One of the things that imediately pops the eye is the "Active: Failed" status.

Nuno Bastos's picture

Hi there Jeremy! 

First of all, thank you for all the housekeeping and editing of my post. To be honest I couldn't figure out the option for including code in the editor, if you could point me out I would apreciate it a lot.


The reason I mentioned Jessie was because my "sources.list" file was pointing to it. So I did ran all the distro upgrade to Stretch (I thought it would allow me to install Python 3.6 or 3.7 from apt source which it didn't) and after that to Buster (this time to successfully install Python 3.7).

Following the command:

turnkey-version

I get the following result:

turnkey-odoo-15.1-stretch-amd64

 

While :

lsb_release -rc

gives me: 

Release:        10
Codename:       buster

My starting point, in terms of versions, was Build 15.1 with Odoo v11, which I got from this link:

Turnkey Linux - Odoo

Regarding versions and Python3 on another try (before this one), I only updated odoo from v11 to v13 by instaling it through apt install.

 

So where did I go wrong ?

Jeremy Davis's picture

In a v15.x TurnKey appliance, there should not be any mention of Jessie in any of the .list files within /etc/apt/sources.list.d/ (and TurnKey does not have a /etc/apt/sources.list file by default). v15.x is already based on Debian Stretch.

Also FWIW v15.x has Python 3.5 installed by default. But as you note to get 3.7, Buster is required (no versions of Debian have 3.6). I assume that Odoo 13 requires Py 3.6+? (That seems to be pretty common as whilst v3.5 was a good improvement on earlier Python, it misses a few important bits that didn't make it in until v3.6).

Also when you updated Odoo, did you update the /etc/apt/sources.list.d/odoo.list file to pull in v13 rather than v11, then update/install it with apt?

TBH, I've never done it, but I would expect it to work...

Although actually, Odoo can be a bit of a pain to set up and I've not tried v13 at all, so not sure about that. Also part of the reason why we often lag behind versions is that since they took all the public plugins private, the open source plugins often take a while to catch up to the newer version. It's been a while now though, so I'd imagine that they're likely ready by now?

Assuming that you did do the Odoo upgrade via apt, then was there any question regarding config? If you allowed the apt update to change the conf file, then the database connection string (including password) has probably been overwritten?!

I'm still madly working on the v16.0RC (which will be based on Buster) in the background. Once we have that out, I'll be in a much better position to dig into this a little more as we'll need to work it out ourselves anyway. Perhaps you can also assist with testing? Unfortunately I don't have an ETA, but soon I hope...

PS re your question on formatting, actually you raise a good point! I personally type in raw html and use >pre<>/pre< tags, but I just had a quick look in the WYSIWIG editor and couldn't see a code block option?! I'll add that to my backlog and have a closer look when I get a chance...

Nuno Bastos's picture

Regarding the first question, I can try to install it from scratch to check that out (maybe on another machine).

Yes Odoo v13 requires v3.6+ of Python which is the reason I was forced to upgrade the system.

Regarding odoo.list I didn't upgraded it. Instead I added to sources.list the following line:

deb https://nightly.odoo.com/13.0/nightly/deb/ ./

And then updated apt and installed odoo. Also the web interface shows me that it is on v13.

Tbh now that you've mentioned it, I recall keeping some config file the way they were and not upgrading them (I think on the distro update process, but not sure right now).

The strange thing about db connection is that, as I mentioned, if I stop odoo service (that started after booting) and then run: 

odoo -d MyDatabase

Odoo runs just fine. I can access web interface, all just like it should, except adding new addons. And talking about addons, most of the free ones are already being lauched to v13. I have reasons to believe that it may be because I call Odoo app from root account, and Odoo is not accessing the correct config file, however not 100% sure.

Another thing I think I didn't shared yet was the fact that I poked around a bit with Odoo v11. And created a webpage that after some research I (think) found out it was insrted in the postgresql database.

After a successful atempt on updating the system and odoo to v13, I then tried to import that database (which I had a backup) back to postgresql. When tried to run Odoo v13 it gave a Database error clearly stating that the present database was created with v11 thus not being compatible with v13. might be a good info for anyone trying to update versions.


I'm still madly working on the v16.0RC (which will be based on Buster) in the background. Once we have that out, I'll be in a much better position to dig into this a little more as we'll need to work it out ourselves anyway. Perhaps you can also assist with testing? Unfortunately I don't have an ETA, but soon I hope...

Of course. I'd be glad to help. Might need some hints or a little hand on it but I can assist of course.

There's been a while since I last touched html but ... always good to recap that!

Nuno Bastos's picture

So I had a few spare minutes and decided to test some things out.

First went and look on /lib/systemd/system/odoo.service file and found out that the application call command was:

/usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log

This made me think that, as I had previously stated, when running the command

odoo -d MyDatabase --config /etc/odoo/odoo.conf it would crash and give the errors posted above. 

So I thought that the problem could be caused by not having updated the odoo.config file from v11 to v13.

 


From this point, I decided to:

apt-get remove --purge odoo

and install it again from apt, ensuring that it was in fact installing v13.

While installing process was running, I wasn't prompted with anything at all (not even config related).

Checking odoo.config file I could see it was cleaned and had only the basic for startup

 

So tried to access to the mainpage and... Error 500 (Internal Server Error).

 

However running 

odoo -d MyDatabase

Wroked properly once again, bringing back the page I had previously created on odoo v13 in the first place.

 

At this point, I decided do edit /lib/systemd/system/odoo.service and added the "-d MyDatabase" to the command and starting the service makes it work properly. As I'm probably only going to use a single database It would be just fine. 

 

However this is only a trick/workaround and not a solution, so I'll keep digging the subject further. 

Next I'll try to add some addons I had previously downloaded.

Jeremy Davis's picture

IIRC in Odoo v11 the database was set via the odoo.conf file. Actually, I just double checked the install and config code we use at build time and the DB to use is set via:

db_name =

We leave it blank so that by default you land on the "Database manager" page (in v11, if you set db_name=SomeDBName then the page associated with that DB will load by default). So my guess is that that functionality has changed (FWIW, it changed radically between v8 and v11 so it wouldn't surprise me if it's changed again between v11 & v13).

IIRC Odoo v11 didn't have a /lib/systemd/system/odoo.service file and was instead relying on systemd's auto generation of a service file from the old /etc/init.d/odoo SysvInit script.

So if Odoo13 doesn't work with the conf file and the service file that the Odoo v13 package ships with then either there is some end user config required to get it to work OOTB, or it's an Odoo bug. I suggest that you see if you can find some documentation on installing/configuring Odoo v13 and I reckon that should head you in the right direction...

Finally, it's perhaps also worth noting that AFAIK the config file and the commandline switches are essentially the same thing. I.e. just different ways to give Odoo the same info. But perhaps I'm wrong and/or they've changed things in v13?

Add new comment