Fernando Fdez
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Understanding NetworkManager logs It is probable that you have encountered problems when configuring networking in your laptop, server, VM or even container. There are high changes that NetworkManager has been involved there. This article aims to clarify how to debug and read logs from NetworkManager. ## What is NetworkManager? ``` NetworkManager is a daemon that attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, Wi-Fi, and Mobile Broadband devices. ``` This definitions is provided by the NetworkManager manpage and it is quite complete and correct but if you are not familiar with networking or system administration you might find this a little bit useless. In essence, NetworkManager is a software that is running as a service in the system so it will be always running in the background performing multiple operations. For a common user these operations are basically two. * Wi-Fi Access Point scanning/connecting * Dynamic IP address configuration through DHCP Usually, NetworkManager is controlled by a client. The clients are the software that the user runs actively to configure all needed. e.g nmcli, nmtui, nm-applet. When debugging and reading the logs, we will focus on NetworkManager logs so this article is going to be useful no matter which client you use. ## Logs and proper debug configuration By default NetworkManager does not log all the domains, it only logs essential operations and all warnings/errors. For a common use that is enough but when debugging an issue you might want to enable TRACE logs. Adding the following block to your NetworkManager configuration logging file will enable TRACE logs for all the domains. ``` [logging] level=TRACE domains=ALL ``` The logging configuration file can be found at `/etc/NetworkManager/conf.d/95-logging.conf` Please, notice that restarting NetworkManager service is mandatory after modifying the global configuration. ``` # systemctl restart NetworkManager ``` You can find more information about logging configuration at `LOGGING` section in the manpage. ## Where are the logs? You can find the logs in syslog using `journalctl`. The most common command is `journalctl -u NetworkManager`. If NetworkManager has been running for a while this command is not going to be really useful as you will find thousands of logging lines. I recommend filtering by time according to your needs. ``` journalctl --since "2023-07-10 15:10:00" -u NetworkManager ``` ## Directly to the issue, how to find out relevant information I would like to take an descending perspective of the multiple domains you might find in the NetworkManager logs. ### Settings-connection These will be the log lines closer to the user side. On these lines you will fine what is the client configuring on the NetworkManager daemon. It is the first place to spot a wrong configuration. ``` ...: <trace> [1698315996.9760] settings-connection[d641522308f4faf9,ac16258d-c663-3eb4-a24d-aaf61bbac537]: update settings-connection flags to unsaved,nm-generated,visible (was none) ...: <trace> [1698315996.9760] dbus-object[d641522308f4faf9]: export: "/org/freedesktop/NetworkManager/Settings/46" ...: <debug> [1698315996.9769] ++ connection 'new connection' (0x2aa4cb0/NMSimpleConnection/"802-3-ethernet"): [/org/freedesktop/NetworkManager/Settings/46] ...: <debug> [1698315996.9770] ++ connection [ 0x2a2ccb0 ] ...: <debug> [1698315996.9770] ++ connection.autoconnect-priority = -999 ...: <debug> [1698315996.9770] ++ connection.id = 'Wired connection 5' ...: <debug> [1698315996.9771] ++ connection.interface-name = 'eth1.ep' ...: <debug> [1698315996.9771] ++ connection.permissions = [] ...: <debug> [1698315996.9771] ++ connection.timestamp = 1698315996 ...: <debug> [1698315996.9772] ++ connection.type = '802-3-ethernet' ...: <debug> [1698315996.9772] ++ connection.uuid = 'ac16258d-c663-3eb4-a24d-aaf61bbac537' ``` As you can notice on this snippet, these lines will reflect what is configured on the connection. If a field is misconfigured here it is indicating that the data passed from the client is wrong. This could be caused due to a misuse of the client or a bug. If that is your case, please re-check the configuration you are trying to set on the client and if that doesn't match the logs, feel free to open an issue on NetworkManager gitlab repository. ### Manager Is kind of the core of NetworkManager. It manages the state of devices, triggers activation of connections and general state of NetworkManager daemon. ``` manager: block-autoconnect: device[ef59e48eb5faea69,eth2p]-profile[307286e7c9684e41,Wired connection 4]: retries set 2 ``` Currently, NetworkManager has a mechanism to autoconnect connections. This mechanism can be configured to retry a fixed number of times and block the autoconnection if reached. When that happens you will notice lines similar to this. If the connection is not autoconnecting as expected these lines will be helpful to understand what is happening. ``` manager: (br0): assume: don't assume because device is not managed ``` Assumed devices are a confusing concept for the users. In essence, when a device is created and it is not unmanaged by NetworkManager, NetworkManager will try to "assume" the configuration and manage the device honoring the existing configuration. These is something common when investigating reboot issues. Anyway, this is a concept that is planned to be dropped at some point. ### Policy The policy module as the name indicates is the one that manages several policies for connections. As mentioned in the past one of this policy is the autoconnect state. ``` policy: auto-activating connection 'Office Wi-Fi' (1447da44-a51e-4387-a016-f6793cec4e88) ``` In this line you can notice which connection is being auto-activated. ``` policy: block-autoconnect: unblocking port profiles for controller ifname="wlp0s20f3", uuid="1447da44-a51e-4387-a016-f6793cec4e88" ``` Another example is this line that tells you which port is being unblocked for autoconnection. ### Device The device is the interface representation in NetworkManager. These log lines shows all the operations done at interface level. ``` device (wlp0s20f3): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed') ``` The state is indicating in which phase is the device. This will provide hints of what happened to the device. A common state that might be interesting to check is `config`. At this phase, if something goes wrong it can go to deactivating. Understanding the multiple states is important when debugging an issue. ``` device[4c10b9d3a3aa1f8c] (wlp0s20f3): ip6: check-state: state pending => pending, is_failed=0, is_pending=1, is_started=1 temp_na=0, may-fail-4=1, may-fail-6=1 ``` During the ip-check phase, the device will check the IP configuration. A common problem is that a connection is configured to hold a DHCP IPv4 address but there is no DHCP server configured. When that happens, the device will hold on ip-check state until there is a timeout. If an interface is activating but failing on IP configuration, this is a really nice line to spot. ``` device[b89c9b9cec81ecb5] (eth1p): ip:dhcp4: DHCP failing: timeout getting lease device[b89c9b9cec81ecb5] (eth1p): ip:dhcp4: set state fail (was pending) device (eth1p): state change: ip-config -> failed (reason 'ip-config-unavailable', sys-iface-state: 'managed') ``` These lines are an example of what was described above. ``` device[4c10b9d3a3aa1f8c] (wlp0s20f3): mtu: device-mtu: 1460 (was 1500), ipv6-mtu: 1410, ifindex: 3 ``` Other device properties and changes can be found on the device logs like the MTU or MAC address. ### l3cfg The l3cfg or Layer-3-configuration module is the one in charge of configuring and managing IP addresses and routes for the device. ``` l3cfg[07759e4bfa8fc334,ifindex=25]: obj-state: track: [548ba95452f95975, ip6-address, fe80::94f9:74ad:d4fd:437b/64 lft forever pref forever lifetime 112999-0[0,0] (...) ``` Here you can notice how a new IPv6 address is being tracked and configured by NetworkManager on the interface with ifindex 25. ``` l3cfg[07759e4bfa8fc334,ifindex=25]: obj-state: track: [6bd82d63498852f3, ip6-route, type unicast fe80::/64 dev 25 metric 1024 mss 0 rt-src ipv6ll] ``` And a similar line for an IPv6 route. In essence, if an address/route is missing or misconfigured l3cfg lines are going to help you finding out what is happening. ### DHCP Going more into details for Layer 3 configuration, you will find `dhcp4` lines. These lines are from the DHCP client used. They describe the events happening on the client side. ``` dhcp4 (eth2): event: send DISCOVER to 255.255.255.255 ``` Here you can notice how the DISCOVER was sent to broadcast addresss. ### The platform lines The platform module is the one in charge of kernel configuration. It sets the netlink attributes according to what the user configured.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully