Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck on AVAHISCAN after Docker install #921

Open
2 of 7 tasks
netExtra opened this issue Dec 27, 2024 · 11 comments
Open
2 of 7 tasks

Stuck on AVAHISCAN after Docker install #921

netExtra opened this issue Dec 27, 2024 · 11 comments
Labels
Setup 📥 These are probably setup or user environment related issues. Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress.

Comments

@netExtra
Copy link

Is there an existing issue for this?

The issue occurs in the following browsers. Select at least 2.

  • Firefox
  • Chrome
  • Edge
  • Safari (unsupported) - PRs welcome
  • N/A - This is an issue with the backend

Current Behavior

I'm using Opera and Safari, both of which have been working with NetalertX for weeks. Today I tried a new install and it's just stuck on avahiscan with applog error messages;

Expected Behavior

It works.

Steps To Reproduce

docker compose up

app.conf

No changes to default

docker-compose.yml

No changes to default

What branch are you running?

Production

app.log

11:23:15 [Plugin utils] display_name: AVAHISCAN (Name discovery)
11:23:15 [Plugins] Executing: python3 /app/front/plugins/avahi_scan/avahi_scan.py
11:23:18 [plugin_helper] reading config file
11:23:18 [AVAHISCAN] In script
11:23:18 [Database] Opening DB
11:23:18 [AVAHISCAN] Unknown devices count: 0
Traceback (most recent call last):
File "/app/front/plugins/avahi_scan/avahi_scan.py", line 212, in
main()
File "/app/front/plugins/avahi_scan/avahi_scan.py", line 91, in main
plugin_objects.write_result_file()
File "/app/front/plugins/plugin_helper.py", line 240, in write_result_file
with open(self.result_file, mode="w") as fp:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/app/log/plugins/last_result.AVAHISCAN.log'

11:23:18 [Plugins] ⚠ ERROR - enable LOG_LEVEL=debug and check logs

Debug enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
@netExtra netExtra added the bug 🐛 Something isn't working label Dec 27, 2024
@jokob-sk
Copy link
Owner

jokob-sk commented Dec 27, 2024 via email

@netExtra
Copy link
Author

netExtra commented Dec 27, 2024

Hi, It could be a permission issue. If you have the /app/log folder mapped, try to remove it to test if that works. Try checking these docs as well https://github.com/jokob-sk/NetAlertX/blob/main/docs/FILE_PERMISSIONS.md Hope this helps, J

It works without volumes so it is a permissions issue but I'm not sure why. I've installed this on my Pi micro SD card many times and it works. Now I'm installing it on a freshly formatted external SSD card and it doesn't.
I tried this:
getent group www-data
www-data:x:33:netextra

sudo groupadd -g 82 www-data
groupadd: group 'www-data' already exists

@jokob-sk jokob-sk added Setup 📥 These are probably setup or user environment related issues. and removed bug 🐛 Something isn't working labels Dec 27, 2024
@jokob-sk
Copy link
Owner

Hi @netExtra ,

Glad to hear it is working without mapping the /app/log location, at least we know it is setup related.

I'm not a permissions wizard so I'd try to grant everyone a+rwx and see if that works. Then I would try to slowly remove permissions.

You can also try to SSH into the container and inspect permissions in there, they might not be mapped as expected.

Please report back and I can update the guide with more details.

Hope this helps,
j

@jokob-sk jokob-sk added the Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress. label Dec 27, 2024
@syerad
Copy link

syerad commented Dec 28, 2024

I'm encountering the same issue for some reason. When I run it directly through Docker, it works, but it doesn’t function with Docker Compose even if I remove all the volumes.

     container_name: netalertx
    # use the below line if you want to test the latest dev image
    # image: "jokobsk/netalertx-dev:latest"
    image: "jokobsk/netalertx:latest"
    network_mode: "host"
    restart: unless-stopped
    environment:
      - TZ=Europe/Berlin
      - PORT=20211

@jokob-sk
Copy link
Owner

Hi @syerad ,

I just tried spinning up a fresh container with this compose file and it seems to come up without issues:

services:
  netalertx_prod:
    container_name: netalertx_prod
    image: "jokobsk/netalertx:latest"
    network_mode: "host"
#    volumes:
#      - ${APP_DATA_LOCATION}/netalertx_prod/config:/app/config
#      - ${APP_DATA_LOCATION}/netalertx_prod/db:/app/db
    environment:
      - TZ=Europe/Berlin
      - PORT=22224
      - APP_CONF_OVERRIDE={"SCAN_SUBNETS":"['192.168.1.0/24 --interface=eth1']","GRAPHQL_PORT":"20225"}

I only specify APP_CONF_OVERRIDE since my port for the GRAPHQL server 20212 is already used

  1. Even the message is the same, could you please post the whole error message you are getting?
  2. Also, try to delete the container (including temp volumes), image and re-create the container in case the virtual volumes are acting up.
  3. Can you post the command you use to spinning up the container?

Thanks,
j

@akorb90
Copy link

akorb90 commented Dec 29, 2024

Same problem here.

Fresh Debian 12 VM, Deployed using docker compose with portainer.

Stack:

services:
  netalertx:
    container_name: netalertx
    # use the below line if you want to test the latest dev image
    # image: "jokobsk/netalertx-dev:latest" 
    image: "jokobsk/netalertx:latest"      
    network_mode: "host"        
    restart: unless-stopped
    volumes:
      - ${APP_DATA_LOCATION}/config:/app/config
      - ${APP_DATA_LOCATION}/db/:/app/db/      
      # (optional) useful for debugging if you have issues setting up the container
      - ${APP_DATA_LOCATION}/logs:/app/log
    environment:
      - TZ=${TZ}      
      - PORT=${PORT

Env:

APP_DATA_LOCATION=/opt/netalertx
TZ=Europe/Berlin
PORT=20211

@syerad
Copy link

syerad commented Dec 29, 2024

Hi @syerad ,

I just tried spinning up a fresh container with this compose file and it seems to come up without issues:

services:
  netalertx_prod:
    container_name: netalertx_prod
    image: "jokobsk/netalertx:latest"
    network_mode: "host"
#    volumes:
#      - ${APP_DATA_LOCATION}/netalertx_prod/config:/app/config
#      - ${APP_DATA_LOCATION}/netalertx_prod/db:/app/db
    environment:
      - TZ=Europe/Berlin
      - PORT=22224
      - APP_CONF_OVERRIDE={"SCAN_SUBNETS":"['192.168.1.0/24 --interface=eth1']","GRAPHQL_PORT":"20225"}

I only specify APP_CONF_OVERRIDE since my port for the GRAPHQL server 20212 is already used

  1. Even the message is the same, could you please post the whole error message you are getting?
  2. Also, try to delete the container (including temp volumes), image and re-create the container in case the virtual volumes are acting up.
  3. Can you post the command you use to spinning up the container?

Thanks,
j

Thanks @jokob-sk ! I tried the same and it seems to work now. I guess the volumes were acting up. In the next step I'll try re-attach the volumes one by one. Pretty sure it's a permission issue but not yet sure how to resolve it.

Thanks again for your support!

@jokob-sk
Copy link
Owner

@syerad - thanks for the info!

@akorb90 , can you try the following:

  1. Backup your setup as per: https://github.com/jokob-sk/NetAlertX/blob/main/docs/BACKUPS.md
  2. Delete the container (including temp volumes), and image
  3. Re-create the container
  4. Can you post the command you use to spinning up the container?
  5. If above doesn't work, can you try commenting out: #- ${APP_DATA_LOCATION}/logs:/app/log

@ingoratsdorf
Copy link
Contributor

The issue is here:
FileNotFoundError: [Errno 2] No such file or directory: '/app/log/plugins/last_result.AVAHISCAN.log'
This happened to me as well with MQTT and other plugins.

Looks like the container is not creating the /app/log/plugins folder.
This is my workaround:

  • plugins_vol:/app/log/plugins
name: netalertx

services:

  netalertx:
    container_name: netalertx
    # use the below line if you want to test the latest dev image
    # image: "jokobsk/netalertx-dev:latest"
    image: jokobsk/netalertx:latest
    network_mode: "host"
    restart: unless-stopped
    privileged: true
    volumes:
      - /opt/netalertx/config:/app/config
      - /opt/netalertx/db:/app/db
      - log_vol:/app/log # use tmpfs
      **- plugins_vol:/app/log/plugins # use tmpfs**
      - api_vol:/app/api # use tmpfs

    environment:
      - TZ=Pacific/Auckland
      - PORT=20211
volumes:
  api_vol:
    driver_opts:
      type: tmpfs
      device: tmpfs
  log_vol:
    driver_opts:
      type: tmpfs
      device: tmpfs
  plugins_vol:
    driver_opts:
      type: tmpfs
      device: tmpfs

@jokob-sk
Copy link
Owner

jokob-sk commented Jan 2, 2025

Hi @ingoratsdorf ,

I just checked a fresh installation and the folders seem to be created fine:

image

Here's my compose:

version: "3"
services:
  netalertx_fresh:
    container_name: netalertx_fresh
    image: "jokobsk/netalertx-dev"
    network_mode: "host"
    volumes:
      - ${APP_DATA_LOCATION}/netalertx_fresh/config:/app/config
      - ${APP_DATA_LOCATION}/netalertx_fresh/db:/app/db
    environment:
      - TZ=Australia/Sydney
      - HOST_USER_ID=1036
      - HOST_USER_GID=1000
      - PORT=22222
      - ALWAYS_FRESH_INSTALL=true
      - APP_CONF_OVERRIDE={"SCAN_SUBNETS":"['192.168.1.0/24 --interface=eth1']","GRAPHQL_PORT":"20223","UI_theme":"Light"} 

@netExtra
Copy link
Author

netExtra commented Jan 3, 2025

Hi @ingoratsdorf ,

I just checked a fresh installation and the folders seem to be created fine:

image

Here's my compose:

version: "3"
services:
  netalertx_fresh:
    container_name: netalertx_fresh
    image: "jokobsk/netalertx-dev"
    network_mode: "host"
    volumes:
      - ${APP_DATA_LOCATION}/netalertx_fresh/config:/app/config
      - ${APP_DATA_LOCATION}/netalertx_fresh/db:/app/db
    environment:
      - TZ=Australia/Sydney
      - HOST_USER_ID=1036
      - HOST_USER_GID=1000
      - PORT=22222
      - ALWAYS_FRESH_INSTALL=true
      - APP_CONF_OVERRIDE={"SCAN_SUBNETS":"['192.168.1.0/24 --interface=eth1']","GRAPHQL_PORT":"20223","UI_theme":"Light"} 

Maybe so. But @ingoratsdorf has the exact same error message I was receiving so I will try his solution. I'm sure it is a file permissions issue that is happening because I am using an external SSD and not the main internal SSD card in my Rasberry Pi. I just don't understand why this app has this permissions problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Setup 📥 These are probably setup or user environment related issues. Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress.
Projects
None yet
Development

No branches or pull requests

5 participants