I set up a Raspberry Pi 3 as an access point following the documentation for connect a smartphone on tornado websocket on python
It works but frequently the AP stops working and I have to restart hostapd and dnsmasq.
When it stops, hostapd and dnsmasq are still running in task manager and if I run ifconfig, the line:
inet addr:192.168.7.1 Bcast:192.168.7.255 Mask:255.255.255.0
is missing and instead of:
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
there is:
UP BROADCAST MULTICAST MTU:1500 Metric:1
I need the AP keep working continuously so:
1 ) how do I start the AP at boot?
2 ) how can I debug this interruption?
3 ) how can I restart the AP in case of problems?
UPDATE 1
in file /var/log/syslog there aren't entries today
UPDATE 2
sudo dmesg result after apt update && apt dist-upgrade (I had to remove the previous result because of characters limit):
pi@raspberrypi:~ $ sudo dmesg
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.9.35-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #1014 SMP Fri Jun 30 14:47:43 BST 2017
[ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt:Machine model: Raspberry Pi 3 Model B Rev 1.2
[ 0.000000] cma: Reserved 8 MiB at 0x3a800000
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] On node 0 totalpages: 241664
[ 0.000000] free_area_init_node: node 0, pgdat 80c6ee40, node_mem_map b9faa000
[ 0.000000] Normal zone: 2124 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 241664 pages, LIFO batch:31
[ 0.000000] percpu: Embedded 14 pages/cpu @b9f64000 s25600 r8192 d23552 u57344
[ 0.000000] pcpu-alloc: s25600 r8192 d23552 u57344 alloc=14*4096
[ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 239540
[ 0.000000] Kernel command line: 8250.nr_uarts=0 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Memory: 936296K/966656K available (7168K kernel code, 484K rwdata, 2012K rodata, 1024K init, 778K bss, 22168K reserved, 8192K cma-reserved)
[ 0.000000] Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xbb800000 - 0xff800000 (1088 MB)
lowmem : 0x80000000 - 0xbb000000 ( 944 MB)
modules : 0x7f000000 - 0x80000000 ( 16 MB)
.text : 0x80008000 - 0x80800000 (8160 kB)
.init : 0x80b00000 - 0x80c00000 (1024 kB)
.data : 0x80c00000 - 0x80c79014 ( 485 kB)
.bss : 0x80c7b000 - 0x80d3da64 ( 779 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] Build-time adjustment of leaf fanout to 32.
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] arm_arch_timer: Architected cp15 timer(s) running at 19.20MHz (phys).
[ 0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x46d987e47, max_idle_ns: 440795202767 ns
[ 0.000008] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 4398046511078ns
[ 0.000021] Switching to timer-based delay loop, resolution 52ns
[ 0.000322] Console: colour dummy device 80x30
[ 0.000342] console [tty1] enabled
[ 0.000365] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[ 0.000381] pid_max: default: 32768 minimum: 301
[ 0.000711] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000720] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.001708] Disabling cpuset control group subsystem
[ 0.001873] CPU: Testing write buffer coherency: ok
[ 0.001912] ftrace: allocating 22390 entries in 66 pages
[ 0.054461] CPU0: update cpu_capacity 1024
[ 0.054479] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[ 0.054555] Setting up static identity map for 0x100000 - 0x100034
[ 0.056751] CPU1: update cpu_capacity 1024
[ 0.056759] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[ 0.057478] CPU2: update cpu_capacity 1024
[ 0.057485] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[ 0.058153] CPU3: update cpu_capacity 1024
[ 0.058160] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[ 0.058243] Brought up 4 CPUs
[ 0.058253] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[ 0.058258] CPU: All CPU(s) started in HYP mode.
[ 0.058261] CPU: Virtualization extensions available.
[ 0.059056] devtmpfs: initialized
[ 0.070277] VFP support v0.3: implementor 41 architecture 3 part 40 variant 3 rev 4
[ 0.070553] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.070569] futex hash table entries: 1024 (order: 4, 65536 bytes)
[ 0.071106] pinctrl core: initialized pinctrl subsystem
[ 0.071995] NET: Registered protocol family 16
[ 0.074346] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.083309] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[ 0.083315] hw-breakpoint: maximum watchpoint size is 8 bytes.
[ 0.083467] Serial: AMBA PL011 UART driver
[ 0.085343] bcm2835-mbox 3f00b880.mailbox: mailbox enabled
[ 0.085862] uart-pl011 3f201000.serial: could not find pctldev for node /soc/gpio@7e200000/uart0_pins, deferring probe
[ 0.155045] bcm2835-dma 3f007000.dma: DMA legacy API manager at bb80f000, dmachans=0x1
[ 0.156858] SCSI subsystem initialized
[ 0.157014] usbcore: registered new interface driver usbfs
[ 0.157089] usbcore: registered new interface driver hub
[ 0.157178] usbcore: registered new device driver usb
[ 0.164023] raspberrypi-firmware soc:firmware: Attached to firmware from 2017-07-03 14:16
[ 0.165495] clocksource: Switched to clocksource arch_sys_counter
[ 0.212328] VFS: Disk quotas dquot_6.6.0
[ 0.212405] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 0.212597] FS-Cache: Loaded
[ 0.212844] CacheFiles: Loaded
[ 0.225021] NET: Registered protocol family 2
[ 0.225877] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.225984] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[ 0.226169] TCP: Hash tables configured (established 8192 bind 8192)
[ 0.226257] UDP hash table entries: 512 (order: 2, 16384 bytes)
[ 0.226298] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[ 0.226505] NET: Registered protocol family 1
[ 0.226897] RPC: Registered named UNIX socket transport module.
[ 0.226902] RPC: Registered udp transport module.
[ 0.226906] RPC: Registered tcp transport module.
[ 0.226910] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.227938] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 7 counters available
[ 0.230195] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[ 0.246293] FS-Cache: Netfs 'nfs' registered for caching
[ 0.247263] NFS: Registering the id_resolver key type
[ 0.247288] Key type id_resolver registered
[ 0.247293] Key type id_legacy registered
[ 0.249714] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.249831] io scheduler noop registered
[ 0.249836] io scheduler deadline registered (default)
[ 0.250138] io scheduler cfq registered
[ 0.255811] BCM2708FB: allocated DMA memory fa910000
[ 0.255835] BCM2708FB: allocated DMA channel 0 @ bb80f000
[ 0.292782] Console: switching to colour frame buffer device 160x64
[ 0.315729] bcm2835-rng 3f104000.rng: hwrng registered
[ 0.315836] vc-cma: Videocore CMA driver
[ 0.315842] vc-cma: vc_cma_base = 0x00000000
[ 0.315847] vc-cma: vc_cma_size = 0x00000000 (0 MiB)
[ 0.315852] vc-cma: vc_cma_initial = 0x00000000 (0 MiB)
[ 0.316052] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[ 0.331505] brd: module loaded
[ 0.340522] loop: module loaded
[ 0.340534] Loading iSCSI transport class v2.0-870.
[ 0.341080] usbcore: registered new interface driver smsc95xx
[ 0.341096] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[ 0.569160] Core Release: 2.80a
[ 0.569168] Setting default values for core params
[ 0.569200] Finished setting default values for core params
[ 0.769590] Using Buffer DMA mode
[ 0.769595] Periodic Transfer Interrupt Enhancement - disabled
[ 0.769599] Multiprocessor Interrupt Enhancement - disabled
[ 0.769605] OTG VER PARAM: 0, OTG VER FLAG: 0
[ 0.769618] Dedicated Tx FIFOs mode
[ 0.769981] WARN::dwc_otg_hcd_init:1032: FIQ DMA bounce buffers: virt = 0xba904000 dma = 0xfa904000 len=9024
[ 0.770007] FIQ FSM acceleration enabled for :
Non-periodic Split Transactions
Periodic Split Transactions
High-Speed Isochronous Endpoints
Interrupt/Control Split Transaction hack enabled
[ 0.770013] dwc_otg: Microframe scheduler enabled
[ 0.770060] WARN::hcd_init_fiq:459: FIQ on core 1 at 0x8058ef90
[ 0.770070] WARN::hcd_init_fiq:460: FIQ ASM at 0x8058f300 length 36
[ 0.770082] WARN::hcd_init_fiq:486: MPHI regs_base at 0xbb87a000
[ 0.770139] dwc_otg 3f980000.usb: DWC OTG Controller
[ 0.770173] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[ 0.770205] dwc_otg 3f980000.usb: irq 62, io mem 0x00000000
[ 0.770251] Init: Port Power? op_state=1
[ 0.770256] Init: Power Port (0)
[ 0.770454] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 0.770465] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.770473] usb usb1: Product: DWC OTG Controller
[ 0.770481] usb usb1: Manufacturer: Linux 4.9.35-v7+ dwc_otg_hcd
[ 0.770489] usb usb1: SerialNumber: 3f980000.usb
[ 0.771340] hub 1-0:1.0: USB hub found
[ 0.771378] hub 1-0:1.0: 1 port detected
[ 0.772070] dwc_otg: FIQ enabled
[ 0.772075] dwc_otg: NAK holdoff enabled
[ 0.772079] dwc_otg: FIQ split-transaction FSM enabled
[ 0.772092] Module dwc_common_port init
[ 0.772315] usbcore: registered new interface driver usb-storage
[ 0.772544] mousedev: PS/2 mouse device common for all mice
[ 0.773546] bcm2835-wdt 3f100000.watchdog: Broadcom BCM2835 watchdog timer
[ 0.773822] bcm2835-cpufreq: min=600000 max=1200000
[ 0.774210] sdhci: Secure Digital Host Controller Interface driver
[ 0.774215] sdhci: Copyright(c) Pierre Ossman
[ 0.774486] sdhost-bcm2835 3f202000.sdhost: could not get clk, deferring probe
[ 0.776694] mmc-bcm2835 3f300000.mmc: could not get clk, deferring probe
[ 0.776794] sdhci-pltfm: SDHCI platform and OF driver helper
[ 0.779416] ledtrig-cpu: registered to indicate activity on CPUs
[ 0.779606] hidraw: raw HID events driver (C) Jiri Kosina
[ 0.779799] usbcore: registered new interface driver usbhid
[ 0.779802] usbhid: USB HID core driver
[ 0.780606] vchiq: vchiq_init_state: slot_zero = 0xba980000, is_master = 0
[ 0.782631] Initializing XFRM netlink socket
[ 0.782654] NET: Registered protocol family 17
[ 0.782768] Key type dns_resolver registered
[ 0.783253] Registering SWP/SWPB emulation handler
[ 0.783946] registered taskstats version 1
[ 0.784297] vc-sm: Videocore shared memory driver
[ 0.784308] [vc_sm_connected_init]: start
[ 0.791441] [vc_sm_connected_init]: end - returning 0
[ 0.797468] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[ 0.799126] sdhost: log_buf @ ba907000 (fa907000)
[ 0.875530] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[ 0.877740] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0
[ 0.877747] mmc-bcm2835 3f300000.mmc: DMA channel allocated
[ 0.935631] of_cfs_init
[ 0.935764] of_cfs_init: OK
[ 0.938346] Waiting for root device /dev/mmcblk0p7...
[ 0.945298] mmc0: host does not support reading read-only switch, assuming write-enable
[ 0.947301] mmc0: new high speed SDHC card at address 59b4
[ 0.947995] mmcblk0: mmc0:59b4 USD 14.7 GiB
[ 0.952565] mmcblk0: p1 p2 < p5 p6 p7 >
[ 0.954369] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[ 0.955927] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 0.957474] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[ 0.960252] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[ 0.985628] Indeed it is in host mode hprt0 = 00021501
[ 1.052160] random: fast init done
[ 1.069425] EXT4-fs (mmcblk0p7): mounted filesystem with ordered data mode. Opts: (null)
[ 1.069470] VFS: Mounted root (ext4 filesystem) readonly on device 179:7.
[ 1.079624] devtmpfs: mounted
[ 1.081632] Freeing unused kernel memory: 1024K (80b00000 - 80c00000)
[ 1.110988] mmc1: new high speed SDIO card at address 0001
[ 1.185552] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 1.185698] Indeed it is in host mode hprt0 = 00001101
[ 1.413413] systemd[1]: systemd 215 running in system mode. (+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR)
[ 1.413767] systemd[1]: Detected architecture 'arm'.
[ 1.415879] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[ 1.415892] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1.416729] hub 1-1:1.0: USB hub found
[ 1.416822] hub 1-1:1.0: 5 ports detected
[ 1.537685] NET: Registered protocol family 10
[ 1.539108] systemd[1]: Inserted module 'ipv6'
[ 1.541601] systemd[1]: Set hostname to <raspberrypi>.
[ 1.541758] systemd[1]: Initializing machine ID from random generator.
[ 1.541973] systemd[1]: Installed transient /etc/machine-id file.
[ 1.735576] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 1.865849] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 1.865863] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1.868686] smsc95xx v1.0.5
[ 1.959454] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:b7:d1:97
[ 2.055566] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
[ 2.131158] systemd[1]: Cannot add dependency job for unit regenerate_ssh_host_keys.service, ignoring: Unit regenerate_ssh_host_keys.service failed to load: No such file or directory.
[ 2.134848] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[ 2.135195] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[ 2.135276] systemd[1]: Starting Remote File Systems (Pre).
[ 2.187833] usb 1-1.3: New USB device found, idVendor=067b, idProduct=2303
[ 2.187848] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.187856] usb 1-1.3: Product: USB-Serial Controller
[ 2.187863] usb 1-1.3: Manufacturer: Prolific Technology Inc.
[ 2.286529] fuse init (API version 7.26)
[ 2.368269] i2c /dev entries driver
[ 2.631808] systemd-udevd[144]: starting version 215
[ 3.349987] EXT4-fs (mmcblk0p7): re-mounted. Opts: (null)
[ 4.245210] usbcore: registered new interface driver usbserial
[ 4.245295] usbcore: registered new interface driver usbserial_generic
[ 4.245385] usbserial: USB Serial support registered for generic
[ 4.248545] usbcore: registered new interface driver pl2303
[ 4.248664] usbserial: USB Serial support registered for pl2303
[ 4.248758] pl2303 1-1.3:1.0: pl2303 converter detected
[ 4.252749] usb 1-1.3: pl2303 converter now attached to ttyUSB0
[ 4.289651] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
[ 4.640476] usbcore: registered new interface driver brcmfmac
[ 4.793900] brcmfmac: Firmware version = wl0: Aug 7 2017 00:46:29 version 7.45.41.46 (r666254 CY) FWID 01-f8a78378
[ 5.545973] systemd-journald[139]: Received request to flush runtime journal from PID 1
[ 7.434676] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[ 7.434686] brcmfmac: power management disabled
[ 7.726822] uart-pl011 3f201000.serial: no DMA platform data
[ 8.297891] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 8.411149] Adding 102396k swap on /var/swap. Priority:-1 extents:3 across:487420k SSFS
[ 8.447242] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 8.491717] nf_conntrack version 0.5.0 (15360 buckets, 61440 max)
[ 8.695868] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 10.460514] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[ 12.289538] Bluetooth: Core ver 2.22
[ 12.289625] NET: Registered protocol family 31
[ 12.289630] Bluetooth: HCI device and connection manager initialized
[ 12.289656] Bluetooth: HCI socket layer initialized
[ 12.289672] Bluetooth: L2CAP socket layer initialized
[ 12.289706] Bluetooth: SCO socket layer initialized
[ 12.302603] Bluetooth: HCI UART driver ver 2.3
[ 12.302616] Bluetooth: HCI UART protocol H4 registered
[ 12.302621] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 12.302782] Bluetooth: HCI UART protocol Broadcom registered
[ 12.555213] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 12.555220] Bluetooth: BNEP filters: protocol multicast
[ 12.555232] Bluetooth: BNEP socket layer initialized
[ 19.058664] EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Opts: (null)
[ 61.667200] random: crng init done
[ 439.641435] brcmfmac: brcmf_cfg80211_stop_ap: setting INFRA mode failed -7
pi@raspberrypi:~ $
UPDATE 3
I checked here for configuration updates as it changed in february, and I found these 2 differences:
1 ) the use of systemctl instead of service for starting dnsmasq and hostapd
2 ) the result of sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
is now:
# Generated by iptables-save v1.4.21 on Sat Jun 2 01:53:46 2018
*nat
:PREROUTING ACCEPT [8:463]
:INPUT ACCEPT [2:146]
:OUTPUT ACCEPT [9:889]
:POSTROUTING ACCEPT [9:889]
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Sat Jun 2 01:53:46 2018
instead of:
# Generated by iptables-save v1.4.21 on Thu Jan 25 23:41:32 2018
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [1:40]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
# Completed on Thu Jan 25 23:41:32 2018
UPDATE 4
my kernel version as requested by @eftshift0
uname -a
Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux
UPDATE 5
dpkg -l raspberrypi-kernel
:
1.20170703-1
/etc/apt/sorces.list
:
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi