unoconv / unoserver

MIT License
496 stars 69 forks source link

Unoserver ran once and don't restart #18

Closed classifaddict closed 8 months ago

classifaddict commented 2 years ago

Hello, I succeed running unoserver/unoconverter once and then I never been able to start the server again after rebooting the machine:

$ sudo unoserver --daemon --executable /usr/lib/libreoffice/program/soffice.bin INFO:unoserver:Starting unoserver. INFO:unoserver:Command: /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore -env:UserInstallation=file:///tmp/tmpznzt5utn --accept=socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext <subprocess.Popen object at 0x7fd1c8c1ad60>

$ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 8940 160 ? Ssl 08:04 0:00 /init root 9 0.0 0.0 8948 140 tty1 Ss 08:04 0:00 /init olivier 10 0.0 0.0 18228 2772 tty1 S 08:04 0:00 -bash root 76 0.0 0.0 8948 140 tty2 Ss 08:06 0:00 /init olivier 77 0.0 0.0 18480 3324 tty2 S 08:06 0:01 -bash olivier 805 0.0 0.0 18664 1888 tty2 R 10:45 0:00 ps aux

$ unoconvert --convert-to pdf test.fodt test.pdf INFO:unoserver:Starting unoconverter. Traceback (most recent call last): File "/usr/local/bin/unoconvert", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/unoserver/converter.py", line 231, in main converter = UnoConverter(args.interface, args.port) File "/usr/local/lib/python3.8/dist-packages/unoserver/converter.py", line 74, in init self.context = self.resolver.resolve( unoserver.converter.NoConnectException: Connector : couldn't connect to socket (Connection refused) /build/libreoffice-crGbO6/libreoffice-7.3.0~rc3/io/source/connector/connector.cxx:117

This happened in both Ubuntu 20.04.3 WSL and Virtualbox.

Is there anything that could prevent unoserver from restarting?

Thanks for this tools and your help!

regebro commented 2 years ago

Try without --daemon and see what happens. Maybe it crashes?

classifaddict commented 2 years ago

$ sudo unoserver --executable /usr/lib/libreoffice/program/soffice.bin [sudo] password for olivier: INFO:unoserver:Starting unoserver. INFO:unoserver:Command: /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore -env:UserInstallation=file:///tmp/tmp8ip81ibp --accept=socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext $

Is there a log file somewhere?

regebro commented 2 years ago

No, Libreoffice is very bad at logging. As a last attempt, try just running libreoffice. It seems it doesn't start properly.

classifaddict commented 2 years ago

unoconvert is OK if I run this command in a separate shell: /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocrashreport --nodefault --nologo --nofirststartwizard --norestore -env:UserInstallation=file:///tmp/tmp8ip81ibp --accept="socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext"

regebro commented 2 years ago

Since that is literally all Unoserver does, I can't explain that.

classifaddict commented 2 years ago

Weird! I will let you know if I find an explanation. Thanks.

unbranched commented 1 year ago

Had the same problem, solved by doing:

$ unoserver --daemon --executable /usr/lib/libreoffice/program/soffice

Please note it's not soffice.bin, and please don't start it with sudo!

Then unoconvert worked. Tested in a python virtual env.

regebro commented 1 year ago

Normally unoserver just calls libreoffice, but unless you have a broken install somewhere, that would be /usr/lib/libreoffice, which is a symlink to /usr/lib/libreoffice/program/soffice, so I'm curious to why --executable /usr/lib/libreoffice/program/soffice would make a difference.

unbranched commented 1 year ago

Normally unoserver just calls libreoffice, but unless you have a broken install somewhere, that would be /usr/lib/libreoffice, which is a symlink to /usr/lib/libreoffice/program/soffice, so I'm curious to why --executable /usr/lib/libreoffice/program/soffice would make a difference.

Yes it works too without specifying the executable. I specified that in case the OP needs it.

regebro commented 1 year ago

True, they specified soffice.bin, I'll try to remember that if somebody else has this issue to see if that makes a difference.