PIR Motion Sensor triggers every hour - sensors

I have Onyehn PIR Motion Sensor connected to a Raspberry Pi Zero, which detects motion when it actually happens. However, it also detects motion every hour, even when it is sealed in a box. Is there anyway to determine root cause or to stop this?
The RPi is running Raspbian GNU/Linux 10 (buster).
The script uses Python 2.7.16
The python script is:
# all the pre-requisite modules are imported, globals defined and defs work ... not included
MOTION_PIN = 17
GPIO.setup(MOTION_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.add_event_detect(MOTION_PIN, GPIO.RISING)
def motionTextCallback():
sendTextMessage('motion detected') # sends text message to my cellphone number
while True:
time.sleep(3600) # I checked this timer to see if it was triggering motion sensor
Running the following command shows the following occuring just as the Motion Sensor is triggered hh:21:40 on every hour. To me this seems to indicate something in HRNG is triggering the motion sensor.
Any ideas?
Thanks.
Jeff
$ sudo journalctl | grep ":21"
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: bits received from HRNG source: 380064
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: bits sent to kernel pool: 334336
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: entropy added to kernel pool: 334336
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2 successes: 19
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2 failures: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2(2001-10-10) Monobit: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2(2001-10-10) Poker: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2(2001-10-10) Runs: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2(2001-10-10) Long run: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS 140-2(2001-10-10) Continuous run: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: HRNG source speed: (min=74.852; avg=338.275; max=801.282)Kibits/s
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: FIPS tests speed: (min=5.936; avg=6.198; max=6.231)Mibits/s
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: Lowest ready-buffers level: 2
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: Entropy starvations: 0
Sep 26 23:21:40 rpiDoorbell rngd[290]: stats: Time spent starving for entropy: (min=0; avg=0.000; max=0)us

I have found that my PIR sensor also triggers every 1 hour (+ 0.5 / + 0.9 seconds).
I use a Raspberry Pi and have idea what causes this.
I have implemented a filter mechanism that logs each 'lone' trigger and if there was one 3600.5 / 3600.9 seconds ago. If so, this trigger is ignored. This makes that I can trigger on the first of a sequence of triggers and still filter these phantom triggers.
Complex, but is works!

Related

running background tasks through dramatic does not work

I'm trying to run background task processing, redis and rabbitMQ work in separate docker containers
#dramatiq.actor(store_results=True)
def count_words(url):
try:
response = requests.get(url)
count = len(response.text.split(" "))
print(f"There are {count} words at {url!r}.")
except requests.exceptions.MissingSchema:
print(f"Message dropped due to invalid url: {url!r}")
result_backend = RedisBackend(host="172.17.0.2", port=6379)
result_broker = RabbitmqBroker(host="172.17.0.5", port=5672)
result_broker.add_middleware(Results(backend=result_backend))
dramatiq.set_broker(result_broker)
message = count_words.send('https://github.com/Bogdanp/dramatiq')
print(message.get_result(block=True))
RabbitMQ:
{"queue_name":"default","actor_name":"count_words","args":["https://github.com/Bogdanp/dramatiq"],"kwargs":{},"options":{},"message_id":"8e10b6ef-dfef-47dc-9f28-c6e07493efe4","message_timestamp":1608877514655}
Redis
1:C 22 Dec 2020 13:38:15.415 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 22 Dec 2020 13:38:15.417 * Running mode=standalone, port=6379.
1:M 22 Dec 2020 13:38:15.417 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 22 Dec 2020 13:38:15.417 # Server initialized
1:M 22 Dec 2020 13:38:15.417 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
1:M 22 Dec 2020 13:38:15.417 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').
1:M 25 Dec 2020 10:08:12.274 * Background saving terminated with success
1:M 26 Dec 2020 19:23:59.445 * 1 changes in 3600 seconds. Saving...
1:M 26 Dec 2020 19:23:59.660 * Background saving started by pid 24
24:C 26 Dec 2020 19:23:59.890 * DB saved on disk
24:C 26 Dec 2020 19:23:59.905 * RDB: 4 MB of memory used by copy-on-write
1:M 26 Dec 2020 19:23:59.961 * Background saving terminated with success
Error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/dramatiq/message.py", line 147, in get_result
return backend.get_result(self, block=block, timeout=timeout)
File "/usr/local/lib/python3.6/dist-packages/dramatiq/results/backends/redis.py", line 81, in get_result
raise ResultTimeout(message)
dramatiq.results.errors.ResultTimeout: count_words('https://github.com/Bogdanp/dramatiq')

Python3 time.sleep() behaving erratically

L.S,
i am trying to learn python(3) and am baffled by the behavior of time.sleep()
i run raspbian buster on a rpi3b.
#!/usr/bin/python3
import bluetooth
import sys
import time
_shuttermac ="11:22:33:44:5D:6A"
while True:
# check if the device is switched on by mac address lookup
print("Checking " + time.strftime("%a, %d %b %Y %H:%M:%S - ", time.gmtime()),end ="")
result = bluetooth.lookup_name(_shuttermac, timeout=5)
#print(result)
if (result != None):
print("Device detected by bluetooth mac lookup")
else:
print("Device with MAC " + _shuttermac + " NOT detected")
time.sleep(1) # check every 5 secs if device comes online
sys.exit()
output
Checking Thu, 25 Jun 2020 11:21:02 - Device with MAC 11:22:33:44:5D:6A NOT detected
Checking Thu, 25 Jun 2020 11:21:08 - Device with MAC 11:22:33:44:5D:6A NOT detected
Checking Thu, 25 Jun 2020 11:21:14 - Device with MAC 11:22:33:44:5D:6A NOT detected
Checking Thu, 25 Jun 2020 11:21:20 - Device with MAC 11:22:33:44:5D:6A NOT detected
Checking Thu, 25 Jun 2020 11:21:26 - Device with MAC 11:22:33:44:5D:6A NOT detected
as you can see, the output statement is 6 seconds apart, not 1 as coded
where did i go wrong?
The six second interval comes because each loop of while True does two time-consuming things when the lookup fails:
bluetooth.lookup_name(_shuttermac, timeout=5) has a 5 second timeout. If it is found quickly, it should complete faster
time.sleep(1) pauses the whole Python program for 1 second
You could shorten the timeout on bluetooth.lookup_name and the sleep() duration. This may have unintended consequences in the accuracy of the lookup (I'm not very familiar with it).

Kamene causing python3 segmentation fault

I have a basic python3 script for running a ping sweep using kamene with two main issues. I'm not sure if they are related so I'll add them both in the same post.
Where in here is the main issue and what have I done wrong?
First issue...
When I import IP and ICMP from kamena.all I have an error as below...
No name 'IP' in module 'kamene.all'pylint(no-name-in-module)
No name 'ICMP' in module 'kamene.all'pylint(no-name-in-module)
Second issue...
When I run the program, I get an IPv6 error and then a segmentation fault with a warning from OSX to say that python has stopped.
python3 pingsweep.py
WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6
Segmentation fault: 11
This is my script code...
from kamene.all import sr1,IP,ICMP
for ip in range(1, 8):
packet = IP(dst="192.168.0." + str(ip), ttl=20) / ICMP()
reply = sr1(packet, timeout=2)
if not (reply is None):
print(reply.dst)
I have installed kamene with...
pip3 install kamene
Lastly, the crash report from OSX...
Process: Python [13831]
Path: /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 3.7.1 (3.7.1)
Code Type: X86-64 (Native)
Parent Process: bash [10827]
Responsible: Python [13831]
User ID: 501
Date/Time: 2019-03-29 15:45:33.205 +0000
OS Version: Mac OS X 10.14.4 (18E226)
Report Version: 12
Anonymous UUID: D6F17B07-49F0-ACAE-B5D6-25ABF231369D
Sleep/Wake UUID: AAE0878E-9596-4A63-BAD9-7146B5F303F5
Time Awake Since Boot: 28000 seconds
Time Since Wake: 16000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000014
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [13831]
VM Regions Near 0x14:
-->
__TEXT 000000010197b000-000000010197c000 [ 4K] r-x/rwx SM=COW /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libpcap.A.dylib 0x00007fff72b9041f pcap_get_selectable_fd + 4
1 _ctypes.cpython-37m-darwin.so 0x00000001027001d7 ffi_call_unix64 + 79
2 _ctypes.cpython-37m-darwin.so 0x0000000102700a38 ffi_call + 872
3 _ctypes.cpython-37m-darwin.so 0x00000001026fb9fb _ctypes_callproc + 891
4 _ctypes.cpython-37m-darwin.so 0x00000001026f5af0 PyCFuncPtr_call + 1040
5 org.python.python 0x00000001019a08b1 _PyObject_FastCallKeywords + 433
6 org.python.python 0x0000000101a602f4 call_function + 420
7 org.python.python 0x0000000101a5d4a7 _PyEval_EvalFrameDefault + 25351
8 org.python.python 0x00000001019a0ed0 function_code_fastcall + 128
9 org.python.python 0x0000000101a60432 call_function + 738
10 org.python.python 0x0000000101a5d3ec _PyEval_EvalFrameDefault + 25164
11 org.python.python 0x0000000101a60f56 _PyEval_EvalCodeWithName + 2422
12 org.python.python 0x00000001019a063b _PyFunction_FastCallDict + 523
13 org.python.python 0x00000001019a190f _PyObject_Call_Prepend + 143
14 org.python.python 0x00000001019efe91 slot_tp_init + 145
15 org.python.python 0x00000001019eb7e9 type_call + 297
16 org.python.python 0x00000001019a08b1 _PyObject_FastCallKeywords + 433
17 org.python.python 0x0000000101a602f4 call_function + 420
18 org.python.python 0x0000000101a5d54d _PyEval_EvalFrameDefault + 25517
19 org.python.python 0x0000000101a60f56 _PyEval_EvalCodeWithName + 2422
20 org.python.python 0x00000001019a0a61 _PyFunction_FastCallKeywords + 257
21 org.python.python 0x0000000101a60432 call_function + 738
22 org.python.python 0x0000000101a5d54d _PyEval_EvalFrameDefault + 25517
23 org.python.python 0x0000000101a60f56 _PyEval_EvalCodeWithName + 2422
24 org.python.python 0x0000000101a570c4 PyEval_EvalCode + 100
25 org.python.python 0x0000000101a94591 PyRun_FileExFlags + 209
26 org.python.python 0x0000000101a93e0a PyRun_SimpleFileExFlags + 890
27 org.python.python 0x0000000101ab219b pymain_main + 6827
28 org.python.python 0x0000000101ab26ea _Py_UnixMain + 58
29 libdyld.dylib 0x00007fff73c1b3d5 start + 1
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x00007ffeee283290 rcx: 0x00000001019a0373 rdx: 0x00007ffeee283110
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x00007ffeee283160 rsp: 0x00007ffeee283160
r8: 0x00007ffeee283110 r9: 0x00000001019a01e8 r10: 0x00007ffeee2830c0 r11: 0x00007fff72b9041b
r12: 0x00007ffeee2830c0 r13: 0x0000000000000001 r14: 0x0000000102700a60 r15: 0x00007fffa6c14070
rip: 0x00007fff72b9041f rfl: 0x0000000000010246 cr2: 0x0000000000000014
Logical CPU: 0
Error Code: 0x00000004
Trap Number: 14
Binary Images:
0x10197b000 - 0x10197bfff +org.python.python (3.7.1 - 3.7.1) <4B030EC4-815E-34B7-90E7-D0720C31E072> /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
0x10197f000 - 0x101b57fff +org.python.python (3.7.1, [c] 2001-2018 Python Software Foundation. - 3.7.1) <977C0919-F108-3AC9-8796-F42032694A62> /Library/Frameworks/Python.framework/Versions/3.7/Python
0x101f25000 - 0x101f2eff7 +_socket.cpython-37m-darwin.so (0) <0BA1CC79-DBFC-332D-9DEE-7A81A6654023> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_socket.cpython-37m-darwin.so
0x101f7b000 - 0x101f7cfff +_heapq.cpython-37m-darwin.so (0) <E8B35F18-1B5A-3C9E-B1F4-0BE0432459A2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_heapq.cpython-37m-darwin.so
0x101f80000 - 0x101f84fff +math.cpython-37m-darwin.so (0) <E18B0A65-B44F-3F1D-96A8-C29A7F794019> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so
0x101f8b000 - 0x101f8dfff +select.cpython-37m-darwin.so (0) <869F8AE3-73B4-35C4-82CA-3D954FD00F78> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/select.cpython-37m-darwin.so
0x1021e6000 - 0x1021e8ff7 +_hashlib.cpython-37m-darwin.so (0) <13B96FDE-C671-3396-B89D-2ACB4F56A05B> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_hashlib.cpython-37m-darwin.so
0x1021ed000 - 0x10222eff7 +libssl.1.1.dylib (0) <E00648A8-30F5-3638-8774-6EE461AB8CAC> /Library/Frameworks/Python.framework/Versions/3.7/lib/libssl.1.1.dylib
0x10224f000 - 0x10242cc6f +libcrypto.1.1.dylib (0) <4E4019C3-04B3-3DA5-8504-57FF0E7C5600> /Library/Frameworks/Python.framework/Versions/3.7/lib/libcrypto.1.1.dylib
0x1024ac000 - 0x1024b1ff7 +_blake2.cpython-37m-darwin.so (0) <5D4A9B1B-FE9F-34EA-BD75-7B3CDDBB7CD0> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_blake2.cpython-37m-darwin.so
0x1024b6000 - 0x1024c6ff7 +_sha3.cpython-37m-darwin.so (0) <78945AB7-D4B8-3DCE-8496-EE83FDA05E0D> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_sha3.cpython-37m-darwin.so
0x1024cc000 - 0x1024ccff7 +_bisect.cpython-37m-darwin.so (0) <A4FCF31A-2AA6-3EAC-AF46-2F2D10EC1AB1> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_bisect.cpython-37m-darwin.so
0x1024cf000 - 0x1024d0ff7 +_random.cpython-37m-darwin.so (0) <CE043712-0C0E-3DA4-AAF2-35654CC67C6D> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_random.cpython-37m-darwin.so
0x1024d4000 - 0x1024d8fff +_struct.cpython-37m-darwin.so (0) <2379780F-4AB4-394B-B5AB-55A517D6627E> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
0x102521000 - 0x102522ff7 +_posixsubprocess.cpython-37m-darwin.so (0) <11920A4C-3AD4-3C87-95E5-418D30950610> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_posixsubprocess.cpython-37m-darwin.so
0x102526000 - 0x102527fff +fcntl.cpython-37m-darwin.so (0) <ADADACC0-C00C-3386-9709-CCB56A7C95E0> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/fcntl.cpython-37m-darwin.so
0x10252b000 - 0x10252eff7 +zlib.cpython-37m-darwin.so (0) <CB41B121-E928-3213-92CE-7A26C3F668BF> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/zlib.cpython-37m-darwin.so
0x102534000 - 0x102539ff7 +array.cpython-37m-darwin.so (0) <B594CECF-180C-348D-B9DA-11275D232042> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/array.cpython-37m-darwin.so
0x102654000 - 0x102667fff +_pickle.cpython-37m-darwin.so (0) <2F30BDA6-A35E-38F0-9096-72DDCA1030B6> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_pickle.cpython-37m-darwin.so
0x1026f3000 - 0x102703ff7 +_ctypes.cpython-37m-darwin.so (0) <78FCD5A2-0B47-331E-A406-2876C1289C15> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
0x102755000 - 0x102756ff7 +_bz2.cpython-37m-darwin.so (0) <732D55D3-F86E-31E0-95B9-DB921419F7B2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_bz2.cpython-37m-darwin.so
0x10275a000 - 0x10278aff7 +_lzma.cpython-37m-darwin.so (0) <91D1CDE2-5956-3869-87A0-29726C9D4C60> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_lzma.cpython-37m-darwin.so
0x102794000 - 0x102794fff +grp.cpython-37m-darwin.so (0) <9C889B5E-65A3-339F-8F34-E10FF20A6ED9> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/grp.cpython-37m-darwin.so
0x102797000 - 0x10279cff7 +libdnet.dylib (0) <BD67BA1C-F58B-3ABF-89DE-35B09579779F> /usr/local/lib/libdnet.dylib
0x1027e1000 - 0x1027e3ffb +netifaces.cpython-37m-darwin.so (0) <0DCF0A83-6515-3E4E-902C-2E0E7FF24E13> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/netifaces.cpython-37m-darwin.so
0x102d04000 - 0x102d48ff7 +_decimal.cpython-37m-darwin.so (0) <C94BD9E0-CEBA-3930-AB10-15E1FEFAA244> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_decimal.cpython-37m-darwin.so
0x102db0000 - 0x102db1ff7 +_queue.cpython-37m-darwin.so (0) <C457E118-139B-352D-A6F9-DA76389AE74E> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_queue.cpython-37m-darwin.so
0x103b9f000 - 0x103c096ef dyld (655.1.1) <F217F7F8-A795-3109-B77F-B1E2277F3E3B> /usr/lib/dyld
0x7fff47769000 - 0x7fff47bacfff com.apple.CoreFoundation (6.9 - 1570.16) <F3DFF269-6705-35AD-9F01-66D77DD1B518> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x7fff705a0000 - 0x7fff705a1ffb libDiagnosticMessagesClient.dylib (107) <B5675E8C-2F34-3E0A-B7E8-6F2373589038> /usr/lib/libDiagnosticMessagesClient.dylib
0x7fff709df000 - 0x7fff709e0ffb libSystem.B.dylib (1252.250.1) <72841192-B0C9-36A0-8E55-ED651EADEF08> /usr/lib/libSystem.B.dylib
0x7fff70c14000 - 0x7fff70c21fff libbz2.1.0.dylib (38.200.3) <62019AC3-20C9-3DDC-9C83-189C1F258073> /usr/lib/libbz2.1.0.dylib
0x7fff70c22000 - 0x7fff70c75ff7 libc++.1.dylib (400.9.4) <446DAE5E-4E97-3E4B-B2A3-AC0A74C0E453> /usr/lib/libc++.1.dylib
0x7fff70c76000 - 0x7fff70c8bff7 libc++abi.dylib (400.17) <A2D1FDAD-E10F-3E53-958F-CB6BC8485767> /usr/lib/libc++abi.dylib
0x7fff71898000 - 0x7fff71af8ff3 libicucore.A.dylib (62123.0.1) <3936C798-1978-3C6C-9050-3BBD57CDA53E> /usr/lib/libicucore.A.dylib
0x7fff723d9000 - 0x7fff72b5efdf libobjc.A.dylib (756.2) <4F86FC7C-496B-3E68-8A74-1EA2BA22FBCC> /usr/lib/libobjc.A.dylib
0x7fff72b77000 - 0x7fff72bacfff libpcap.A.dylib (79.250.1) <FA490ABF-6C15-336A-818F-0C14A8C090DB> /usr/lib/libpcap.A.dylib
0x7fff732af000 - 0x7fff732c1ff7 libz.1.dylib (70.200.4) <FDF169F3-F992-3E8E-B3F7-D4134FEBAE41> /usr/lib/libz.1.dylib
0x7fff73a9e000 - 0x7fff73aa2ff3 libcache.dylib (81) <9A8C27B0-49C9-337F-8BE2-37171ED2D8EE> /usr/lib/system/libcache.dylib
0x7fff73aa3000 - 0x7fff73aadff3 libcommonCrypto.dylib (60118.250.2) <17C4F395-9FF0-331F-8167-5E85AA3588E9> /usr/lib/system/libcommonCrypto.dylib
0x7fff73aae000 - 0x7fff73ab5ff7 libcompiler_rt.dylib (63.4) <8CB2B2B6-2C55-3733-9842-0E037AE3F46A> /usr/lib/system/libcompiler_rt.dylib
0x7fff73ab6000 - 0x7fff73abfff7 libcopyfile.dylib (146.250.1) <24905E41-9E2F-3DD1-A255-5A17F9FCDAD7> /usr/lib/system/libcopyfile.dylib
0x7fff73ac0000 - 0x7fff73b44fc7 libcorecrypto.dylib (602.250.23) <3A6CBD41-AFFE-3E06-B1EC-3E95BC79BAC5> /usr/lib/system/libcorecrypto.dylib
0x7fff73bcb000 - 0x7fff73c04ff7 libdispatch.dylib (1008.250.7) <50235FCE-B399-3319-90DC-88F530D4FC5C> /usr/lib/system/libdispatch.dylib
0x7fff73c05000 - 0x7fff73c31ff7 libdyld.dylib (655.1.1) <54C6B494-4A3D-3EEC-B083-636A76AAD649> /usr/lib/system/libdyld.dylib
0x7fff73c32000 - 0x7fff73c32ffb libkeymgr.dylib (30) <BEA04E04-FCF1-3A70-810F-08D0FF54CA36> /usr/lib/system/libkeymgr.dylib
0x7fff73c40000 - 0x7fff73c40ff7 liblaunch.dylib (1336.251.2) <30E6424E-4640-3DBA-9B64-D5F725263C6E> /usr/lib/system/liblaunch.dylib
0x7fff73c41000 - 0x7fff73c46fff libmacho.dylib (927.0.2) <D8515A20-ED7B-3B13-9ADA-4BD7E19E38C4> /usr/lib/system/libmacho.dylib
0x7fff73c47000 - 0x7fff73c49ffb libquarantine.dylib (86.220.1) <8A9BF971-DB7D-311A-B131-6C5025E82F8F> /usr/lib/system/libquarantine.dylib
0x7fff73c4a000 - 0x7fff73c4bff7 libremovefile.dylib (45.200.2) <950036B7-B91E-3B5D-853C-8C551E5B6A32> /usr/lib/system/libremovefile.dylib
0x7fff73c4c000 - 0x7fff73c63ff3 libsystem_asl.dylib (356.200.4) <16F632AD-FADA-3DE9-85E8-EBC7D619A1DA> /usr/lib/system/libsystem_asl.dylib
0x7fff73c64000 - 0x7fff73c64ff7 libsystem_blocks.dylib (73) <0CD6861B-EC5F-3345-9C24-B21EEB85E44F> /usr/lib/system/libsystem_blocks.dylib
0x7fff73c65000 - 0x7fff73cecfff libsystem_c.dylib (1272.250.1) <F3AA9047-EEDD-3D80-8CC1-023FB312EC8B> /usr/lib/system/libsystem_c.dylib
0x7fff73ced000 - 0x7fff73cf0ffb libsystem_configuration.dylib (963.250.1) <02C7A973-014A-31D7-B7D2-247D384CB0D2> /usr/lib/system/libsystem_configuration.dylib
0x7fff73cf1000 - 0x7fff73cf4ff7 libsystem_coreservices.dylib (66) <4CF1C89B-FA6C-3DF3-B1F8-79F549849534> /usr/lib/system/libsystem_coreservices.dylib
0x7fff73cf5000 - 0x7fff73cfbfff libsystem_darwin.dylib (1272.250.1) <6983A268-20F4-3F98-A3F5-D63848933B02> /usr/lib/system/libsystem_darwin.dylib
0x7fff73cfc000 - 0x7fff73d02ff7 libsystem_dnssd.dylib (878.250.4) <9FC5724C-DD03-3E14-A6E1-2DD009D79E0A> /usr/lib/system/libsystem_dnssd.dylib
0x7fff73d03000 - 0x7fff73d4effb libsystem_info.dylib (517.200.9) <F617D3CF-5A4A-36D0-8CBB-4A7C7CDB67AF> /usr/lib/system/libsystem_info.dylib
0x7fff73d4f000 - 0x7fff73d77ff7 libsystem_kernel.dylib (4903.251.3) <84EF0290-6CB5-36E5-A273-692A7E437B36> /usr/lib/system/libsystem_kernel.dylib
0x7fff73d78000 - 0x7fff73dc3ff7 libsystem_m.dylib (3158.200.7) <33105665-CCC3-36D5-82C9-9B21730CB3DF> /usr/lib/system/libsystem_m.dylib
0x7fff73dc4000 - 0x7fff73de8fff libsystem_malloc.dylib (166.251.2) <90DA09E3-1276-3FCF-8F5F-C9AA61AB9B6D> /usr/lib/system/libsystem_malloc.dylib
0x7fff73de9000 - 0x7fff73df3ff7 libsystem_networkextension.dylib (767.250.2) <4575D797-B793-3D18-9E93-8696CF0B133B> /usr/lib/system/libsystem_networkextension.dylib
0x7fff73df4000 - 0x7fff73dfbfff libsystem_notify.dylib (172.200.21) <679E9132-1A46-326E-9A11-D3FF9C86041C> /usr/lib/system/libsystem_notify.dylib
0x7fff73dfc000 - 0x7fff73e05fef libsystem_platform.dylib (177.250.1) <3CC59141-5365-3848-94C3-D65E6FCA1E74> /usr/lib/system/libsystem_platform.dylib
0x7fff73e06000 - 0x7fff73e10ff7 libsystem_pthread.dylib (330.250.2) <4344198A-A1A3-3C52-97B4-F168D56E9789> /usr/lib/system/libsystem_pthread.dylib
0x7fff73e11000 - 0x7fff73e14ff7 libsystem_sandbox.dylib (851.250.12) <66E91015-F62A-3365-BB81-AA88707E8F12> /usr/lib/system/libsystem_sandbox.dylib
0x7fff73e15000 - 0x7fff73e17ff3 libsystem_secinit.dylib (30.220.1) <F054DCB0-68CE-35E7-8B8C-D648C42124EC> /usr/lib/system/libsystem_secinit.dylib
0x7fff73e18000 - 0x7fff73e1fff3 libsystem_symptoms.dylib (820.257.1) <C8517F35-E9DA-3649-B07D-2B38349C6730> /usr/lib/system/libsystem_symptoms.dylib
0x7fff73e20000 - 0x7fff73e35fff libsystem_trace.dylib (906.250.5) <AE77ACC7-488F-3AE1-BB0C-1ACFC7E1CE77> /usr/lib/system/libsystem_trace.dylib
0x7fff73e37000 - 0x7fff73e3cffb libunwind.dylib (35.4) <8F0BC197-B97C-3DDC-92B0-6A7D3CB72FD8> /usr/lib/system/libunwind.dylib
0x7fff73e3d000 - 0x7fff73e6cff7 libxpc.dylib (1336.251.2) <49138829-09C8-355C-B558-97E070B84EC5> /usr/lib/system/libxpc.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 15008
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=246.6M resident=0K(0%) swapped_out_or_unallocated=246.6M(100%)
Writable regions: Total=65.1M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=65.1M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Kernel Alloc Once 8K 1
MALLOC 48.3M 22
MALLOC guard page 16K 4
MALLOC_LARGE (reserved) 384K 2 reserved VM address space (unallocated)
STACK GUARD 4K 1
Stack 16.0M 1
VM_ALLOCATE 4K 1
__DATA 5684K 74
__LINKEDIT 223.1M 29
__TEXT 23.5M 71
__UNICODE 564K 1
shared memory 12K 3
=========== ======= =======
TOTAL 317.5M 210
TOTAL, minus reserved VM space 317.1M 210
Model: MacBookPro11,1, BootROM 151.0.0.0.0, 2 processors, Intel Core i5, 2.6 GHz, 8 GB, SMC 2.16f68
Graphics: kHW_IntelIrisItem, Intel Iris, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x02FE, -
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x02FE, -
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x112), Broadcom BCM43xx 1.0 (7.77.61.2 AirPortDriverBrcmNIC-1305.8)
Bluetooth: Version 6.0.11f4, 3 services, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM0256F, 251 GB
USB Device: USB 3.0 Bus
USB Device: Apple Internal Keyboard / Trackpad
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: USB Optical Mouse
Thunderbolt Bus: MacBook Pro, Apple Inc., 17.2
I cannot reproduce your issues with Scapy, so I'll assume that's only related to Kamene (I have edited your question to reflect that).
You can either try using the "real" Scapy (https://github.com/secdev/scapy), or report this issue to the Kamene project.
This happens due to permissions issue with mac. The python program is not able to get write to the packet on to network. I had a similar issue and using sudo resolved the issue.

How to use alsa sound and/or snd_pcm_open in docker?

I am running an Ubuntu 12.04 Docker container on an Ubuntu 16.04 host. Some test code I have exercises 'snd_pcm_open'/'snd_pcm_close' operations with the SND_PCM_STREAM_PLAYBACK and SND_PCM_STREAM_CAPTURE stream types.
I do not need any actual sound/audio capabilities but just getting the 'snd_pcm_open' return 0 with a valid handle, then 'snd_pcm_close' to return 0 on the same handle would be good enough for my purposes. I do not want to modify the code as it's already got some not-so-nice platform dependent switches and I am not the maintainer.
I am using the simple code and compiling it as 'g++ alsa_test.cpp -lasound'
#include <stdio.h>
#include <alsa/asoundlib.h>
int main() {
snd_pcm_t* handle;
snd_pcm_stream_t stream_type[]= {SND_PCM_STREAM_PLAYBACK, SND_PCM_STREAM_CAPTURE};
printf("\nstarting\n");
for (unsigned char i = 0; i < sizeof(stream_type) / sizeof(stream_type[0]); ++i) {
printf(">>>>>>>>\n\n");
int deviceResult = snd_pcm_open(&handle, "default" , stream_type[i], 0);
printf("\n%d open: %d\n", stream_type[i], deviceResult);
if (deviceResult >= 0) {
printf("attempting to close %d\n", stream_type[i]);
snd_pcm_drain(handle);
deviceResult = snd_pcm_close(handle);
printf("%d close: %d\n\n", stream_type[i], deviceResult);
}
printf("<<<<<<<<\n\n");
}
return 0;
}
It works just fine on the host but despite all the different things I tried, 'snd_pcm_open' returns '-2' for both stream types in the container.
I tried installing the 'libasound2.dev' but 'modinfo soundcore' is empty and '/dev/snd' does not exist.
Also tried running the container with the options below, even though it feels like a massive over kill for such a simple purpose
--privileged --cap-add=ALL -v /dev:/dev -v /lib/modules:/lib/modules
After these extra parameters to the container, following commands generate the same output both in the host and the container.
root#31142791f82d:/export# modinfo soundcore
filename: /lib/modules/4.4.0-59-generic/kernel/sound/soundcore.ko
alias: char-major-14-*
license: GPL
author: Alan Cox
description: Core sound module
srcversion: C941364F5CD0B525693B243
depends:
intree: Y
vermagic: 4.4.0-59-generic SMP mod_unload modversions
parm: preclaim_oss:int
root#31142791f82d:/export# ls -l /dev/snd/
total 0
drwxr-xr-x 2 root root 100 Feb 2 21:10 by-path
crw-rw----+ 1 root audio 116, 2 Feb 2 07:42 controlC0
crw-rw----+ 1 root audio 116, 7 Feb 2 07:42 controlC1
crw-rw----+ 1 root audio 116, 12 Feb 2 21:10 controlC2
crw-rw----+ 1 root audio 116, 6 Feb 2 07:42 hwC0D0
crw-rw----+ 1 root audio 116, 11 Feb 2 07:42 hwC1D0
crw-rw----+ 1 root audio 116, 3 Feb 2 07:42 pcmC0D3p
crw-rw----+ 1 root audio 116, 4 Feb 2 07:42 pcmC0D7p
crw-rw----+ 1 root audio 116, 5 Feb 2 07:42 pcmC0D8p
crw-rw----+ 1 root audio 116, 9 Feb 2 10:44 pcmC1D0c
crw-rw----+ 1 root audio 116, 8 Feb 2 07:42 pcmC1D0p
crw-rw----+ 1 root audio 116, 10 Feb 2 21:30 pcmC1D1p
crw-rw----+ 1 root audio 116, 14 Feb 2 21:10 pcmC2D0c
crw-rw----+ 1 root audio 116, 13 Feb 2 21:10 pcmC2D0p
crw-rw----+ 1 root audio 116, 1 Feb 2 07:42 seq
crw-rw----+ 1 root audio 116, 33 Feb 2 07:42 timer
The container only has the 'root' user by the way, so, access rights shouldn't be an issue either.
What would be the easiest and least hacky way to get this working? I'd rather get rid off the privileged mode and dev/modules mapping to the container however, these containers are not accessed from the outside world and are only created/destroyed for some short lived tasks. So, safety isn't exactly a massive concern.
Thanks in advance.
If you don't actually need the device to work correctly, use the null device instead of default.
To make the null plugin the default one, put this into the container's /etc/asound.conf, or into the user's ~/.asoundrc:
pcm.!default = null;

Cannot add members to MongoDB Replica Set

I'm trying to configure a MongoDB Replica Set but every time I try to add another member it fails.
I have 3 members I'm trying to configure. Their mongod.conf files all look like this:
# mongo.conf
#where to log
logpath=/log/mongod.log
logappend=true
# fork and run in background
fork = true
smallfiles=true
rest=true
port = 27017
replSet=KidzpaceReplSet
dbpath=/data
With the acception of the ports. They are 27017(Primary), 27018(Secondary) and 27019(Arbiter) respectively.
I have verified that the members can see each other:
[ec2-user#domU-12-31-39-06-C4-74 ~]$ mongo --host 174.129.232.170 --port 27018
MongoDB shell version: 2.4.3
connecting to: 174.129.232.170:27018/test
>
[ec2-user#domU-12-31-39-0A-30-E8 ~]$ mongo --host 174.129.230.20 --port 27017
MongoDB shell version: 2.4.3
connecting to: 174.129.230.20:27017/test
>
When adding the second member to the set it returns OK:
KidzpaceReplSet:PRIMARY> rs.add("174.129.232.170:27018")
{ "ok" : 1 }
However whatever the next command I run is, In this case it's adding my Arbiter, the set fails with this error:
KidzpaceReplSet:PRIMARY> rs.add("174.129.232.177:27019", true)
Tue May 28 20:24:07.139 DBClientCursor::init call() failed
Tue May 28 20:24:07.140 trying reconnect to 127.0.0.1:27017
Tue May 28 20:24:07.141 reconnect 127.0.0.1:27017 ok
reconnected to server after rs command (which is normal)
This is the the log file:
Tue May 28 20:44:06.173 [rsStart] replSet I am domU-12-31-39-06-C4-74:27017
Tue May 28 20:44:06.173 [rsStart] replSet STARTUP2
Tue May 28 20:44:07.175 [rsSync] replSet SECONDARY
Tue May 28 20:44:07.175 [rsMgr] replSet info electSelf 0
Tue May 28 20:44:08.174 [rsMgr] replSet PRIMARY
Tue May 28 20:44:29.813 [conn1] replSet replSetReconfig config object parses ok, 2 members specified
Tue May 28 20:44:29.817 [conn1] replSet replSetReconfig [2]
Tue May 28 20:44:29.817 [conn1] replSet info saving a newer config version to local.system.replset
Tue May 28 20:44:29.834 [conn1] replSet saveConfigLocally done
Tue May 28 20:44:29.834 [conn1] replSet info : additive change to configuration
Tue May 28 20:44:29.834 [conn1] replSet replSetReconfig new config saved locally
Tue May 28 20:44:39.835 [rsHealthPoll] DBClientCursor::init call() failed
Tue May 28 20:44:39.835 [rsHealthPoll] replset info 174.129.232.170:27018 heartbeat failed, retrying
Tue May 28 20:44:40.834 [rsHealthPoll] DBClientCursor::init call() failed
Tue May 28 20:44:40.834 [rsHealthPoll] replSet info 174.129.232.170:27018 is down (or slow to respond):
Tue May 28 20:44:40.835 [rsHealthPoll] replSet member 174.129.232.170:27018 is now in state DOWN
Tue May 28 20:44:40.835 [rsMgr] replSet total number of votes is even - add arbiter or give one member an extra vote
Tue May 28 20:44:40.835 [rsMgr] can't see a majority of the set, relinquishing primary
Tue May 28 20:44:40.835 [rsMgr] replSet relinquishing primary state
Tue May 28 20:44:40.835 [rsMgr] replSet SECONDARY
Tue May 28 20:44:40.835 [rsMgr] replSet closing client sockets after relinquishing primary
Tue May 28 20:44:42.044 [conn1] end connection 127.0.0.1:58727 (0 connections now open)
Tue May 28 20:44:46.150 [rsHealthPoll] replSet member 174.129.232.170:27018 is up
Tue May 28 20:44:46.151 [rsMgr] replSet not electing self, not all members up and we have been up less than 5 minutes
Tue May 28 20:44:52.156 [rsMgr] replSet not electing self, not all members up and we have been up less than 5 minutes
UPDATE
I'm wondering if maybe the problem is when I run rs.initiate(). It gives me this output:
{
"set" : "KidzpaceReplSet",
"date" : ISODate("2013-05-28T20:59:05Z"),
"myState" : 1,
"members" : [
{
"_id" : 0,
"name" : "domU-12-31-39-06-C4-74:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 23,
"optime" : {
"t" : 1369774732,
"i" : 1
},
"optimeDate" : ISODate("2013-05-28T20:58:52Z"),
"self" : true
}
],
"ok" : 1
}
Notice the name of the member? "name" : "domU-12-31-39-06-C4-74:27017" Where does this name come from? It's not my IP Address. I'm not sure but maybe this could be the source of the problem.
So it turns out rs.initiate() might give the member that launches it some kind of internal alias for it's IP address. In my case it was: domU-12-31-39-06-C4-74.
The initial connection to the secondary is fine because the primary instigates it. However since the secondary now has this alias to use when it tries to talk back to the primary, it fails.
The solution was a to copy the existing configuration:
cfg = rs.conf()
manually change the name(host) of the primary node:
cfg.members[0].host = 666.666.666.666:27017
And reconfigure the replica set:
rs.reconfig(cfg)

Resources