DebuggingNetworkManager

Differences between revisions 54 and 55
Revision 54 as of 2023-03-09 08:20:23
Size: 4564
Editor: seb128
Comment: Debug hints for captive portal issues
Revision 55 as of 2023-06-27 20:08:50
Size: 4563
Editor: hellsworth
Comment: Updates for gathering logs
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
 * The similar reason/status code data for wpasupplicant is available here: [[http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob;f=src/common/ieee802_11_defs.h|ieee802_11_defs.h]]
Line 23: Line 21:
You can then follow developers' intructions on a bug report for the exact command line to use; or run it directly as such: You can then follow developers' intructions on a bug report for the exact command line to use; or run it directly as such.
Line 27: Line 25:
By default, the NetworkManager log level is set to info. You can use nmcli to modify the logging level:
Line 28: Line 28:
sudo /usr/lib/NetworkManager/debug-helper.py --nm debug $ sudo nmcli general logging level DEBUG domains ALL
Line 31: Line 31:
Then get the logs which will be written to /var/log/syslog. To disable it, pass '''info''' instead of '''debug''' in the above command, or reboot. You do not need to restart NetworkManager to begin seeing debug messages logged to journalctl. You can watch the NetworkManager logs:

{{{
$ sudo journalctl -f -u NetworkManager
}}}
Line 35: Line 39:
Manually run with debug enabled:
Line 36: Line 42:
sudo /usr/lib/NetworkManager/debug-helper.py --mm debug $ sudo /usr/sbin/ModemManager --debug
$ sudo /usr/sbin/NetworkManager --debug --log-level=DEBUG
Line 39: Line 46:
Then get the logs which will be written to /var/log/syslog. To disable it, pass '''info''' instead of '''debug''' in the above command, or reboot. See also [[https://modemmanager.org/docs/modemmanager/debugging/|DebuggingModemmanager]].
Line 41: Line 48:
See also [[DebuggingModemmanager]]. You do not need to restart ModemManager to begin seeing debug messages logged to journalctl. You can watch the ModemManager logs:

{{{
$ sudo journalctl -f -u ModemManager
}}}
Line 45: Line 56:
Change the log level:
Line 46: Line 58:
sudo /usr/lib/NetworkManager/debug-helper.py --wpa msgdump $ sudo wpa_cli log_level debug
Line 49: Line 61:
Then get the logs which will be written to /var/log/syslog. To disable it, pass '''info''' instead of '''debug''' in the above command, or reboot. You do not need to restart wpa_supplicant to begin seeing debug messages logged to journalctl. You can watch the wpa_supplicant logs:

{{{
$ sudo journalctl -f -u wpa_supplicant
}}}
Line 59: Line 75:
 tail -n0 -f /var/log/syslog > /tmp/syslog $ tail -n0 -f /var/log/syslog > /tmp/syslog
Line 76: Line 92:
An few extra things that are very helpful to add in case of issues with 3G: Here are a few extra things that are very helpful to add in case of issues with 3G.
Line 90: Line 106:
You can check the status from the cli using You can check the status from the cli using:
Line 95: Line 111:
The server should return that value
{{{
$ wget -O - http://connectivity-check.ubuntu.com./ -d 2>&1 | grep X-
X-NetworkManager-Status: online
}}}

Since 1.38, set Environment=NM_LOG_CONCHECK=1 in NetworkManager.service and restart the service to get additional debug logging about connectivity checking.
Since 1.38, you can set Environment=NM_LOG_CONCHECK=1 in NetworkManager.service and restart the service to get additional debug logging about connectivity checking.
Line 107: Line 117:
First, stop NetworkManager: {{{
sudo service network-manager stop
}}} Then unload your driver:{{{
sudo modprobe -r DRIVER
}}} Next, load the driver:{{{
sudo modprobe DRIVER
}}} and finally start NetworkManager:{{{
sudo service network-manager start
First, stop NetworkManager and unload your driver:
{{{
$ sudo service network-manager stop
$ sudo modprobe -r DRIVER
Line 116: Line 122:

Next, load the driver and start NetworkManager:
{{{
$ sudo modprobe DRIVER
$ sudo service network-manager start
}}}

Available languages: Italiano,

Debugging Central

This page is part of the debugging series — pages with debugging details for a variety of Ubuntu packages.

Bug Summary

If a network-manager bug report is about not being able to connect the title or summary should be in the format:

"[CHIPSET] cannot connect to (ENCRYPT_METHOD)"

where the CHIPSET is the wireless driver used and ENCRYPT_METHOD is the encryption method used by your wireless network.

Understanding your bug and getting more information

Getting debug logs

You can then follow developers' intructions on a bug report for the exact command line to use; or run it directly as such.

Getting NetworkManager debug logs

By default, the NetworkManager log level is set to info. You can use nmcli to modify the logging level:

$ sudo nmcli general logging level DEBUG domains ALL

You do not need to restart NetworkManager to begin seeing debug messages logged to journalctl. You can watch the NetworkManager logs:

$ sudo journalctl -f -u NetworkManager

Getting ModemManager debug logs

Manually run with debug enabled:

$ sudo /usr/sbin/ModemManager --debug
$ sudo /usr/sbin/NetworkManager --debug --log-level=DEBUG

See also DebuggingModemmanager.

You do not need to restart ModemManager to begin seeing debug messages logged to journalctl. You can watch the ModemManager logs:

$ sudo journalctl -f -u ModemManager

Getting wpasupplicant debug logs

Change the log level:

$ sudo wpa_cli log_level debug

You do not need to restart wpa_supplicant to begin seeing debug messages logged to journalctl. You can watch the wpa_supplicant logs:

$ sudo journalctl -f -u wpa_supplicant

Getting a capture of syslog

Mixing and mashing the above is perfectly acceptable as well if you want to see how NetworkManager and other parts of the stack interact together.

In order to understand whats going on and track down issues, its good to have a full log. To do so, capture the complete test case and submit the whole file (don't cut out what you think is important). Please add markers in the log file so the bug triager can easily see what actions the user takes at what point of time (this isn't essential, but helps a lot).

To capture the syslog, do:

$ tail -n0 -f /var/log/syslog > /tmp/syslog

and to stop capturing do Ctrl-C (you will have to type your other commands in an other window or tab)

Adding markers is just like adding new lines with an editor that show the triager what happened at what point of time. You can also do this on the fly as you test with the command logger "[ clicked on wireless network 'ubuntu']" .

Example marker:

Sep  6 08:12:30 ...

[ clicked on wireless network 'ubuntu']

Sep  6 08:12:31 ...
...

Handling 3G / modem issues

Here are a few extra things that are very helpful to add in case of issues with 3G.

The output of udevadm for tty devices, and output of lsusb:

$ udevadm info --query=all --path=/sys/class/tty/... --attribute-walk

$ lsusb

Captive portal

You can check the status from the cli using:

$ nmcli networking connectivity check

Since 1.38, you can set Environment=NM_LOG_CONCHECK=1 in NetworkManager.service and restart the service to get additional debug logging about connectivity checking.

A Testcase

A good testcase is a step by step instruction to reproduce your bug starting with driver unloaded and NetworkManager stopped.

First, stop NetworkManager and unload your driver:

$ sudo service network-manager stop
$ sudo modprobe -r DRIVER

Next, load the driver and start NetworkManager:

$ sudo modprobe DRIVER
$ sudo service network-manager start

DebuggingNetworkManager (last edited 2023-06-27 20:21:45 by hellsworth)