# Libreoffice crashing on 13.1-p2



## GoNeFast_01 (Oct 8, 2022)

Solved - libreoffice "Application Error"
					

FreeBSD-13 in VM, upgraded from FreeBSD-12.2 when starting libreoffice I see splash screen for a second and app crashes. running from terminal libreoffice generates a message: "Application Error" backtrace does not yeald any meaningful error.  Libreoffice worked at first in FreeBSD-13.  I wonder...




					forums.freebsd.org
				






> kern.elf64.aslr.honor_sbrk=0
> kern.elf64.aslr.pie_enable=1
> kern.elf64.aslr.enable=1
> nevertheless,
> kern.elf64.allow_wx=0



Very similar to the above post but I do not have any of these options enabled in my sysctl.conf file.

The libreoffice does function "sometimes" but I have to open the file manually (libreoffice  command & after opening select option file/Open ) cannot do libreoffice from recovery or it will 90% crash + along with Firefox and even some of the bhyve VM on computer....

What I can see in term
=================================

CRASH Instances= this output + CRASH.


```
qt.qpa.xcb: xcb_shm_create_segment() can't be called for size 17178820624, maximumallowed size is 4294967295
```
 = Essentially this error gets stuck and then crashes
libreoffice + firefox + some bhyve VM (not every time sometimes it crashes all and sometimes it crashes only 2/4 VM).

OR SUCCESSFUL instances opening file
gives error regardless on terminal

```
qt.qpa.xcb: xcb_shm_create_segment() can't be called for size 17178820624, maximumallowed size is 4294967295
```

+ LOADS file after 4-10 sec (pretty slow)


```
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38766, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38767, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38768, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38769, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38770, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38771, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38772, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38773, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38774, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38775, resource id: 41943117, major code: 72 (PutImage), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 38776, resource id: 41943117, major code: 72 (PutImage), minor code: 0
```

Any idea what might be causing the issue?


```
FreeBSD 13.1-RELEASE-p2 GENERIC amd64
```


----------



## _martin (Oct 8, 2022)

This issue is stemming from QT library, at least ones you shared crash information from. My first thought were maybe the shared segment size is set too low but a) you shared sysctl.conf b) library itself is setting limit on 32b int (17178820624 doesn't fit into 32b int).

I can't test this myself but some random google searches showed that setting environment variables `QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_SCALE_FACTOR=1` worked for them. You could test it from terminal first: `export QT_AUTO_SCREEN_SCALE_FACTOR=0` and `export QT_SCALE_FACTOR=1` and launch manually LibreOffice from that terminal. If it works you could put it into your provide.


----------



## GoNeFast_01 (Oct 8, 2022)

Ok... Thanks for that guide... After you mention the library I google and found some of the discussions, its this because of the screen its 4k? This started happening after upgrade to FREEBSD 13+ before on 12.2 I never had an issue with libreoffice was the old using QT4 on FREEBSD 12 version?

I will continue testing/using it & put as solve after 1 week.... THE error keeps happening from the term output though 

```
qt.qpa.xcb: xcb_shm_create_segment() can't be called for size 17178820624, maximumallowed size is 4294967295
```
BUT after the above changes its (STILL SLOW to open and some document load SUPER minimize like I can't see content = libre's window appears as a black line needs maximize to resize before seeing content) but libreoffice has not crash yet (from the 3-5+ times I've open it) even while doing recovery of files (before it will crash with recovery alone).

For future reference, the TO-DO for of us that are lazy...


```
touch Qt-changes.sh
chmod 755 Qt-changes.sh
vi Qt-changes.sh
       export QT_AUTO_SCREEN_SCALE_FACTOR=0
       export QT_SCALE_FACTOR=1
./Qt-changes.sh
```


----------



## _martin (Oct 8, 2022)

GoNeFast_01 said:


> For future reference, the TO-DO for of us that are lazy...


Beware those environment variables disappear after that script exits. To make sure those vars are set do `echo $QT_SCALE_FACTOR` from terminal just before you launch the application.
If you want to load those from file use `source ./Qt-changes.sh`.

With the OS upgrade you upgraded the packages and have QT5 (assuming that as you mentioned old qt4). It may be related to screen resolution (google thinks so) but I don't know. But as there are more application being reported with this issue is more likely something fishy in qt5.


----------



## GoNeFast_01 (Oct 8, 2022)

_martin said:


> Beware those environment variables disappear after that script exists. To make sure those vars are set do `echo $QT_SCALE_FACTOR` from terminal just before you launch the application.
> If you want to load those from file use `source ./Qt-changes.sh`.


Ok so when I use export. with above script + source...

```
export: Command not found.
export: Command not found.
```

Having said that after you mention the confirm setting via

```
echo $QT_SCALE_FACTOR $QT_AUTO_SCREEN_SCALE_FACTOR
```
It did not save...

So I went and did it via set...

```
set QT_SCALE_FACTOR=1
set QT_AUTO_SCREEN_SCALE_FACTOR=0
```


```
echo $QT_SCALE_FACTOR $QT_AUTO_SCREEN_SCALE_FACTOR
1 0
```

Having said that (THIS must be done PER screen setup/video card, as it seems that if I set only on (1) Video Card when I jump to the other screen on (2) Video Card is not save.

So I went ahead and did same procedure on (2) Video Card Screen term

```
set QT_SCALE_FACTOR=1
set QT_AUTO_SCREEN_SCALE_FACTOR=0
```


```
echo $QT_SCALE_FACTOR $QT_AUTO_SCREEN_SCALE_FACTOR
1  0
```

After I did above test I was able to open libreoffice WITH no ERROR from term.

So lastly for the lazy in us....


```
touch Qt-changes.sh
chmod 755 Qt-changes.sh
vi Qt-changes.sh
       set QT_AUTO_SCREEN_SCALE_FACTOR=0
       set QT_SCALE_FACTOR=1
source ./Qt-changes.sh
```

On every new term I need to redo it, any suggestions? rc.d script ? AND if I decide to open a second file (libreoffice File/Open/name.docx) in libreoffice it gives error (like the set didn't stay when opening second file).


----------



## _martin (Oct 8, 2022)

You can set them in your shell profile as I mentioned. Setting shell variables is, well, shell dependent. csh uses set, sh and bash use export for example. Each of these shells have their own resource files, such as csh: .cshrc, bash: .bashrc. Some shells do read ~/.profile.


----------



## GoNeFast_01 (Oct 8, 2022)

_martin said:


> You can set them in your shell profile as I mentioned. Setting shell variables is, well, shell dependent. csh uses set, sh and bash use export for example. Each of these shells have their own resource files, such as csh: .cshrc, bash: .bashrc. Some shells do read ~/.profile.


Regarding above script you're right I was using csh and based on builtin no export through that.

Regarding the ~/.cshrc I edited the setting and set up (I haven't touch that in over 4+ years )

```
set QT_AUTO_SCREEN_SCALE_FACTOR=0
set QT_SCALE_FACTOR=1
```

The settings stays now in my csh... Thanks for the guidance. Will continue libreoffice test.


----------



## GoNeFast_01 (Oct 13, 2022)

Not solve the issue persist= Still crashes but now it only happens on subsequent opens, libreoffice never shows the error above (qt.qpa.xcb: xcb_shm_create_segment() can't be called for size 17178820624, maximumallowed size is 4294967295) or crash IF opening libreoffice from term on the first document.

Any subsequent document open either via the GUI (File/Open) or through another terminal the error comes back (and have experience multiple crashes opening 2,3,4,n.... document after first one)

```
echo $QT_SCALE_FACTOR $QT_AUTO_SCREEN_SCALE_FACTOR
1 0
```

Any other suggestion on what might be the issue?


----------



## GoNeFast_01 (Nov 4, 2022)

For anyone else having issues with libreoffice (I was facing issues with DRAW along with above crashes)

Impress/Draw will not start, Generates error
-- Component cannot be loaded, possibly broken or incomplete installation.

loading component library <file:///usr/local/lib/libreoffice/program/../program/libsdlo.so> failed

Freebsd_Bugzilla

Fix was provided on the comment of the bugzilla seems like its happening with latest version.

`pkg delete libreoffice && pkg autoremove && pkg install libreoffice` <===== This worked for me
Alternative Solution to libsdlo.so error
`pkg delete libreoffice && pkg autoremove -y && make -C /usr/ports/editors/libreoffice install`
`pkg update -f`

There are solutions also with portmaster review Bugzilla

Unfortunately the crashes with

```
qt.qpa.xcb: xcb_shm_create_segment() can't be called for size 17178820624, maximumallowed size is 4294967295
```
Still happening to me even after reinstall.


----------



## Alain De Vos (Nov 4, 2022)

Using "13.1-RELEASE-p2" , liberoffice works fine.


----------

