Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#956804: tomcat9: No way to set CATALINA_OPTS as catalina.sh environment variable

312 views
Skip to first unread message

Radosław Józwik

unread,
Apr 15, 2020, 8:40:03 AM4/15/20
to
Package: tomcat9
Version: 9.0.16-4
Severity: normal

Dear Maintainer,

there is no way to set CATALINA_OPTS environment variable to be used by catalina.sh
startup script. As described in catalina.sh source:

# CATALINA_OPTS (Optional) Java runtime options used when the "start",
# "run" or "debug" command is executed.

It is working in tomcat8 package from Debian 9 by setting CATALINA_OPTS
in /etc/default/tomcat8.


-- System Information:
Debian Release: 10.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-8-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages tomcat9 depends on:
ii lsb-base 10.2019051400
ii systemd 241-7~deb10u3
ii tomcat9-common 9.0.16-4
ii ucf 3.0038+nmu1

Versions of packages tomcat9 recommends:
ii libtcnative-1 1.2.21-1

Versions of packages tomcat9 suggests:
pn tomcat9-admin <none>
pn tomcat9-docs <none>
pn tomcat9-examples <none>
pn tomcat9-user <none>

-- Configuration Files:
/etc/cron.daily/tomcat9 changed [not included]

-- no debconf information

Emmanuel Bourg

unread,
Nov 23, 2020, 8:30:03 PM11/23/20
to
Le 2020-04-15 14:35, Radosław Józwik a écrit :

> there is no way to set CATALINA_OPTS environment variable to be used
> by catalina.sh
> startup script. As described in catalina.sh source:
>
> # CATALINA_OPTS (Optional) Java runtime options used when the
> "start",
> # "run" or "debug" command is executed.
>
> It is working in tomcat8 package from Debian 9 by setting CATALINA_OPTS
> in /etc/default/tomcat8.

Hi Radosław, you should use JAVA_OPTS instead of CATALINA_OPTS in
/etc/default/tomcat9 as documented in the file. I don't think
CATALINA_OPTS has ever been intended to be supported in
/etc/default/tomcat<n>.

Emmanuel Bourg

Radosław Józwik

unread,
Nov 25, 2020, 5:30:03 PM11/25/20
to
> Hi Radosław, you should use JAVA_OPTS instead of CATALINA_OPTS in
> /etc/default/tomcat9 as documented in the file. I don't think
> CATALINA_OPTS has ever been intended to be supported in
> /etc/default/tomcat<n>.

Hello,

I'm already using JAVA_OPTS as a workaround, but I thought CATALINA_OPTS
should be supported as it is in Tomcat8 package. Nevertheless if
JAVA_OPTS should be used then I will migrate completely and this bug
report can be closed.

Regards,
Radosław

Valerio Bozzolan

unread,
Feb 21, 2023, 8:50:04 AM2/21/23
to
Reading this discussion, I see that at the moment there is not any
official way to declare and expose an environment variable to
"catalina.sh".

I mean, for example, if you need to define this env:
(note, it's not a system property):

MY_CUSTOM_APPLICATION_SECRET=123

In short, this is the current situation of this package AFAIK:

1.
Any extra "Environment=FOO=BAR" variable set from systemd is ignored.
(Also if you force that with PassEnvironment=FOO)
Feature? Probably yes.

2.
Any extra environent variable set from /etc/default/tomcat9 is NOT
exposed to "bin/catalina.sh".
Feature? Probably yes.

[MOST IMPORTANT POINT]
3.
The supposed path to declare an extra env variable should be
"bin/setenv.sh", but, this is in a read-only location as per FHS and so
it's NOT supposed to be customized.
Feature? Probably NO.

If I'm correct:

It would probably make sense to discuss the issue n. 3.

For example, allowing a file such as "setenv.sh" to be created in an
officially writable location would probably make sense.

--
Valerio Bozz.


E-mail sent from Evolution from a random GNU/Linux distribution,
delivered from my Postfix mailserver.

Have fun with software freedom!

Valerio Bozzolan

unread,
Feb 21, 2023, 9:10:05 AM2/21/23
to
I just want to mention that, I don't see ANY way at all to expose any
custom environment variable to the Tomcat process itself.

Feature? Unsure.

AFAIK If you push an environment variable inside your catalina.sh, (for
example via the previously mentioned setenv.sh), that variable just die
in catalina.sh and - it seems to me - it is never exposed to the
Tomcat's Bootstrap process.

I'd just be curious if what I'm saying makes sense.
0 new messages