I did not have this problem with 18.04 and previous LibreOffice. But I'm having it now with Ubuntu 20.04 and LibreOffice 6.4.
After a bit of research I found out it is a permission problem. In Ubuntu 20.04, apps, including LibreOffice, do not have read access to the folder /tmp where applications (such as Firefox) put temporary files. By the way, you get the same problem if you try to open directly any file from web with its assigned application, directly in Firefox, without downloading it first (e.g. try to open in Firefox a web-stored .deb file with Software Installer).
One way to sort this is to download first the files and, only then, open them. But this is annoying.
Another way, it is to reassign the temporary directory in the /home/user/ directory. This has the advantage of lessening the space requirement on the / directory while still not compromising the security.
The temporary directory is governed by the TMPDIR environment setting. I used the solution proposed here by TrueDuality.
- Check where is your current temporary directory:
echo $TMPDIR
or
mktemp -u
It should something look like: /tmp/tmp.zrBHbp0Yt0
- Edit the file /etc/profile
sudo gedit /etc/profile
- Append the following code:
if [[ -O /home/$USER/tmp && -d /home/$USER/tmp ]]; then
TMPDIR=/home/$USER/tmp
else
# You may wish to remove this line, it is there in case
# a user has put a file 'tmp' in there directory or a
rm -rf /home/$USER/tmp 2> /dev/null
mkdir -p /home/$USER/tmp
TMPDIR=$(mktemp -d /home/$USER/tmp/XXXX)
fi
TMP=$TMPDIR
TEMP=$TMPDIR
export TMPDIR TMP TEMP
reboot
check if your temporary directory has been reassigned to your /home/user/ directory
echo $TMPDIR
This time, the return should be something like: /home/user/tmp/nrXo , showing that the temp directory has been reassigned.
Remarks:
- at this point the problem should be solved and you should be able to do things such as open directly a file from Firefox (instead of downloading it first). The file will be opened in read-only mode.
- ONLY IF the last step (5) confirms that the temp directory is now reassigned correctly, you can worry about the new /tmp file growing up endlessly. In order to correct this problem, we need to make sure that at the end of the session, the file is deleted. However, if the previous step was not completed properly, you log-in with root credentials and you proceed to the next step,this can create problems.
CAREFUL!
sudo gedit ~/.bash_logout
add the following lines:
if [ -O $TMPDIR && -d $TMPDIR ]; then
rm -rf $TMPDIR/*
fi
save. close and reboot.