nakla / sbfspot

Scripts for building and running the docker container
18 stars 10 forks source link

/etc/sbfspot is not mapped to a directory outside the container => Config file can't be read. #15

Closed ago74 closed 1 year ago

ago74 commented 1 year ago

Hi, I just can't get the docker container to work.

I keep getting the error message "/etc/sbfspot is not mapped to a directory outside the container => Config file can't be read. Please map the directory and restart the container.". I have already set the user, folder and file permissions (uid 5000, gid 5000). But the volume mappings don't seem to be working.

sbfspot:
    container_name: sbfspot
    image: nakla/sbfspot:latest
    network_mode: host
    volumes:
        - /opt/sbfspot:/etc/sbfspot
        - /opt/sbfspot/data:/var/sbfspot
    environment:
        TZ: Europe/Berlin
        ENABLE_SBFSPOT: 1
        SBFSPOT_INTERVAL: 600
        ENABLE_SBFSPOT_UPLOAD: 0
        DB_STORAGE: sqlite
        CSV_STORAGE: 1
        MQTT_ENABLE: 0
        QUIET: 0
        SBFSPOT_ARGS: -d0 -v2
        INIT_DB: 0
    restart: always

I don't know what to do and need help please.

nakla commented 1 year ago

With these two commands, you create the directories and permissions.

sudo mkdir -p /opt/sbfspot/data sudo chown -R 5000:5000 /opt/sbfspot

...just to be sure, that there is no problem with the mapped directories.

ago74 commented 1 year ago

Hi, Thank you for your quick response. I did exactly that and recreated the directories, but unfortunately it still doesn't work.

After starting the container, the files "SBFspot.default.cfg" and "SBFspotUpload.default.cfg" are written in the directory. The error message remains. I have now set up the cfg file based on the default file, but unfortunately without success... I entered the following values ​​in the cfg file:

BTAddress=00:80:25:25:36:72
Password=<<password>>
MIS_Enabled=0
OutputPath=/var/sbfspot/%Y
OutputPathEvents=/var/sbfspot/%Y/Events
Latitude=50.80
Longitude=6.12
CalculateMissingSpotValues=1
DateTimeFormat=%d/%m/%Y %H:%M:%S
DateFormat=%d/%m/%Y
DecimalPoint=comma
TimeFormat=%H:%M:%S
SynchTime=1
SynchTimeLow=1
SynchTimeHigh=3600
SunRSOffset=900
Locale=de-DE
Timezone=Europe/Berlin
BTConnectRetries=10
CSV_Export=1
CSV_ExtendedHeader=1
CSV_Header=1
CSV_SaveZeroPower=1
CSV_Delimiter=semicolon
CSV_Spot_TimeSource=Inverter
SQL_Database=/var/sbfspot/SBFspot.db

All other lines are comments.

Many thanks for the assistance.

nakla commented 1 year ago

Ok can you post the output of the command ls -l /opt/sbfspot on your sbfspot host?

ago74 commented 1 year ago

Hi,

Ok, here is the output:

drwxr-xr-x 2 sbfspot sbfspot 4096 24. Sep 15:08 data
-rw-rw-rw- 1 sbfspot sbfspot 9590 26. Sep 14:49 SBFspot.cfg
-rw-rw-rw- 1 sbfspot sbfspot 9860 26. Sep 10:15 SBFspot.default.cfg
-rw-rw-rw- 1 sbfspot sbfspot 1888 27. Sep 18:26 SBFspotUpload.cfg
-rw-rw-rw- 1 sbfspot sbfspot 1892 24. Sep 15:20 SBFspotUpload.default.cfg

The whole thing is currently running via virtual box and a Dietpi image (host). Later the Docker images are to run on a Raspberry Pi 4. I have already looked whether Linux packages may be missing and Dos2unix installed. But I still get the same error message.

Thanks a lot!

ago74 commented 1 year ago

Hi,

btw...

id -u sbfspot  
5000
id -g sbfspot 
5000
nakla commented 1 year ago

This should be fine. The error message is triggered by start.sh in line 78 ifmount | grep -q -e "$confdir "; then Can you post the output of the mount command in the container?

ago74 commented 1 year ago

Hm, I can't get a terminal in Portainer. I get the error message:

Failure
Container ce1...c3a is restarting, wait until the container is running

To find out whether it is due to the VirtualBox environment, I have now also tested the image on the Raspberry Pi (dietpi). I get the same error message here too.

nakla commented 1 year ago

Because of the error with the config, the container exits. If you have set up the restart policy "until stopped" your container restarts infinitely.

nakla commented 1 year ago

Which dietpi image do you use? armv6,v7,v8? You can try to explicitly load the v6 image, which should be compatible with all rpi.

ago74 commented 1 year ago

I use the image "armv8". But it's not a problem. I will test the "arm 6" image at the weekend and report back. Thanks very much!

nakla commented 1 year ago

I just installed dietpi for arch armv8 on a rpi zero 2 w. First time, I got the same error message, after connecting to the container and checking the cause, everything was ok without changing something. So I went back and reinstalled dietpi, this time I got no error, and everyting was working instantly. So I don't have any hint for you, as this doesn't seem to be an issue with the sbfspot image.

ago74 commented 1 year ago

I have now reinstalled Dietpi (ARMV6 version 8.9.2) and started the image again. Unfortunately, the error still appears. I will now look for a different way because this is too time -consuming for me. Thank you for the help.