#1095729 libreoffice vs kmail vs apparmor - apparmor misconfigured so prevent LO from sending emails #1095729
- Package:
- libreoffice-common
- Source:
- libreoffice-common
- Submitter:
- Date:
- 2025-04-17 17:00:02 UTC
- Severity:
- normal
- Tags:
Basically LO can't send emails because apparmor blocks it. This is a total PITA. I have zero interaction with AA except for this problem which reinstates itself randomly after updates so fixing it each time is a maximal waste of time. I've no real idea which package is responsible but it is this file that causes the pain: usr.lib.libreoffice.program.senddoc and that belongs to libreoffice-common It might be that libreoffice-plasma or libreoffice-kf5 should "fix" it but I don't know. I'm sure this has been reported many times before but the random medley of old bug reports relating to similar problems in very confusing.
tag 1095729 + unreproducible
tag 1095729 + moreinfo
thanks
Hi,
sorry for the late answer.
Since I did some other apparmor stuff lately for LO I just remembered this (still some time to get a fix in if needed) had a look and I think it's just a misconfiguration/configuration changes in LO without being aware of the consequences.
We don't allow random stuff in senddoc. That is intended.
What exactly is blocked? apparmor log, please? I am guessing you try to access kmail directly?
Shouldn't.
So for this actual issue:
1. default config as mailer is "sensible-lomua". "sensible-lomua" is not an actual command but handled in senddoc (cf. )
+case `basename "$MAILER"` in
+ sensible-lomua)
+ if [ -x /usr/bin/xdg-email ] ; then
+ MAILER=/usr/bin/xdg-email
+ elif [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kde-open ] \
+ || [ -x /usr/bin/gnome-open ] \
+ || [ -x /usr/bin/xdg-open ]; then
+ # use an undefined mailer, to trigger the default handling
+ MAILER=undefined
+ elif [ -n "$GNOME_DESKTOP_SESSION_ID" -a -x /usr/bin/evolution ]; then
+ MAILER=/usr/bin/evolution
+ elif [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kmail ]; then
+ MAILER=/usr/bin/kmail
+ elif [ -x /usr/bin/evolution ]; then
+ # default
+ MAILER=/usr/bin/evolution
+ elif [ -x /usr/bin/icedove ]; then
+ # fallback
+ MAILER=/usr/bin/icedove
+ elif [ -x /usr/bin/thunderbird ]; then
+ # fallback
+ MAILER=/usr/bin/thunderbird
+ fi
+ ;;
+esac
As we see if /usr/bin/xdg-email exists xdg-email is invoked. Do you have xdg-email installed?
$ dpkg -S /usr/bin/xdg-email
xdg-utils: /usr/bin/xdg-email
And that invokes stuff just fine:
$ xdg-email
<open evolutiono for me (probably because I never set my default mailer in GNOME to thunderbird)>
$ export MAILER=kmail; xdg-email
/usr/bin/xdg-email: 1: eval: kmail: not found
<would open kmail if I had it installed>
here it's probably unfortunate that both times it's MAILER, which confuses even me which one is taken where. Also something
prevented by either using sensible-lomua or xdg-email directly.
For senddoc, this is allowed:
profile libreoffice-senddoc /usr/lib/libreoffice/program/senddoc {
[...]
/usr/bin/xdg-open rPUx,
/usr/bin/xdg-email rPUx,
[...]
}
just tried it, LO send document as email -> evolution -> send works.
And evolution is - as kmail - not in the above allow list either.
2. if you configured someting else than sensible-lomua this indeed is not allowed, but you should use sensible-lomua and your KDE config (and/or set the MAILER environment variable, as I did above) and this probably works.
As said above, if you set "kmail" manually and don't use sensible-lomua/xdg-email machinery but get the pieces and need to allow kmail.
BTW:
All that tried on 25.2.2 on testing but stable definitely also has that sensible-lomua patch and the senddoc profile didn't change either.
Regards,
Rene
P.S: It's not helpful using gmail here since it silenly discards valid mail...
tag 1095729 + unreproducible
tag 1095729 + moreinfo
thanks
Hi,
sorry for the late answer.
Since I did some other apparmor stuff lately for LO I just remembered this (still some time to get a fix in if needed) had a look and I think it's just a misconfiguration/configuration changes in LO without being aware of the consequences.
We don't allow random stuff in senddoc. That is intended.
What exactly is blocked? apparmor log, please? I am guessing you try to access kmail directly?
Shouldn't.
So for this actual issue:
1. default config as mailer is "sensible-lomua". "sensible-lomua" is not an actual command but handled in senddoc (cf. )
+case `basename "$MAILER"` in
+ sensible-lomua)
+ if [ -x /usr/bin/xdg-email ] ; then
+ MAILER=/usr/bin/xdg-email
+ elif [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kde-open ] \
+ || [ -x /usr/bin/gnome-open ] \
+ || [ -x /usr/bin/xdg-open ]; then
+ # use an undefined mailer, to trigger the default handling
+ MAILER=undefined
+ elif [ -n "$GNOME_DESKTOP_SESSION_ID" -a -x /usr/bin/evolution ]; then
+ MAILER=/usr/bin/evolution
+ elif [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kmail ]; then
+ MAILER=/usr/bin/kmail
+ elif [ -x /usr/bin/evolution ]; then
+ # default
+ MAILER=/usr/bin/evolution
+ elif [ -x /usr/bin/icedove ]; then
+ # fallback
+ MAILER=/usr/bin/icedove
+ elif [ -x /usr/bin/thunderbird ]; then
+ # fallback
+ MAILER=/usr/bin/thunderbird
+ fi
+ ;;
+esac
As we see if /usr/bin/xdg-email exists xdg-email is invoked. Do you have xdg-email installed?
$ dpkg -S /usr/bin/xdg-email
xdg-utils: /usr/bin/xdg-email
And that invokes stuff just fine:
$ xdg-email
<open evolutiono for me (probably because I never set my default mailer in GNOME to thunderbird)>
$ export MAILER=kmail; xdg-email
/usr/bin/xdg-email: 1: eval: kmail: not found
<would open kmail if I had it installed>
here it's probably unfortunate that both times it's MAILER, which confuses even me which one is taken where. Also something
prevented by either using sensible-lomua or xdg-email directly.
For senddoc, this is allowed:
profile libreoffice-senddoc /usr/lib/libreoffice/program/senddoc {
[...]
/usr/bin/xdg-open rPUx,
/usr/bin/xdg-email rPUx,
[...]
}
just tried it, LO send document as email -> evolution -> send works.
And evolution is - as kmail - not in the above allow list either.
2. if you configured someting else than sensible-lomua this indeed is not allowed, but you should use sensible-lomua and your KDE config (and/or set the MAILER environment variable, as I did above) and this probably works.
As said above, if you set "kmail" manually and don't use sensible-lomua/xdg-email machinery but get the pieces and need to allow kmail.
BTW:
All that tried on 25.2.2 on testing but stable definitely also has that sensible-lomua patch and the senddoc profile didn't change either.
Regards,
Rene
P.S: It's not helpful using gmail here since it silenly discards valid mail...
Hi, Am 17.04.25 um 18:02 schrieb Rene Engelhard: Thankfully xdg-email (also) does desktop detection and does read the stuff out of KDEs config in open_kde(), so would work given xdg-email is allowed. Did you set kmail there? So that all boils down to: What happens if you tried to use sensible-lomua/xdg-email? Regards, Rene
Hi, Am 17.04.25 um 18:02 schrieb Rene Engelhard: Thankfully xdg-email (also) does desktop detection and does read the stuff out of KDEs config in open_kde(), so would work given xdg-email is allowed. Did you set kmail there? So that all boils down to: What happens if you tried to use sensible-lomua/xdg-email? Regards, Rene