Skip to content

Alleged permission issue regarding logfile (readonly) #283

Open

Description

@passibe15

Describe the bug
Starting a container with image tag 4-bullseye and env variables FHEM_UID and FHEM_GID set to a non-default value, FHEM gives the following error message:
Messages collected while initializing FHEM:configfile: logfile is readonly, it is set in the FHEM_GLOBALATTR environment

However, the logfile is writeable without any problems. Also, all permissions get set correctly (i.e. entry.sh is doing its job correctly).

To Reproduce
Steps to reproduce the behavior:

  1. Set FHEM_UID and FHEM_GID to some non-default value
  2. Start container
  3. Observe reading init_errors in device global
  4. Observe logfile and notice it is being written to despite the error message
  5. Change to 3-bullseye and observe that error message vanishes

Expected behavior
No error message

Additional context
Another user reported that they also get an error message for the PID file. This first occurred after switching from 3-bullseye to 4-bullseye.
See here (also see following forum posts for additional context).

Also, I am not sure if this is an issue within fhem.pl or with the container environment, however, given that the issue was not present in 3-bullseye I am assuming it is an issue with the code in this repo, rather than FHEM itself.

For the sake of completeness, here is the content of /proc/$PID/environ:
SHELL=/bin/bashFHEM_GLOBALATTR=nofork=0 updateInBackground=1 logfile=log/fhem-%Y-%m-%d.log pidfilename=log/fhem.pidHOSTNAME=ha_fhemtestLANGUAGE=en_US:enPERL_JSON_BACKEND=Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPPLC_ADDRESS=de_DE.UTF-8LC_NAME=de_DE.UTF-8LC_MONETARY=de_DE.UTF-8UMASK=0037PWD=/opt/fhemLOGNAME=fhemTZ=Europe/BerlinLOGFILE=/opt/fhem/log/fhem-%Y-%m-%d.logHOME=/opt/fhemFHEM_UID=7073LANG=en_US.UTF-8LC_PAPER=de_DE.UTF-8PERL5LIB=/usr/src/app/core/lib/perl5:/usr/src/app/3rdparty/lib/perl5GPIO_GID=6002FHEM_GID=7067TERM=xtermUSER=fhemCONFIGTYPE=fhem.cfgDOCKER_GW=172.21.0.1I2C_GID=6003TIMEOUT=10SHLVL=1LC_TELEPHONE=de_DE.UTF-8LC_MESSAGES=en_DK.UTF-8LC_MEASUREMENT=de_DE.UTF-8FHEM_PERM_FILE=0640LC_TIME=de_DE.UTF-8DOCKER_HOST=172.21.0.1PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binTELNETPORT=7072DOCKER_HOSTNETWORK=0MAIL=/var/mail/fhemFHEM_PERM_DIR=0750BLUETOOTH_GID=6001LC_NUMERIC=de_DE.UTF-8DOCKER_PRIVILEGED=1OLDPWD=/opt/fhem_=/usr/local/bin/perlroot

Activity

  1. no-Legend commented on Dec 9, 2024

    @no-Legend

    Same Problem with my Installation.
    Changed the Version from 3 to 4 bullseye yesterday evening.
    Reported the error also at the FHEM forum

    also get an error. Essbare for the pidfile

  2. sidey79 commented on Dec 9, 2024

    @sidey79
    Contributor

    I don't think that this is an error, its more like some information
    https://github.com/fhem/fhem-mirror/blob/cfaeb4e68c0699bbefefffe767b79e4f94c23439/fhem/fhem.pl#L2938

    Because if a attribute is defined via an environment variable you can't overwrite it from the fhem itself, it must be changed via the environment variable which is controlled by the container.

  3. passibe15 commented on Dec 9, 2024

    @passibe15
    ContributorAuthor

    Oh. So "readonly" means that the attribute logfile is readonly? Not the logfile itself? Ok. Maybe that message should be clarified then (but not an issue for this repo, of course).

    But that still doesn't explain why this only happens when UID/GID is changed to non-default …

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions