Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Error/Bug
  4. Amazon Dash Adapter spinnt sich aus

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    2.2k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    946

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.2k

Amazon Dash Adapter spinnt sich aus

Scheduled Pinned Locked Moved Error/Bug
25 Posts 13 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deifel
    wrote on last edited by
    #21

    Hallo zusammen,

    ich habe leider nach wie vor Probleme, den Dash-Adapter ans Laufen zu bekommen.

    Nachdem alles funktioniert hatte und ich einen Neustart vom System machen musste (Debian), spinnt Libcap bei mir.

    Der Befehl:

    sudo setcap 'cap_net_raw,cap_net_admin+eip' $(readlink -f $(which node))

    bringt

    :sudo: setcap: Befehl nicht gefunden

    Egal ob mit oder ohne sudo.

    Libcap ist allerdings installiert.

    Remove klappt allerdings auch nicht:

    Abhängigkeitsbaum wird aufgebaut.

    Statusinformationen werden eingelesen…. Fertig

    Paket »libcap-dev« ist nicht installiert, wird also auch nicht entfernt.

    0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

    Er sagt, es ist nicht installiert...

    Wenn ich installieren möchte, erscheint:

    libpcap-dev ist schon die neueste Version (1.8.1-3).

    0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

    Kann mir jemand sagen, wie ich das Teil richtig entfernen kann oder mit welchem Befehl ich die Rechte wieder richtig setze?

    Ausfgabe dpkg ist:

    root@IOBrokerhost:~# dpkg -L libpcap0.8

    /.

    /usr

    /usr/lib

    /usr/lib/x86_64-linux-gnu

    /usr/lib/x86_64-linux-gnu/libpcap.so.1.8.1

    /usr/share

    /usr/share/doc

    /usr/share/doc/libpcap0.8

    /usr/share/doc/libpcap0.8/CREDITS.gz

    /usr/share/doc/libpcap0.8/README

    /usr/share/doc/libpcap0.8/README.Debian

    /usr/share/doc/libpcap0.8/changelog.Debian.gz

    /usr/share/doc/libpcap0.8/changelog.gz

    /usr/share/doc/libpcap0.8/copyright

    /usr/share/man

    /usr/share/man/man7

    /usr/share/man/man7/pcap-filter.7.gz

    /usr/lib/x86_64-linux-gnu/libpcap.so.0.8

    Vielen Dank im Voraus

    1 Reply Last reply
    0
    • D Offline
      D Offline
      deifel
      wrote on last edited by
      #22

      @denjo:

      @msiemers:

      @Stabilostick:

      Um zu prüfen, ob das pcap Module korrekt funktioniert, kann die im Module mitgelieferte Bespieldatei „network_grep.js“ über die Kommandozeile ausgeführt werden. Diese Datei befindet sich z. B. im Ordner „node_modules“ unter pcap/examples/network_grep.js

      Beispiel Befehl:

      node /opt/iobroker/node_modules/pcap/examples/network_grep.js
      

      Hier sollte dann folgender Fehler NICHT mehr auftreten:

      /opt/iobroker/node_modules/pcap/pcap.js:49
              this.link_type = this.session.open_live(this.device_name, this.filter, this.buffer_size, this.outfile, packet_ready, this.is_monitor);
       
      Error: socket: Operation not permitted
          at new PcapSession (/opt/iobroker/node_modules/pcap/pcap.js:49:39)
          at Object.exports.createSession (/opt/iobroker/node_modules/pcap/pcap.js:123:12)
          at Object. <anonymous>(/opt/iobroker/node_modules/pcap/examples/network_grep.js:2:25)
          at Module._compile (module.js:571:32)
          at Object.Module._extensions..js (module.js:580:10)
          at Module.load (module.js:488:32)
          at tryModuleLoad (module.js:447:12)
          at Function.Module._load (module.js:439:3)
          at Module.runMain (module.js:605:10)
          at run (bootstrap_node.js:427:7)</anonymous>
      ````"
      
      Vollquote von [https://www.blogging-it.com/node-pcap-m … odejs.html](https://www.blogging-it.com/node-pcap-module-error-socket-operation-not-permitted-fehler-wenn-pcapsession-geoeffnet-wird/programmierung/javascript/nodejs.html)
      
      Danke, Markus. `  
      

      Was macht man denn wenn nach dem Befehl immer noch folgender Fehler kommt?

      TypeError: Cannot read property 'ip' of undefined
          at PcapSession. <anonymous>(/opt/iobroker/node_modules/pcap/examples/network_grep.js:9:28)
          at emitOne (events.js:116:13)
          at PcapSession.emit (events.js:211:7)
          at PcapSession.on_packet_ready (/opt/iobroker/node_modules/pcap/pcap.js:99:10)
          at packet_ready (/opt/iobroker/node_modules/pcap/pcap.js:44:14)
          at SocketWatcher.pcap_read_callback [as callback] (/opt/iobroker/node_modules/pcap/pcap.js:64:45)
      root@iobroker:/opt/iobroker#</anonymous> 
      

      Ich habe das gleiche Problem wie mein Vorredner. `

      schon eine lösung gefunden??? `

      Habe es (wenn auch evtl. nur vorübergehend) geschafft, den Dash-Adapter zum "Leben" zu erwecken.

      Dazu haben ich

      apt-get install libcap2-bin

      installiert und danach den Befehl:

      setcap 'cap_net_raw,cap_net_admin+eip' $(readlink -f $(which node))

      ausgeführt. Adapter neu starten - dann sollte er wieder laufen. Habe aber noch keine Neustart getestet…

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rebe09
        wrote on last edited by
        #23

        Hallo.

        Ich bekomme bei install Versuch folgende Fehlermeldung(en)

        ! $ ./iobroker add amazon-dash –host octopi
        ! npm install iobroker.amazon-dash --production --prefix "/root" (System call)
        ! npm
        ! WARN addRemoteGit Error: Command failed: git config --get remote.origin.urlnpm WARN addRemoteGit
        ! npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:199:12)
        ! npm WARN addRemoteGit at emitTwo (events.js:106:13)
        ! npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)
        ! npm WARN addRemoteGit at maybeClose (internal/child_process.js:920:16)
        ! npm WARN addRemoteGit at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
        ! npm WARN addRemoteGit git+https://github.com/bytzdev/node-socketwatcher.git resetting remote /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02de because of error: { Error: Command failed: git config --get remote.origin.url
        ! npm WARN addRemoteGit
        ! npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:199:12)
        ! npm WARN addRemoteGit at emitTwo (events.js:106:13)
        ! npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)
        ! npm WARN addRemoteGit at maybeClose (internal/child_process.js:920:16)
        ! npm WARN addRemoteGit at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
        ! npm WARN addRemoteGit killed: false,
        ! npm WARN addRemoteGit code: 1,
        ! npm WARN addRemoteGit signal: null,
        ! npm WARN addRemoteGit cmd: 'git config --get remote.origin.url' }
        ! npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/bytzdev/node-socketwatcher.git /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02de: Please run git without sudo, your regular user account is enough :)
        ! npm ERR! Linux 4.9.35-v7+npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "iobroker.amazon-dash" "--production" "--prefix" "/root"
        ! npm
        ! ERR! node v6.13.0
        ! npm ERR! npm v3.10.10
        ! npm ERR! code 1
        ! npm
        ! ERR! Command failed: git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/bytzdev/node-socketwatcher.git /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02denpm ERR!
        ! npm ERR!
        ! npm ERR! If you need help, you may report this error at:
        ! npm ERR! <https://github.com/npm/npm/issues>
        ! npm
        ! ERR! Please include the following file with any support request:npm ERR!
        ! /npm-debug.log
        ! host.octopi install adapter amazon-dash
        ! npm install iobroker.amazon-dash --production --prefix "/root" (System call)
        ! npm
        ! WARN addRemoteGit Error: Command failed: git config --get remote.origin.urlnpm WARN addRemoteGit
        ! npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:199:12)
        ! npm WARN addRemoteGit at emitTwo (events.js:106:13)
        ! npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)
        ! npm WARN addRemoteGit at maybeClose (internal/child_process.js:920:16)
        ! npm WARN addRemoteGit
        ! at Socket. <anonymous>(internal/child_process.js:351:11)npm WARN addRemoteGit at emitOne (events.js:96:13)
        ! npm WARN addRemoteGit at Socket.emit (events.js:188:7)
        ! npm WARN addRemoteGit at Pipe._handle.close [as _onclose] (net.js:509:12)
        ! npm WARN addRemoteGit git+https://github.com/bytzdev/node-socketwatcher.git resetting remote /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02de because of error: { Error: Command failed: git config –get remote.origin.url
        ! npm WARN addRemoteGit
        ! npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:199:12)
        ! npm WARN addRemoteGit at emitTwo (events.js:106:13)
        ! npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)
        ! npm WARN addRemoteGit at maybeClose (internal/child_process.js:920:16)
        ! npm WARN addRemoteGit at Socket. <anonymous>(internal/child_process.js:351:11)
        ! npm WARN addRemoteGit at emitOne (events.js:96:13)
        ! npm WARN addRemoteGit at Socket.emit (events.js:188:7)
        ! npm
        ! WARN addRemoteGit at Pipe._handle.close [as _onclose] (net.js:509:12)npm WARN addRemoteGit killed: false,
        ! npm
        ! WARN
        ! addRemoteGit
        ! code: 1,npm WARN addRemoteGit signal: null,
        ! npm WARN addRemoteGit cmd: 'git config –get remote.origin.url' }
        ! npm
        ! ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/bytzdev/node-socketwatcher.git /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02de: Please run git without sudo, your regular user account is enough :)
        ! npm
        ! ERR! Linux 4.9.35-v7+npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "iobroker.amazon-dash" "--production" "--prefix" "/root"
        ! npm ERR! node v6.13.0
        ! npm ERR! npm v3.10.10
        ! npm ERR! code 1
        ! npm
        ! ERR! Command failed: git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/bytzdev/node-socketwatcher.git /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02denpm ERR!
        ! npm ERR!
        ! npm ERR! If you need help, you may report this error at:
        ! npm ERR! <https://github.com/npm/npm/issues>
        ! npm ERR! Please include the following file with any support request:npm ERR! /npm-debug.log
        ! host.octopi install adapter amazon-dash
        ! npm install iobroker.amazon-dash --production --prefix "/root" (System call)
        ! npm
        ! WARN addRemoteGit Error: Command failed: git config --get remote.origin.url
        ! npm WARN addRemoteGit npm WARN addRemoteGit at ChildProcess.exithandler (child_process.js:199:12)
        ! npm WARN addRemoteGit at emitTwo (events.js:106:13)
        ! npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)
        ! npm WARN addRemoteGit at maybeClose (internal/child_process.js:920:16)
        ! npm WARN addRemoteGit at Socket. <anonymous>(internal/child_process.js:351:11)
        ! npm WARN addRemoteGit at emitOne (events.js:96:13)
        ! npm WARN addRemoteGit at Socket.emit (events.js:188:7)
        ! npm WARN addRemoteGit at Pipe._handle.close [as _onclose] (net.js:509:12)
        ! npm WARN addRemoteGit git+https://github.com/bytzdev/node-socketwatcher.git resetting remote /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02de because of error: { Error: Command failed: git config –get remote.origin.url
        ! npm WARN addRemoteGit
        ! npm WARN addRemoteGit
        ! at ChildProcess.exithandler (child_process.js:199:12)npm WARN addRemoteGit at emitTwo (events.js:106:13)
        ! npm WARN addRemoteGit at ChildProcess.emit (events.js:191:7)
        ! npm WARN addRemoteGit at maybeClose (internal/child_process.js:920:16)
        ! npm
        ! WARN
        ! addRemoteGit at Socket. <anonymous>(internal/child_process.js:351:11)npm WARN addRemoteGit at emitOne (events.js:96:13)
        ! npm WARN addRemoteGit at Socket.emit (events.js:188:7)
        ! npm WARN addRemoteGit at Pipe._handle.close [as _onclose] (net.js:509:12)
        ! npm WARN addRemoteGit killed: false,
        ! npm WARN addRemoteGit
        ! code: 1,
        ! npm
        ! WARN addRemoteGit signal: null,npm WARN addRemoteGit cmd: 'git config –get remote.origin.url' }
        ! npm
        ! ERR!
        ! git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/bytzdev/node-socketwatcher.git /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02de:
        ! Please run git without sudo, your regular user account is enough :)
        ! npm
        ! ERR! Linux 4.9.35-v7+npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "iobroker.amazon-dash" "--production" "--prefix" "/root"
        ! npm ERR! node v6.13.0
        ! npm ERR! npm v3.10.10npm ERR! code 1
        ! npm ERR! Command failed: git clone --template=/root/.npm/_git-remotes/_templates --mirror https://github.com/bytzdev/node-socketwatcher.git /root/.npm/_git-remotes/git-https-github-com-bytzdev-node-socketwatcher-git-e2de02denpm ERR!
        ! npm ERR!
        ! npm ERR! If you need help, you may report this error at:
        ! npm ERR! <https://github.com/npm/npm/issues>
        ! npm ERR! Please include the following file with any support request:npm ERR! /npm-debug.log
        ! host.octopi install adapter amazon-dash
        ! ERROR: host.octopi Cannot install amazon-dash
        ! ERROR: process exited with code 13</anonymous></anonymous></anonymous></anonymous>

        weiss jemand was zu tun ist und sagt es mir auch?

        Vielen Dank!!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rebe09
          wrote on last edited by
          #24

          Hallo nochmals.

          Ich habe nun nochmals versucht auf einem andern Raspberry iobroker neu aufzusetzen und anschließend den Amazon Adapter zu installieren.

          Das klappt leider auch nicht.

          folgender Output:

          ! $ ./iobroker add amazon-dash –host raspberrypi
          ! NPM version: 6.4.1
          ! npm install iobroker.amazon-dash --production --save --prefix "/opt/iobroker" (System call)
          ! WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
          ! E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
          ! ../socket_watcher.cpp: In static member function ‘static void SocketWatcher::Callback(uv_poll_t*, int, int)’:../socket_watcher.cpp:77:60: warning: ‘v8::Local v8::valueNan::MakeCallback(v8::Localv8::object, v8::Localv8::function, int, v8::Localv8::value*)’ is deprecated [-Wdeprecated-declarations]
          ! Nan::MakeCallback(watcher->handle(), callback, argc, argv);
          ! ^
          ! In file included from ../socket_watcher.hpp:8:0, from ../socket_watcher.cpp:5:
          ! ../../nan/nan.h:959:46: note: declared here
          ! NAN_DEPRECATED inline v8::Local v8::valueMakeCallback(
          ! ^~~~~~~~~~~~</v8::value></v8::value></v8::function></v8::object></v8::value>

          1 Reply Last reply
          0
          • StabilostickS Stabilostick

            "Für unixartige Betriebssysteme stellt die Bibliothek „libpcap“ (packet capture library) Funktionen zur Verfügung, um den Datenverkehr, welcher über die Netzwerkschnittstellen läuft, mitzuschneiden und zu analysieren. Das JavaScript Modul „pcap“ stellt die entsprechenden Bindungen (engl. Bindings) für diese Bibliothek zur Verfügung. Diese können dann mit Node.js verwendet werden.

            <size size="150">Problem</size>

            Diese Bibliothek wird gerne in Node.js Modulen, wie z. B. dem Amazon Dashbutton Adapter für ioBroker, verwendet.

            Da die libpcap Bibliothek auf Funktionen des Betriebssystems zugreift, kann es zu folgender Fehlermeldung kommen, wenn der Code ausgeführt wird.

            Error: socket: Operation not permitted
            

            Der Benutzer, durch den der Code ausgeführt wurde, besitzt anscheinend nicht die notwendigen Rechte.

            Am Beispiel des Amazon Dashbutton Adapters, würde dann folgende Fehlermeldung im Log auftauchen.

            error   at Adapter. (/opt/iobroker/node_modules/iobroker.amazon-dash/main.js:50:29)
            error   at Object.exports.createSession (/opt/iobroker/node_modules/iobroker.amazon-dash/node_modules/pcap/pcap.js:123:12)
            error   at new PcapSession (/opt/iobroker/node_modules/iobroker.amazon-dash/node_modules/pcap/pcap.js:49:39)
            error   Error: socket: Operation not permitted
            error   uncaught exception: socket: Operation not permitted
            

            <size size="150">Lösung</size>

            Um das Problem zu lösen, müssen die Dateisystem „Capabilities“ für das Programm „node“ angepasst werden. Dies kann durch das Kommandozeilen-Tool „setcap“ erreicht werden.

            Hierzu muss folgender Befehl in der Kommandozeile ausgeführt werden.

            sudo setcap 'cap_net_raw,cap_net_admin+eip' $(readlink -f $(which node))
            

            Mit dem Tool „getcap“ kann geprüft werden, ob alles korrekt gesetzt wurde. Hierzu muss folgender Befehl in der Kommandozeile ausgeführt werden.

            sudo getcap $(readlink -f $(which node))
            

            Dies Ausgabe sollte dann z. B. so aussehen:

            /usr/bin/nodejs = cap_net_admin,cap_net_raw+eip
            

            Hier noch eine kurze Erklärung aus der Dokumentation:

            ` > In many distributions you can use the 'setcap' utility to add capabilities to individual files.

            CAP_NET_RAW:

            Allow use of RAW and PACKET sockets.

            CAP_NET_ADMIN:

            Allow various network-related operations (e.g. setting privileged socket options, enabling multicasting, setting promiscuous mode, interface configuration, modifying routing tables).

            The “+eip” means you’re adding the file capability sets Effective, Inherited and Permitted.

            Each thread has three capability sets containing zero or more of the above capabilities:

            The three file capability sets are:

            e: Effective - The capabilities used by the kernel to perform permission checks for the thread.

            i: Inherited - The capabilities preserved across an execve(2). A child created via fork(2) inherits copies of its parent's capability sets. See below for a discussion of the treatment of capabilities during exec(). Using capset(2), a thread may manipulate its own capability sets, or, if it has the CAP_SETPCAP capability, those of a thread in another process.

            p: Permitted - The capabilities that the thread may assume (i.e., a limiting superset for the effective and inheritable sets). If a thread drops a capability from its permitted set, it can never re-acquire that capability (unless it exec()s a set-user-ID-root program). `

            Um zu prüfen, ob das pcap Module korrekt funktioniert, kann die im Module mitgelieferte Bespieldatei „network_grep.js“ über die Kommandozeile ausgeführt werden. Diese Datei befindet sich z. B. im Ordner „node_modules“ unter pcap/examples/network_grep.js

            Beispiel Befehl:

            node /opt/iobroker/node_modules/pcap/examples/network_grep.js
            

            Hier sollte dann folgender Fehler NICHT mehr auftreten:

            /opt/iobroker/node_modules/pcap/pcap.js:49
                    this.link_type = this.session.open_live(this.device_name, this.filter, this.buffer_size, this.outfile, packet_ready, this.is_monitor);
            
            Error: socket: Operation not permitted
                at new PcapSession (/opt/iobroker/node_modules/pcap/pcap.js:49:39)
                at Object.exports.createSession (/opt/iobroker/node_modules/pcap/pcap.js:123:12)
                at Object. <anonymous>(/opt/iobroker/node_modules/pcap/examples/network_grep.js:2:25)
                at Module._compile (module.js:571:32)
                at Object.Module._extensions..js (module.js:580:10)
                at Module.load (module.js:488:32)
                at tryModuleLoad (module.js:447:12)
                at Function.Module._load (module.js:439:3)
                at Module.runMain (module.js:605:10)
                at run (bootstrap_node.js:427:7)</anonymous>
            ````"
            
            Vollquote von [https://www.blogging-it.com/node-pcap-m … odejs.html](https://www.blogging-it.com/node-pcap-module-error-socket-operation-not-permitted-fehler-wenn-pcapsession-geoeffnet-wird/programmierung/javascript/nodejs.html)
            
            Danke, Markus.
            F Offline
            F Offline
            FabianM
            wrote on last edited by
            #25

            @Stabilostick said in Amazon Dash Adapter spinnt sich aus:

            "Für unixartige Betriebssysteme stellt die Bibliothek „libpcap“ (packet capture library) Funktionen zur Verfügung, um den Datenverkehr, welcher über die Netzwerkschnittstellen läuft, mitzuschneiden und zu analysieren. Das JavaScript Modul „pcap“ stellt die entsprechenden Bindungen (engl. Bindings) für diese Bibliothek zur Verfügung. Diese können dann mit Node.js verwendet werden.

            <size size="150">Problem</size>

            Diese Bibliothek wird gerne in Node.js Modulen, wie z. B. dem Amazon Dashbutton Adapter für ioBroker, verwendet.

            Da die libpcap Bibliothek auf Funktionen des Betriebssystems zugreift, kann es zu folgender Fehlermeldung kommen, wenn der Code ausgeführt wird.

            Error: socket: Operation not permitted
            

            Der Benutzer, durch den der Code ausgeführt wurde, besitzt anscheinend nicht die notwendigen Rechte.

            Am Beispiel des Amazon Dashbutton Adapters, würde dann folgende Fehlermeldung im Log auftauchen.

            error   at Adapter. (/opt/iobroker/node_modules/iobroker.amazon-dash/main.js:50:29)
            error   at Object.exports.createSession (/opt/iobroker/node_modules/iobroker.amazon-dash/node_modules/pcap/pcap.js:123:12)
            error   at new PcapSession (/opt/iobroker/node_modules/iobroker.amazon-dash/node_modules/pcap/pcap.js:49:39)
            error   Error: socket: Operation not permitted
            error   uncaught exception: socket: Operation not permitted
            

            <size size="150">Lösung</size>

            Um das Problem zu lösen, müssen die Dateisystem „Capabilities“ für das Programm „node“ angepasst werden. Dies kann durch das Kommandozeilen-Tool „setcap“ erreicht werden.

            Hierzu muss folgender Befehl in der Kommandozeile ausgeführt werden.

            sudo setcap 'cap_net_raw,cap_net_admin+eip' $(readlink -f $(which node))
            

            Mit dem Tool „getcap“ kann geprüft werden, ob alles korrekt gesetzt wurde. Hierzu muss folgender Befehl in der Kommandozeile ausgeführt werden.

            sudo getcap $(readlink -f $(which node))
            

            Dies Ausgabe sollte dann z. B. so aussehen:

            /usr/bin/nodejs = cap_net_admin,cap_net_raw+eip
            

            Hier noch eine kurze Erklärung aus der Dokumentation:

            ` > In many distributions you can use the 'setcap' utility to add capabilities to individual files.

            CAP_NET_RAW:

            Allow use of RAW and PACKET sockets.

            CAP_NET_ADMIN:

            Allow various network-related operations (e.g. setting privileged socket options, enabling multicasting, setting promiscuous mode, interface configuration, modifying routing tables).

            The “+eip” means you’re adding the file capability sets Effective, Inherited and Permitted.

            Each thread has three capability sets containing zero or more of the above capabilities:

            The three file capability sets are:

            e: Effective - The capabilities used by the kernel to perform permission checks for the thread.

            i: Inherited - The capabilities preserved across an execve(2). A child created via fork(2) inherits copies of its parent's capability sets. See below for a discussion of the treatment of capabilities during exec(). Using capset(2), a thread may manipulate its own capability sets, or, if it has the CAP_SETPCAP capability, those of a thread in another process.

            p: Permitted - The capabilities that the thread may assume (i.e., a limiting superset for the effective and inheritable sets). If a thread drops a capability from its permitted set, it can never re-acquire that capability (unless it exec()s a set-user-ID-root program). `

            Um zu prüfen, ob das pcap Module korrekt funktioniert, kann die im Module mitgelieferte Bespieldatei „network_grep.js“ über die Kommandozeile ausgeführt werden. Diese Datei befindet sich z. B. im Ordner „node_modules“ unter pcap/examples/network_grep.js

            Beispiel Befehl:

            node /opt/iobroker/node_modules/pcap/examples/network_grep.js
            

            Hier sollte dann folgender Fehler NICHT mehr auftreten:

            /opt/iobroker/node_modules/pcap/pcap.js:49
                    this.link_type = this.session.open_live(this.device_name, this.filter, this.buffer_size, this.outfile, packet_ready, this.is_monitor);
            
            Error: socket: Operation not permitted
                at new PcapSession (/opt/iobroker/node_modules/pcap/pcap.js:49:39)
                at Object.exports.createSession (/opt/iobroker/node_modules/pcap/pcap.js:123:12)
                at Object. <anonymous>(/opt/iobroker/node_modules/pcap/examples/network_grep.js:2:25)
                at Module._compile (module.js:571:32)
                at Object.Module._extensions..js (module.js:580:10)
                at Module.load (module.js:488:32)
                at tryModuleLoad (module.js:447:12)
                at Function.Module._load (module.js:439:3)
                at Module.runMain (module.js:605:10)
                at run (bootstrap_node.js:427:7)</anonymous>
            ````"
            
            Vollquote von [https://www.blogging-it.com/node-pcap-m … odejs.html](https://www.blogging-it.com/node-pcap-module-error-socket-operation-not-permitted-fehler-wenn-pcapsession-geoeffnet-wird/programmierung/javascript/nodejs.html)
            
            Danke, Markus.
            

            Vielen Dank, das hat bei mir geholfen!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            Support us

            ioBroker
            Community Adapters
            Donate

            660

            Online

            32.6k

            Users

            82.2k

            Topics

            1.3m

            Posts
            Community
            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
            ioBroker Community 2014-2025
            logo
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Home
            • Recent
            • Tags
            • Unread 0
            • Categories
            • Unreplied
            • Popular
            • GitHub
            • Docu
            • Hilfe