Skip to content

Instantly share code, notes, and snippets.

@lowellmower
Last active June 22, 2019 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lowellmower/e9ae64c713d0649c066af99050d4f448 to your computer and use it in GitHub Desktop.
Save lowellmower/e9ae64c713d0649c066af99050d4f448 to your computer and use it in GitHub Desktop.
Unum Build Version and Debugging

Current Issue

opkg info from the unadulterated b1300 lent for the challenge claims that the version of unum installed is v2-1, see below:

root@MINIM:~# opkg info unum
Package: unum
Version: v2-1
Depends: libc, libpthread, librt, libuci, jansson, libiwinfo, libcurl, libmbedtls
Status: install user installed
Architecture: arm_cortex-a7_neon-vfpv4
Installed-Time: 1534405875

This version follows no version convention I see in any of the minim repos. I spent some time digging and poking to see how or where this version style might be set during builds but can't seem to locate this style. From building using the feeds repo and openWRT toolchain, it seems to me the version should be pulled from the makefile contained therein.

This wouldn't be a big deal if it weren't for the fact that trying to install a package with opkg from an .ipk file built using the latest from minim-openwrt-feed results in a build version of 2019.2.0 which it identifies as a regression from v2-1 by way of a minor version (if we were versioning semantically).

root@MINIM:~# opkg install /tmp/unum_*.ipk
Not downgrading package unum on root from v2-1 to 2019.2.0.

No worries, I figure I've built everything with latest and would be building my forked version when I go to make code changes anyhow so I forced a downgrade with opkg flags, passing my freshly built unum_2019.2.0_arm_cortex-a7_neon-vfpv4.ipk as the argument.

root@MINIM:~# opkg --force-downgrade install /tmp/unum_*.ipk
Downgrading unum on root from v2-1 to 2019.2.0...
kill: you need to specify whom to kill
Stopped
Removing obsolete file /sbin/get_auth_info_key.sh.
Removing obsolete file /sbin/switch_mode.sh.
Removing obsolete file /etc/init.d/rep_conn.
Removing obsolete file /etc/init.d/unum-updater.
Removing obsolete file /sbin/m_functions.sh.
Removing obsolete file /etc/unum/release_properties.json.
Removing obsolete file /etc/unum/system.conf.
Removing obsolete file /etc/unum/.ssh/id_rsa.
Removing obsolete file /sbin/create_on_board_sta.sh.
Removing obsolete file /sbin/onboard.sh.
Removing obsolete file /etc/init.d/check_wireless.
Removing obsolete file /sbin/set_default_password.sh.
Removing obsolete file /etc/unum/.ssh/authorized_keys.
Removing obsolete file /sbin/set_defaults.sh.
Removing obsolete file /etc/init.d/unum-support.
Removing obsolete file /usr/bin/restart_config.sh.
Removing obsolete file /usr/bin/fix_lan_addr.sh.
Removing obsolete file /etc/unum/.ssh/known_hosts.
Removing obsolete file /sbin/check_rep_connection.sh.
Removing obsolete file /etc/init.d/fix_lan_addr.
Removing obsolete file /etc/init.d/set_defaults.
Removing obsolete file /etc/init.d/restart_config.
Removing obsolete file /sbin/set_default_ssid.sh.
Removing obsolete file /sbin/run_on_board_sta.sh.
Configuring unum.
No unum process instance found for: monitor
No unum process instance found for: agent

The install appears to have worked and now running the proper version as tagged in both GitHub repos.

root@MINIM:~# opkg info unum
Package: unum
Version: 2019.2.0
Depends: libc, libpthread, librt, libuci, jansson, libiwinfo, libcurl, libmbedtls
Status: install user installed
Architecture: arm_cortex-a7_neon-vfpv4
Installed-Time: 1561229022

Unfortunately however, hardware is no longer registered via the UI and from the looks of the logs, the agent appears to be having a bad time:

http_req: 0037d030 PUT url <https://api.minim.co/v3/unums/e4:95:6e:45:13:9a/activate>
http_req: 0037d030 hdr: 'Content-Type: application/json'
http_req: 0037d030 hdr: 'Accept: application/json'
http_req: 0037d030 len: 159, data: '{"hardware_type":"openwrt_generic","uptime":67,"firmware_version":"2019.2.0","unum_agent_version":"2019.2.0","start_reason":"normal_start","developer_build":1}'
http_req: 0037d030 OK, reply: '{"errors":["Attempting to activate wrong hardware kind!"]}'
http_req: 0037d030 rsp code: 403

What I've Tried

  • SIGHUP'd the process
  • Rebooted the OS via the web UI
  • Hard reboot via power disconnect
  • Scanned activate.c for hints

How My .ipk Was Built

From a vagrant coordinated Virtual Box image of debian/strech the following commands were run:

[vagrant]:> cd openwrt
[vagrant]:> echo "src-git minim https://github.com/MinimSecure/minim-openwrt-feed" >> feeds.config.default
[vagrant]:> ./scripts/feeds update -a
[vagrant]:> make menuconfig
    # in menuconfig select the appropriate target system which in the case of
    # our building for the gl.Inet b1300 is 'Qualcomm Atheros IPQ40XX'
    # also proceed to Network section on the home screen and select 'Unum' with
    # 'Y' which will place an '*' next to the package. After, select save and
    # and write to the default config location selected by menuconfig
[vagrant]:> make download    
[vagrant]:> ./scripts/feeds update -a
[vagrant]:> ./scripts/feeds install -a
[vagrant]:> make

# scp openwrt-18.06.3/bin/packages/arm_cortex-a7_neon-vfpv4/minim/unum_2019.2.0_arm_cortex-a7_neon-vfpv4.ipk
# to the host and onto the b1300

/var/log/unum.log

From a power dosconnect reboot of the router

root@MINIM:~# cat /var/log/unum.log 
1063 2019.06.22 19:29:23 >>>>> Starting Unum v2019.2.0 <<<<<
1063 2019.06.22 19:29:23 util_platform_init: waiting up to 120sec for the interfaces to come up
1063 2019.06.22 19:29:23 util_platform_init: LAN is up
1063 2019.06.22 19:29:23 util_platform_init: WAN is up
1063 2019.06.22 19:29:23 lan_up=1... wan_up=1
1063 2019.06.22 19:29:23 util_device_mac: device base MAC: e4:95:6e:45:13:9a
1071 2019.06.22 19:29:23 thread_start_wrapper: starting thread timers
1072 2019.06.22 19:29:23 thread_start_wrapper: starting thread conncheck
1071 2019.06.22 19:29:23 timers: started
1072 2019.06.22 19:29:23 conncheck: started
1072 2019.06.22 19:29:23 conncheck_update_state_event: state transition 0 -> 1, progress 0
1072 2019.06.22 19:29:23 conncheck_update_state_event: updating /tmp/provision_info.json, state 1, progress 0
1073 2019.06.22 19:29:23 thread_start_wrapper: starting thread devtelemetry
1063 2019.06.22 19:29:23 provision_init: already done, skipping
1075 2019.06.22 19:29:23 thread_start_wrapper: starting thread cmdproc
1075 2019.06.22 19:29:23 cmdproc: started
1075 2019.06.22 19:29:23 cmdproc: waiting for provision to complete
1075 2019.06.22 19:29:23 cmdproc: done waiting for provision
1076 2019.06.22 19:29:23 thread_start_wrapper: starting thread activate
1076 2019.06.22 19:29:23 activate: started
1076 2019.06.22 19:29:23 activate: waiting for conncheck to complete
1073 2019.06.22 19:29:23 dt_sender: started
1073 2019.06.22 19:29:23 dt_sender: waiting for activate to complete
1078 2019.06.22 19:29:23 thread_start_wrapper: starting thread config
1078 2019.06.22 19:29:23 config: started
1078 2019.06.22 19:29:23 config: waiting for activate to complete
1082 2019.06.22 19:29:23 thread_start_wrapper: starting thread tpcap
1082 2019.06.22 19:29:23 tpcap: started
1082 2019.06.22 19:29:23 tpcap: waiting for activate to complete
1080 2019.06.22 19:29:23 thread_start_wrapper: starting thread wireless
1079 2019.06.22 19:29:23 thread_start_wrapper: starting thread telemetry
1079 2019.06.22 19:29:23 telemetry: started
1079 2019.06.22 19:29:23 telemetry: waiting for activate to complete
1080 2019.06.22 19:29:23 wireless: started
1080 2019.06.22 19:29:23 wireless: waiting for activation to complete
1072 2019.06.22 20:36:52 conncheck_update_state_event: state transition 1 -> 1, progress 6
1072 2019.06.22 20:36:52 conncheck_update_state_event: updating /tmp/provision_info.json, state 1, progress 6
1072 2019.06.22 20:36:52 conncheck_update_state_event: state transition 1 -> 7, progress 0
1072 2019.06.22 20:36:52 conncheck_update_state_event: updating /tmp/provision_info.json, state 7, progress 0
1072 2019.06.22 20:36:52 conncheck: connectivity test completed, uptime 28 sec
1076 2019.06.22 20:36:52 activate: done waiting for conncheck
1076 2019.06.22 20:36:52 activate: waiting for provision to complete
1076 2019.06.22 20:36:52 activate: done waiting for provision
1072 2019.06.22 20:36:52 conncheck: done
1072 2019.06.22 20:36:52 thread_start_wrapper: thread conncheck terminated
1076 2019.06.22 20:36:53 activate: activation denied, code 403
1076 2019.06.22 20:36:53 activate: error, retrying in 10 sec
1076 2019.06.22 20:37:04 activate: activation denied, code 403
1076 2019.06.22 20:37:04 activate: error, retrying in 33 sec
1076 2019.06.22 20:37:38 activate: activation denied, code 403

http.log and error remain the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment