Skip to content

Crash when no wifi device found #270

@pasco1995

Description

@pasco1995

When comitup is started and there is no wifi device found it continues and crashes with IndexError: list index out of range when the first elemente of the wifi device list is accessed.

Installed debian package: https://packages.debian.org/trixie/comitup

/usr/sbin/comitup --info
version: 1.43

journalctl -b -u comitup

Jan 28 16:01:27 systemd[1]: Starting comitup.service - Comitup Wifi Management...
Jan 28 16:01:34 comitup[256]: comitup-no-wifi - No wifi devices found
Jan 28 16:01:34 comitup[256]: Traceback (most recent call last):
Jan 28 16:01:34 comitup[256]:   File "/usr/sbin/comitup", line 8, in <module>
Jan 28 16:01:34 comitup[256]:     sys.exit(main())
Jan 28 16:01:34 comitup[256]:              ~~~~^^
Jan 28 16:01:34 comitup[256]:   File "/usr/share/comitup/comitup/comitup.py", line 149, in main
Jan 28 16:01:34 comitup[256]:     statemgr.init_state_mgr(
Jan 28 16:01:34 comitup[256]:     ~~~~~~~~~~~~~~~~~~~~~~~^
Jan 28 16:01:34 comitup[256]:         conf,
Jan 28 16:01:34 comitup[256]:         ^^^^^
Jan 28 16:01:34 comitup[256]:     ...<5 lines>...
Jan 28 16:01:34 comitup[256]:         ],
Jan 28 16:01:34 comitup[256]:         ^^
Jan 28 16:01:34 comitup[256]:     )
Jan 28 16:01:34 comitup[256]:     ^
Jan 28 16:01:34 comitup[256]:   File "/usr/share/comitup/comitup/statemgr.py", line 200, in init_state_mgr
Jan 28 16:01:34 comitup[256]:     states.init_states(
Jan 28 16:01:34 comitup[256]:     ~~~~~~~~~~~~~~~~~~^
Jan 28 16:01:34 comitup[256]:         get_hosts(conf, data),
Jan 28 16:01:34 comitup[256]:         ^^^^^^^^^^^^^^^^^^^^^^
Jan 28 16:01:34 comitup[256]:         callbacks + [external_callback],
Jan 28 16:01:34 comitup[256]:         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 28 16:01:34 comitup[256]:         conf.ap_password,
Jan 28 16:01:34 comitup[256]:         ^^^^^^^^^^^^^^^^^
Jan 28 16:01:34 comitup[256]:     )
Jan 28 16:01:34 comitup[256]:     ^
Jan 28 16:01:34 comitup[256]:   File "/usr/share/comitup/comitup/states.py", line 430, in init_states
Jan 28 16:01:34 comitup[256]:     nmmon.init_nmmon()
Jan 28 16:01:34 comitup[256]:     ~~~~~~~~~~~~~~~~^^
Jan 28 16:01:34 comitup[256]:   File "/usr/share/comitup/comitup/nmmon.py",line 190, in init_nmmon
Jan 28 16:01:34 comitup[256]:     set_device_listeners(modemgr.get_ap_device(), modemgr.get_link_device())
Jan 28 16:01:34 comitup[256]:                          ~~~~~~~~~~~~~~~~~~~~~^^
Jan 28 16:01:34 comitup[256]:   File "/usr/share/comitup/comitup/modemgr.py", line 59, in get_ap_device
Jan 28 16:01:34 comitup[256]:     ap_device = devs[0]
Jan 28 16:01:34 comitup[256]:                 ~~~~^^^
Jan 28 16:01:34 comitup[256]: IndexError: list index out of range
Jan 28 16:01:34 systemd[1]: comitup.service: Main process exited, code=exited, status=1/FAILURE
Jan 28 16:01:34 systemd[1]: comitup.service: Failed with result 'exit-code'.
Jan 28 16:01:34 systemd[1]: Failed to start comitup.service - Comitup Wifi Management.

Quick fix is to start the service after the wifi network device came up. (In my case: Adding sys-subsystem-net-devices-wlan0.device to service file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions