Create Access Point with mwifiex_pcie driver - wifi

My configuration :
- i.MX6Quad
- kernel stable 5.5.6
- wifi module : mwifiex_pcie
- firmware : pcieuart8997_combo_v4.bin (from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/)
I'm trying to create a access point but when i'm launch hostapd, I always get same error from the firmware :
$ hostapd -B /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
[ 855.225833] mwifiex_pcie 0000:01:00.0: CMD_RESP: cmd 0xf7 error, result=0x2
mlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Process used :
1) Load wifi module
$ modprobe mwifiex_pcie
[ 300.412095] mwifiex_pcie 0000:01:00.0: enabling device (0140 -> 0142)
[ 300.418982] mwifiex_pcie: PCI memory map Virt0: 52dcd608 PCI memory map Virt2: 6cc1cdc2
[ 301.422006] mwifiex_pcie 0000:01:00.0: info: FW download over, size 632240 bytes
[ 302.262589] mwifiex_pcie 0000:01:00.0: WLAN FW is active
[ 302.324072] mwifiex_pcie 0000:01:00.0: Unknown api_id: 3
[ 302.329794] mwifiex_pcie 0000:01:00.0: Unknown api_id: 4
[ 302.335983] mwifiex_pcie 0000:01:00.0: Unknown GET_HW_SPEC TLV type: 0x217
[ 302.375282] mwifiex_pcie 0000:01:00.0: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p179)
[ 302.383574] mwifiex_pcie 0000:01:00.0: driver_version = mwifiex 1.0 (16.68.1.p179)
2) Set interfaces
$ ip link set mlan0 up
$ /sbin/ifup -a
$ ifconfig mlan0
mlan0 Link encap:Ethernet HWaddr C0:EE:XX:XX:XX:XX
inet addr:192.168.0.5 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
My interfaces file :
auto lo
iface lo inet loopback
auto mlan0
iface mlan0 inet static
address 192.168.0.5
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4 192.168.0.1
3) Configure hostapd.conf
# interface wlan du Wi-Fi
interface=mlan0
# nl80211 avec tous les drivers Linux mac80211
driver=nl80211
# Nom du spot Wi-Fi
ssid=my_access_point
# mode Wi-Fi (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
hw_mode=g
country_code=FR
# AC
ieee80211d=1
channel=6
macaddr_acl=0
# Wi-Fi authentication required
auth_algs=1
# Beacon interval in kus (1.024 ms)
beacon_int=100
# DTIM (delivery trafic information message)
dtim_period=2
# Maximum number of stations allowed in station table
max_num_sta=255
# Fragmentation threshold; 2346 = disabled (default)
fragm_threshold=-1
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2i
wpa=2
wpa_passphrase=wifipassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
4) Launch hostapd
hostapd -B /etc/hostapd.conf
Configuration file: /etc/hostapd.conf
[ 855.225833] mwifiex_pcie 0000:01:00.0: CMD_RESP: cmd 0xf7 error, result=0x2
mlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Next I have a dump of firmware :
[ 847.848390] mwifiex_pcie 0000:01:00.0: mwifiex_cmd_timeout_func: Timeout cmd id = 0xb0, act = 0x1
[ 847.857885] mwifiex_pcie 0000:01:00.0: num_data_h2c_failure = 0
[ 847.863914] mwifiex_pcie 0000:01:00.0: num_cmd_h2c_failure = 0
[ 847.869835] mwifiex_pcie 0000:01:00.0: is_cmd_timedout = 1
[ 847.875406] mwifiex_pcie 0000:01:00.0: num_tx_timeout = 0
[ 847.880887] mwifiex_pcie 0000:01:00.0: last_cmd_index = 3
[ 847.886344] mwifiex_pcie 0000:01:00.0: last_cmd_id: 0c 01 1e 00 20 00 b0 00 0c 01
[ 847.893860] mwifiex_pcie 0000:01:00.0: last_cmd_act: 01 00 00 00 08 00 01 00 01 00
[ 847.901458] mwifiex_pcie 0000:01:00.0: last_cmd_resp_index = 2
[ 847.907320] mwifiex_pcie 0000:01:00.0: last_cmd_resp_id: 0c 81 1e 80 20 80 1e 80 0c 81
[ 847.915266] mwifiex_pcie 0000:01:00.0: last_event_index = 4
[ 847.920868] mwifiex_pcie 0000:01:00.0: last_event: 58 00 0b 00 0a 00 0b 00 0a 00
[ 847.928292] mwifiex_pcie 0000:01:00.0: data_sent=0 cmd_sent=1
[ 847.934066] mwifiex_pcie 0000:01:00.0: ps_mode=1 ps_state=0
[ 847.942382] mwifiex_pcie 0000:01:00.0: ===mwifiex driverinfo dump start===
[ 847.949646] mwifiex_pcie 0000:01:00.0: info: MWIFIEX VERSION: mwifiex 1.0 (16.68.1.p179)
[ 847.957861] mwifiex_pcie 0000:01:00.0: PCIE register dump start
[ 847.963863] mwifiex_pcie 0000:01:00.0: pcie scratch register:
[ 847.969757] mwifiex_pcie 0000:01:00.0: reg:0xcf0, value=0xfedcba00
[ 847.969757] reg:0xcf8, value=0x12f00fc
[ 847.969757] reg:0xcfc, value=0x19b9c07
[ 847.969757]
[ 847.984976] mwifiex_pcie 0000:01:00.0: PCIE register dump end
[ 847.990935] mwifiex_pcie 0000:01:00.0: ===mwifiex driverinfo dump end===
[ 847.997659] mwifiex_pcie 0000:01:00.0: == mwifiex firmware dump start ==
[ 849.768341] mwifiex_pcie 0000:01:00.0: cmd_wait_q terminated: -110
[ 849.775003] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.781719] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.788861] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.795435] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.801870] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.808277] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.814650] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.857862] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.864329] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.870829] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.877206] mwifiex_pcie 0000:01:00.0: 11D: failed to enable 11D
[ 849.883378] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.889816] mwifiex_pcie 0000:01:00.0: Failed to set AP configuration
[ 849.896419] mwifiex_pcie 0000:01:00.0: Failed to start AP
[ 849.902571] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.909010] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.915294] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.921777] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.928127] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.934501] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.941019] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 849.947459] mwifiex_pcie 0000:01:00.0: deleting the crypto keys
[ 849.999480] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.039425] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.045877] mwifiex_pcie 0000:01:00.0: mlan0: changing to 2 not supported
[ 850.054252] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.061013] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.067634] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.074322] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.088987] mwifiex_pcie 0000:01:00.0: mlan0: changing to 2 not supported
[ 850.096716] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.103094] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.109793] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
[ 850.116133] mwifiex_pcie 0000:01:00.0: PREP_CMD: FW is in bad state
Does anyone have any idea what could be causing this ? And how to fix it ?
I've searched on many topics but I couldn't find something to resolve this.
Thank you for your time

If someone had the same issue, here the solution :
1) Load wifi module
modprobe mwifiex_pcie
2) Set interfaces
To create a access point with the mwifiex_pcie driver, we need to add another interface : uap0
iw dev mlan0 interface add uap0 type __ap
We should have : lo, mlan0 and uap0 with $ifconfig
3) Then, configure your interfaces file and hostapd.conf file with the interface uap0
Links used to resolve this :
- http://linuxwireless.sipsolutions.net/en/users/Drivers/mwifiex/__v9.html

Related

beaglebone black adc "in_voltageX_raw': Resource temporarily unavailable"

I struggle to get readings from analog inputs on the bbb.
cat /sys/bus/iio/devices/iio:device0/in_voltage5_raw
cat: '/sys/bus/iio/devices/iio:device0/in_voltage5_raw': Resource temporarily unavailable
cat /etc/dogtag
BeagleBoard.org Debian Buster Console Image 2020-05-18
uname -a
Linux beaglebone 5.4.38-ti-r8 #1buster SMP PREEMPT Sat May 9 09:53:15 UTC 2020 armv7l GNU/Linux
sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[029041f6866049997bbfd2c7667b3c6e8c95201c]
eeprom:[A335BNLT000C1716BBBG0543]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster Console Image 2020-05-18]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g31a8ae0206]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
kernel:[5.4.38-ti-r8]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[disable_uboot_overlay_wireless=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20201119.0-0~buster+20201123]
WARNING:pkg:[bb-wl18xx-firmware]:[NOT_INSTALLED]
pkg:[kmod]:[26-1]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input bluetooth netdev gpio pwm eqep remoteproc admin spi iio i2c docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 10.849708] remoteproc remoteproc0: wkup_m3 is available
[ 11.073021] remoteproc remoteproc1: 4a334000.pru is available
[ 11.074751] remoteproc remoteproc2: 4a338000.pru is available
[ 11.078998] remoteproc remoteproc0: powering up wkup_m3
[ 11.079139] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 11.083282] remoteproc remoteproc0: remote processor wkup_m3 is now up
dmesg | grep pru
[ 11.073021] remoteproc remoteproc1: 4a334000.pru is available
[ 11.073193] pru-rproc 4a334000.pru: PRU rproc node /ocp/interconnect#4a000000/segment#0/target-module#300000/pruss#0/pru#34000 probed successfully
[ 11.074751] remoteproc remoteproc2: 4a338000.pru is available
[ 11.074891] pru-rproc 4a338000.pru: PRU rproc node /ocp/interconnect#4a000000/segment#0/target-module#300000/pruss#0/pru#38000 probed successfully
dmesg | grep pinctrl-single
[ 1.762133] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[ 1.776892] gpio-of-helper ocp:cape-universal: ready
END
Anyone an idea?
thanks
Ju
I think you are using SD Card to boot, right?
...
Well, you have two, different versions of uboot on the SD Card and on the eMMC. The eMMC holds presence over the SD Card for uboot when booting.
If you can and if you do not mind losing the data on your eMMC, you can wipe the eMMC of data or press the S2/Boot button while applying power for about 5 seconds.
Also, I thought the ADC lines on the chip were already powered when booting. I do not think you need the overlay for ADC. Please let me know if this works for you.

Docker container Xdebug (php-fpm) - There was a problem sending 179 bytes on socket 6: Broken pipe

I am trying to set up Xdebug 3 in a docker container and capture a break point in Visual Studio Code.
My xdebug log:
[7] Log opened at 2021-02-16 16:12:12.027862
[7] [Step Debug] INFO: Checking remote connect back address.
[7] [Step Debug] INFO: Checking header 'HTTP_X_FORWARDED_FOR'.
[7] [Step Debug] INFO: Checking header 'REMOTE_ADDR'.
[7] [Step Debug] INFO: Client host discovered through HTTP header, connecting to 172.26.0.1:9099.
[7] [Step Debug] INFO: Connected to debugging client: 172.26.0.1:9099 (from REMOTE_ADDR HTTP header). :-)
[7] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/public/index.php" language="PHP" xdebug:language_version="7.3.27" protocol_version="1.0" appid="7" idekey="VSCODE"><engine version="3.0.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[7] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[7] [Step Debug] WARN: 2021-02-16 16:12:12.039287: There was a problem sending 179 bytes on socket 6: Broken pipe.
xdebug.ini configuration:
[xdebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
xdebug.client_port = 9099
xdebug.client_host = host.docker.internal
xdebug.idekey = VSCODE
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.discover_client_host = true
xdebug.log = /var/tmp/xdebug.log
Visual Studio Code configuration (json.config)
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9099,
"log": true,
"externalConsole": false,
"pathMappings": {
"/var/www/public": "${workspaceFolder}",
},
"ignore": [
"**/vendor/**/*.php"
]
},
]
}
I will be grateful for your help, I have run out of ideas why it doesn't work.
host.docker.internal - mac only
172.17.0.1/16 brd 172.17.255.255 scope global docker0
probably
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so
xdebug.mode=debug
xdebug.client_port = 9003
xdebug.client_host=172.17.0.1
xdebug.start_with_request=yes
xdebug.extended_info=1
xdebug.remote_handler="dbgp"
xdebug.remote_connect_back=0
xdebug.idekey = "VSCODE"

fluentbit fails to communicate with fluentd

I am trying a simple fluentbit / fluentd test with ipv6, but it is not working.
Configuration from fluentbit side:
[SERVICE]
Flush 5
Daemon off
[INPUT]
Name cpu
Tag fluent_bit
[OUTPUT]
Name forward
Match *
Host fd00:7fff:0:2:9c43:9bff:fe00:bb
Port 24000
Configuration from fluentd side:
<source>
type forward
bind ::
port 24000
</source>
~
<match fluent_bit>
type stdout
</match>
I start up fluentd with command: /usr/sbin/td-agent -c test.conf
Then, I start up fluentbit with command: /opt/td-agent-bit/bin/td-agent-bit -c test.conf
The output shows that there is a problem with communication:
Fluent Bit v1.6.6
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
[2020/11/29 01:53:49] [ info] [engine] started (pid=142)
[2020/11/29 01:53:49] [ info] [storage] version=1.0.6, initializing...
[2020/11/29 01:53:49] [ info] [storage] in-memory
[2020/11/29 01:53:49] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/11/29 01:53:49] [ info] [sp] stream processor started
[2020/11/29 01:53:53] [error] [io] connection #27 failed to: fd00:7fff:0:2:9c43:9bff:fe00:bb:24000
[2020/11/29 01:53:53] [error] [output:forward:forward.0] no upstream connections available
[2020/11/29 01:53:53] [ warn] [engine] failed to flush chunk '142-1606614829.871139401.flb', retry in 8 seconds: task_id=0, input=cpu.0 > output=forward.0
[2020/11/29 01:53:58] [error] [io] connection #28 failed to: fd00:7fff:0:2:9c43:9bff:fe00:bb:24000
[2020/11/29 01:53:58] [error] [output:forward:forward.0] no upstream connections available
[2020/11/29 01:53:58] [ warn] [engine] failed to flush chunk '142-1606614833.871418916.flb', retry in 6 seconds: task_id=1, input=cpu.0 > output=forward.0
[2020/11/29 01:54:01] [error] [io] connection #29 failed to: fd00:7fff:0:2:9c43:9bff:fe00:bb:24000
[2020/11/29 01:54:01] [error] [output:forward:forward.0] no upstream connections available
[2020/11/29 01:54:01] [ warn] [engine] chunk '142-1606614829.871139401.flb' cannot be retried: task_id=0, input=cpu.0 > output=forward.0
However when I run the command without using the config file but passing the parameters, it works:
# /opt/td-agent-bit/bin/td-agent-bit -i cpu -t fluent_bit -o forward://[fd00:7fff:0:2:9c43:9bff:fe00:bb]:24000 -v
Fluent Bit v1.6.6
* Copyright (C) 2019-2020 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
[2020/11/29 01:56:53] [ info] Configuration:
[2020/11/29 01:56:53] [ info] flush time | 5.000000 seconds
[2020/11/29 01:56:53] [ info] grace | 5 seconds
[2020/11/29 01:56:53] [ info] daemon | 0
[2020/11/29 01:56:53] [ info] ___________
[2020/11/29 01:56:53] [ info] inputs:
[2020/11/29 01:56:53] [ info] cpu
[2020/11/29 01:56:53] [ info] ___________
[2020/11/29 01:56:53] [ info] filters:
[2020/11/29 01:56:53] [ info] ___________
[2020/11/29 01:56:53] [ info] outputs:
[2020/11/29 01:56:53] [ info] forward.0
[2020/11/29 01:56:53] [ info] ___________
[2020/11/29 01:56:53] [ info] collectors:
[2020/11/29 01:56:53] [ info] [engine] started (pid=151)
[2020/11/29 01:56:53] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2020/11/29 01:56:53] [debug] [storage] [cio stream] new stream registered: cpu.0
[2020/11/29 01:56:53] [ info] [storage] version=1.0.6, initializing...
[2020/11/29 01:56:53] [ info] [storage] in-memory
[2020/11/29 01:56:53] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/11/29 01:56:53] [debug] [forward:forward.0] created event channels: read=20 write=21
[2020/11/29 01:56:53] [debug] [router] default match rule cpu.0:forward.0
[2020/11/29 01:56:53] [ info] [sp] stream processor started
[2020/11/29 01:56:57] [debug] [task] created task=0x7f9b4e8580a0 id=0 OK
[2020/11/29 01:56:57] [debug] [output:forward:forward.0] request 5525 bytes to flush
[2020/11/29 01:56:57] [debug] [upstream] KA connection #27 to fd00:7fff:0:2:9c43:9bff:fe00:bb:24000 is now available
[2020/11/29 01:56:57] [debug] [task] destroy task=0x7f9b4e8580a0 (task_id=0)
[2020/11/29 01:57:02] [debug] [task] created task=0x7f9b4e8580a0 id=0 OK
[2020/11/29 01:57:02] [debug] [output:forward:forward.0] request 4420 bytes to flush
Does anyone understand what the difference is and how i can rectify this problem?
I resolved this issue by taking the source from the latest fluent-bit project and compiling it. Then I replaced /usr/sbin/td-agent-bit with the newly built fluent-bit (as td-agent).

ECS Agent starting Docker container doesn't complete. Manual start successful

I followed the ECS Getting Started tutorial but the ECS Agent isn't getting the container started. When I start the image manually on the same instance it starts fine.
The image is a Spring Boot web application with a single endpoint on / that returns the string "Hello world!!". The container runs fine locally, and also runs fine on a CentOS EC2 instance I've created. The endpoint is available publicly when I run the docker image on the CentOS EC2 instance.
The ECS Instance has security groups created by the wizard and has port 80 open. I added port 22 for SSH access.
When I SSH into the ECS instance to see the Docker logs for my container, and it looks like it's hanging during the entrypoint execution.
Here are the Docker logs for the hanging instance:
[ec2-user#ip-10-0-0-156 ~]$ docker logs --tail 100 107d4cf04dd8
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.2.RELEASE)
2016-11-25 17:36:22.505 INFO 1 --- [ main] ecstest.Application : Starting Application on 107d4cf04dd8 with PID 1 (/ecstest-1.0-SNAPSHOT.jar started by root in /)
2016-11-25 17:36:22.546 INFO 1 --- [ main] ecstest.Application : No active profile set, falling back to default profiles: default
2016-11-25 17:36:23.059 INFO 1 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#6d21714c: startup date [Fri Nov 25 17:36:23 UTC 2016]; root of context hierarchy
2016-11-25 17:36:30.972 INFO 1 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-11-25 17:36:31.014 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-11-25 17:36:31.016 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6
2016-11-25 17:36:31.464 INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-11-25 17:36:31.464 INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 8458 ms
At first it seems like an application error in my container image, but when I stop the docker process and run the same image manually, the output is as expected and I can reach my endpoint from outside the instance as expected.
[ec2-user#ip-10-0-1-124 ~]$ docker stop -t 1 4d2401d7db93 && docker run -p 80:8080 -d ############.dkr.ecr.us-west-2.amazonaws.com/ecstest
4d2401d7db93
db8cffa89995401d9314d7d70e954f09c7fde972a5e6a423615827d8c47b9d10
[ec2-user#ip-10-0-1-124 ~]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
db8cffa89995 ############.dkr.ecr.us-west-2.amazonaws.com/ecstest "java -jar ecstest-1." 10 seconds ago Up 9 seconds 0.0.0.0:80->8080/tcp small_gates
85bd18480c99 amazon/amazon-ecs-agent:latest "/agent" 11 minutes ago Up 11 minutes ecs-agent
[ec2-user#ip-10-0-1-124 ~]$ docker logs --tail 1000 db8cffa89995
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.2.RELEASE)
2016-11-25 18:06:57.960 INFO 1 --- [ main] ecstest.Application : Starting Application on db8cffa89995 with PID 1 (/ecstest-1.0-SNAPSHOT.jar started by root in /)
2016-11-25 18:06:58.004 INFO 1 --- [ main] ecstest.Application : No active profile set, falling back to default profiles: default
2016-11-25 18:06:58.578 INFO 1 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#6d21714c: startup date [Fri Nov 25 18:06:58 UTC 2016]; root of context hierarchy
2016-11-25 18:07:05.784 INFO 1 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-11-25 18:07:05.866 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-11-25 18:07:05.876 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.6
2016-11-25 18:07:06.283 INFO 1 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-11-25 18:07:06.283 INFO 1 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 7753 ms
2016-11-25 18:07:07.026 INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-11-25 18:07:07.031 INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-11-25 18:07:07.031 INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-11-25 18:07:07.032 INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-11-25 18:07:07.033 INFO 1 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-11-25 18:07:08.432 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#6d21714c: startup date [Fri Nov 25 18:06:58 UTC 2016]; root of context hierarchy
2016-11-25 18:07:08.786 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[],methods=[GET]}" onto public java.lang.String ecstest.Application.get()
2016-11-25 18:07:08.800 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-11-25 18:07:08.801 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-11-25 18:07:09.036 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-25 18:07:09.036 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-25 18:07:09.204 INFO 1 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-11-25 18:07:09.893 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-11-25 18:07:10.201 INFO 1 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-11-25 18:07:10.216 INFO 1 --- [ main] ecstest.Application : Started Application in 14.385 seconds (JVM running for 16.522)
Any ideas why the ECS Agent isn't getting my application started?
Task Definition JSON
{
"attributes": null,
"requiresAttributes": [
{
"value": null,
"name": "com.amazonaws.ecs.capability.ecr-auth",
"targetId": null,
"targetType": null
}
],
"taskDefinitionArn": "arn:aws:ecs:us-west-2:############:task-definition/DcTaskDefinition:4",
"networkMode": "bridge",
"status": "ACTIVE",
"revision": 4,
"taskRoleArn": null,
"containerDefinitions": [
{
"volumesFrom": [],
"memory": 128,
"extraHosts": null,
"dnsServers": null,
"disableNetworking": null,
"dnsSearchDomains": null,
"portMappings": [
{
"hostPort": 80,
"containerPort": 8080,
"protocol": "tcp"
}
],
"hostname": null,
"essential": true,
"entryPoint": null,
"mountPoints": [],
"name": "DcContainer",
"ulimits": null,
"dockerSecurityOptions": null,
"environment": [],
"links": null,
"workingDirectory": null,
"readonlyRootFilesystem": null,
"image": "############.dkr.ecr.us-west-2.amazonaws.com/ecstest:latest",
"command": null,
"user": null,
"dockerLabels": null,
"logConfiguration": null,
"cpu": 0,
"privileged": null,
"memoryReservation": null
}
],
"placementConstraints": [],
"volumes": [],
"family": "DcTaskDefinition"
}
The memory key in the Task Definition JSON imposes a hard memory limit on the container. When a container tries to exceed that limit, the Docker daemon is supposed to kill it.
I'm not sure whether this can cause your container to get "stuck", however that's the only important difference I see between how your container runs when ECS runs it and how it runs from the command line.
So, I would try to set the memory value to at least 300, or use the memoryReservation key instead which imposes a soft memory limit.
More information on the difference between hard and soft memory limits can be found in the official ECS documentation.

Linux enc28j60 driver always times out on transmit

I've wired up an ENC28J60 module with an SPI interface to a Beaglebone Black development board running Linux 3.8, but I cannot get the device to TX (or RX) anything. Every attempt to TX times out and increments the TX errors.
Originally, the driver that shipped with the Linux kernel would not allow me to bring the link up. After a bunch of debugging, I found that if I waited some amount of time during board initialization, that I could get the link to come up. The patch to the driver was in the enc28j60_check_link_status function and was more or less the following.
unsigned long timeout = jiffies + 1*HZ;
while ((enc28j60_phy_read(priv, PHSTAT2) & PHSTAT2_LSTAT) == 0) {
if (time_after(jiffies, timeout)) {
if (netif_msg_drv(priv))
break;
}
schedule();
}
Now, I can reliably load the driver and configure the interface like so.
ifconfig rename3 down
ethtool -s rename3 msglvl 0xffff
ethtool -s rename3 speed 10 duplex full
ifconfig rename3 up
I've customized the ENC28J60's driver to do a bunch of additional printk while I've been searching for the root of the problem. I get the following after bringing the interface up.
Feb 1 00:22:48 arm kernel: [ 100.001942] enc28j60: HELLO WORLD
Feb 1 00:22:48 arm kernel: [ 100.002092] enc28j60: enc28j60_net_open() enter
Feb 1 00:22:48 arm kernel: [ 100.002119] enc28j60: enc28j60_hw_disable() enter
Feb 1 00:22:48 arm kernel: [ 100.002315] enc28j60: enc28j60_hw_init() enter
Feb 1 00:22:48 arm kernel: [ 100.002342] enc28j60: enc28j60_hw_init() - FullDuplex
Feb 1 00:22:48 arm kernel: [ 100.002366] enc28j60: enc28j60_soft_reset() enter
Feb 1 00:22:48 arm kernel: [ 100.006957] enc28j60: nolock_rxfifo_init() enter
Feb 1 00:22:48 arm kernel: [ 100.007117] enc28j60: erxrdpt_workaround() enter
Feb 1 00:22:48 arm kernel: [ 100.007373] enc28j60: nolock_txfifo_init() enter
Feb 1 00:22:48 arm kernel: [ 100.007807] enc28j60: chip RevID: 0x06
Feb 1 00:22:48 arm kernel: [ 100.009680] enc28j60: enc28j60_phy_write() enter
Feb 1 00:22:48 arm kernel: [ 100.010950] enc28j60: enc28j60_phy_write() enter
Feb 1 00:22:48 arm kernel: [ 100.011335] enc28j60: enc28j60_phy_write() enter
Feb 1 00:22:48 arm kernel: [ 100.014973] enc28j60 Hw initialized.
Feb 1 00:22:48 arm kernel: [ 100.014973] HwRevID: 0x06
Feb 1 00:22:48 arm kernel: [ 100.014973] Cntrl: ECON1 ECON2 ESTAT EIR EIE
Feb 1 00:22:48 arm kernel: [ 100.014973] 0x03 0x80 0x01 0x00 0x00
Feb 1 00:22:48 arm kernel: [ 100.014973] MAC : MACON1 MACON3 MACON4
Feb 1 00:22:48 arm kernel: [ 100.014973] 0x0d 0x33 0x00
Feb 1 00:22:48 arm kernel: [ 100.014973] Rx : ERXST ERXND ERXWRPT ERXRDPT ERXFCON EPKTCNT MAMXFL
Feb 1 00:22:48 arm kernel: [ 100.014973] 0x0000 0x19ff 0x0000 0x19ff 0xa1 0x00 0x05ee
Feb 1 00:22:48 arm kernel: [ 100.014973] Tx : ETXST ETXND MACLCON1 MACLCON2 MAPHSUP
Feb 1 00:22:48 arm kernel: [ 100.014973] 0x1a00 0x1fff 0x0f 0x37 0x10
Feb 1 00:22:48 arm kernel: [ 100.015073] enc28j60: enc28j60_set_hw_macaddr() enter
Feb 1 00:22:48 arm kernel: [ 100.015105] enc28j60: rename3: Setting MAC address to ee:31:66:60:5a:52
Feb 1 00:22:48 arm kernel: [ 100.015530] enc28j60: enc28j60_hw_enable() enter
Feb 1 00:22:48 arm kernel: [ 100.015556] enc28j60: enc28j60_hw_enable() enabling interrupts.
Feb 1 00:22:48 arm kernel: [ 100.015578] enc28j60: enc28j60_phy_write() enter
Feb 1 00:22:48 arm kernel: [ 100.017800] enc28j60: enc28j60_check_link_status() enter
Feb 1 00:22:48 arm kernel: [ 100.020726] enc28j60: enc28j60_check_link_status() PHSTAT1: 1800, PHSTAT2: 0200
Feb 1 00:22:48 arm kernel: [ 100.020760] enc28j60:enc28j60_check_link_status() polling PHSTAT2_LSTAT != 0
Feb 1 00:22:48 arm kernel: [ 100.069286] enc28j60:enc28j60_check_link_status() reg/link now 1536/1024
Feb 1 00:22:48 arm kernel: [ 100.069319] enc28j60:enc28j60_check_link_status() have link! setting carrier on
Feb 1 00:22:48 arm kernel: [ 100.069362] net rename3: link up - Full duplex
Feb 1 00:22:58 arm kernel: [ 109.989281] enc28j60: enc28j60_send_packet() enter
Feb 1 00:22:58 arm kernel: [ 109.989329] enc28j60: enc28j60_send_packet() enter
Feb 1 00:22:58 arm kernel: [ 109.989411] enc28j60: enc28j60_tx_work_handler() enter
Feb 1 00:22:58 arm kernel: [ 109.989437] enc28j60: enc28j60_hw_tx() enter
Feb 1 00:22:58 arm kernel: [ 109.989459] enc28j60: Tx Packet Len:70
Feb 1 00:22:58 arm kernel: [ 109.989481] enc28j60: enc28j60_hw_tx - packet len:70
Feb 1 00:22:58 arm kernel: [ 109.989517] pk data: 00000000: 33 33 00 00 00 02 ee 31 66 60 5a 52 86 dd 60 00 33.....1f`ZR..`.
Feb 1 00:22:58 arm kernel: [ 109.989548] pk data: 00000010: 00 00 00 10 3a ff fe 80 00 00 00 00 00 00 ec 31 ....:..........1
Feb 1 00:22:58 arm kernel: [ 109.989576] pk data: 00000020: 66 ff fe 60 5a 52 ff 02 00 00 00 00 00 00 00 00 f..`ZR..........
Feb 1 00:22:58 arm kernel: [ 109.989605] pk data: 00000030: 00 00 00 00 00 02 85 00 21 65 00 00 00 00 01 01 ........!e......
Feb 1 00:22:58 arm kernel: [ 109.989633] pk data: 00000040: ee 31 66 60 5a 52 .1f`ZR
Feb 1 00:22:58 arm kernel: [ 109.989655] enc28j60: enc28j60_packet_write() enter
Feb 1 00:22:58 arm kernel: [ 109.990379] enc28j60: enc28j60_packet_write() after control byte ERWPT:0x1a01
Feb 1 00:22:58 arm kernel: [ 109.990406] enc28j60: spi_write_buf() enter
Feb 1 00:22:58 arm kernel: [ 109.990571] enc28j60: enc28j60_packet_write() spi_write returns 0
Feb 1 00:22:58 arm kernel: [ 109.990761] enc28j60: enc28j60_packet_write() after write packet ERWPT:0x1a47, len=70
Feb 1 00:23:18 arm kernel: [ 129.979247] enc28j60: enc28j60_tx_timeout() enter
Feb 1 00:23:18 arm kernel: [ 129.979313] net rename3: enc28j60 tx timeout
I've narrowed it down with additional print statements to a call to spi_sync in spi_read_buf. Does anyone with knowledge of Linux network drivers or Microchip's ENC28J60 know what I should be looking into to resolve this problem?

Resources