centos断开网线,桌面不提示依然显示链接,ip也接着显示,问题排查

总结

gdb gnome-control-center

nm_device_get_state 返回不正常,这个的返回值会用来刷新图标网络状态
bpftrace -e 'uretprobe:/usr/lib64/libnm.so:nm_device_get_state {printf("%d\n", retval)}'

定位到/usr/lib64/libnm.so中

gdb NetworkManager

根据下面的日志

[1704866285.5266] device[4ab3b1692f22a84b] (ens160): queue-state[unavailable, reason:carrier-changed, id:198]: queue state change
Jan 09 21:58:05 localhost.localdomain NetworkManager[6501]: <debug> [1704866285.5267] device[4ab3b1692f22a84b] (ens160): queue-state[unavailable, reason:carrier-changed, id:198]: change state
Jan 09 21:58:05 localhost.localdomain NetworkManager[6501]: <info>  [1704866285.5267] device (ens160): state change: activated -> unavailable (reason 'carrier-changed', sys-iface-state: 'managed')

定位到

/usr/src/debug/NetworkManager-1.36.0-10.0.1.cy8.x86_64/src/core/devices/nm-device.c

static gboolean
carrier_disconnected_action_cb(gpointer user_data)
{
    NMDevice        *self = NM_DEVICE(user_data);
    NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);

    _LOGD(LOGD_DEVICE,
          "carrier: link disconnected (calling deferred action) (id=%u)",
          priv->carrier_defer_id);

    priv->carrier_defer_id = 0;
    carrier_changed(self, FALSE);
    return FALSE;
}

看到信息

$3 = {
  device_link_changed_id = 0, 
  device_ip_link_changed_id = 0, 
  state = NM_DEVICE_STATE_ACTIVATED, 
  state_reason = NM_DEVICE_STATE_REASON_NONE, 
  queued_state = {
    id = 0, 
    state = NM_DEVICE_STATE_ACTIVATED, 
    reason = NM_DEVICE_STATE_REASON_NONE
  }, 
  pending_actions = {
    arr = 0x557685adcfd0, 
    len = 0, 
    alloc = 4
  }, 
  parent_device = {
    {
      obj = 0x0, 
      _obj = 0x0
    }, 
    _notify_target = 0x557685ad9620, 
    _notify_pspec = 0x557685ac7060, 
    _notify_signal_id = 0, 
    {
      visible = false, 
      _visible = false
    }
  }, 
  udi = 0x557685ad77b0 "/sys/devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/ens33", 
  path = 0x557685ad71b0 "pci-0000:02:01.0", 
  {
    iface = 0x557685ad5320 "ens33", 
    iface_ = 0x557685ad5320 "ens33"
  }, 
  {
    ip_iface = 0x0, 
    ip_iface_ = 0x0
  }, 
  {
    l3cfg = 0x557685a3b4f0, 
    l3cfg_ = 0x557685a3b4f0
  }, 
  {
    {
      l3ipdata_6 = {
        ip_config = 0x557685aca0e0
      }, 
      l3ipdata_4 = {
        ip_config = 0x557685aca040
      }
    }, 
    l3ipdata_x = {{
        ip_config = 0x557685aca0e0
      }, {
        ip_config = 0x557685aca040
      }}
  }, 
  l3cfg_commit_type = 0x557685a680a0, 
  {
    ifindex = 3, 
    ifindex_ = 3
  }, 
  {
    ip_ifindex = 0, 
    ip_ifindex_ = 0
  }, 
  l3cds = {{
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x557685b2e1a0
    }, {
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x0
    }, {
      d = 0x557685b12e20
    }}, 
  parent_ifindex = 0, 
  auth_retries = -1, 
  {
    {
      hostname_resolver_6 = 0x0, 
      hostname_resolver_4 = 0x0
    }, 
    hostname_resolver_x = {0x0, 0x0}
  }, 
  {
    hw_addr_len = 6 '\006', 
    hw_addr_len_ = 6 '\006'
  }, 
  hw_addr_type = HW_ADDR_TYPE_UNSET, 
  real = true, 
  type = NM_DEVICE_TYPE_ETHERNET, 
  type_desc = 0x557685ace580 "Ethernet", 
  link_type = NM_LINK_TYPE_ETHERNET, 
  capabilities = (NM_DEVICE_CAP_NM_SUPPORTED | NM_DEVICE_CAP_CARRIER_DETECT), 
  driver = 0x557685ad9870 "e1000", 
  driver_version = 0x557685ad41d0 "5.10.92-14.xc.cy8.x86_64", 
  firmware_version = 0x557685ad9cb0 "", 
  rfkill_type = RFKILL_TYPE_UNKNOWN, 
  firmware_missing = false, 
  nm_plugin_missing = false, 
  hw_addr_perm_fake = false, 
  in_state_changed = 0 '\000', 
  current_stable_id_type = NM_UTILS_STABLE_TYPE_UUID, 
  activation_state_preserve_external_ports = false, 
  nm_owned = false, 
  assume_state_guess_assume = false, 
  assume_state_connection_uuid = 0x0, 
  udi_id = 0, 
  available_connections = 0x557685a5cb00, 
  hw_addr = 0x557685ad42d0 "00:0C:29:FD:76:C5", 
  hw_addr_perm = 0x557685ad97d0 "00:0C:29:FD:76:C5", 
  hw_addr_initial = 0x557685ad9890 "00:0C:29:FD:76:C5", 
  physical_port_id = 0x0, 
  dev_id = 0, 
  unmanaged_mask = 121, 
  unmanaged_flags = NM_UNMANAGED_NONE, 
  delete_on_deactivate_data = 0x0, 
  deactivating_cancellable = 0x0, 
  queued_act_request = 0x0, 
  queued_act_request_is_waiting_for_carrier = false, 
  act_request = {
    {
      obj = 0x557685b09400, 
      _obj = 0x557685b09400
    }, 
    _notify_target = 0x557685ad9620, 
    _notify_pspec = 0x557685abb620, 
    _notify_signal_id = 454, 
    {
      visible = true, 
      _visible = true
    }
  }, 
  activation_idle_source = 0x0, 
  activation_func = 0x0, 
  recheck_assume_id = 0, 
  recheck_available = {
    call_id = 0, 
    available_reason = NM_DEVICE_STATE_REASON_NONE, 
    unavailable_reason = NM_DEVICE_STATE_REASON_NONE
  }, 
  dispatcher = {
    call_id = 0x0, 
    post_state = NM_DEVICE_STATE_UNKNOWN, 
    post_state_reason = NM_DEVICE_STATE_REASON_NONE
  }, 
  link_connected_id = 0, 
  link_disconnected_id = 0, 
  carrier_defer_id = 12356, 
  carrier_wait_id = 0, 
  config_changed_id = 186, 
  ifindex_changed_id = 0, 
  mtu = 1500, 
  ip6_mtu = 0, 
  mtu_initial = 0, 
  ip6_mtu_initial = 0, 
  mtu_source = NM_DEVICE_MTU_SOURCE_NONE, 
  v4_route_table = 0, 
  v6_route_table = 0, 
  carrier_wait_until_ms = 0, 
  {
    {
      l3config_merge_flags_6 = NM_L3_CONFIG_MERGE_FLAGS_NONE, 
      l3config_merge_flags_4 = NM_L3_CONFIG_MERGE_FLAGS_NONE
    }, 
    l3config_merge_flags_x = {NM_L3_CONFIG_MERGE_FLAGS_NONE, NM_L3_CONFIG_MERGE_FLAGS_NONE}
  }, 
  {
    sys_iface_state = NM_DEVICE_SYS_IFACE_STATE_MANAGED, 
    sys_iface_state_ = NM_DEVICE_SYS_IFACE_STATE_MANAGED
  }, 
  carrier = false, 
  ignore_carrier = false, 
  up = true, 
  v4_route_table_initialized = true, 
  v6_route_table_initialized = true, 
  l3config_merge_flags_has = true, 
  v4_route_table_all_sync_before = false, 
  v6_route_table_all_sync_before = false, 
  autoconnect_blocked_flags = NM_DEVICE_AUTOCONNECT_BLOCKED_NONE, 
  is_enslaved = false, 
  device_link_changed_down = false, 
  concheck_rp_filter_checked = true, 
  tc_committed = true, 
  stage1_sriov_state = NM_DEVICE_STAGE_STATE_COMPLETED, 
  current_stable_id = 0x557685b27e70 "9a1f4a47-5430-4e10-b58d-7cccc858bb5b", 
  pacrunner_conf_id = 0x557685b00380, 
  ip_data = {
    {
      state = NM_DEVICE_IP_STATE_READY, 
      state_ = NM_DEVICE_IP_STATE_READY
    }
  }, 
  {
    {
      ip_data_6 = {
        check_async_source = 0x0, 
        req_timeout_source = 0x0, 
        {
          state = NM_DEVICE_IP_STATE_PENDING, 
          state_ = NM_DEVICE_IP_STATE_PENDING
        }, 
        wait_for_carrier = false, 
        wait_for_ports = false, 
        is_disabled = false, 
        is_ignore = false, 
        do_reapply = false
      }, 
      ip_data_4 = {
        check_async_source = 0x0, 
        req_timeout_source = 0x0, 
        {
          state = NM_DEVICE_IP_STATE_READY, 
          state_ = NM_DEVICE_IP_STATE_READY
        }, 
        wait_for_carrier = false, 
        wait_for_ports = false, 
        is_disabled = false, 
        is_ignore = false, 
        do_reapply = false
      }
    }, 
    ip_data_x = {{
        check_async_source = 0x0, 
        req_timeout_source = 0x0, 
        {
          state = NM_DEVICE_IP_STATE_PENDING, 
          state_ = NM_DEVICE_IP_STATE_PENDING
        }, 
        wait_for_carrier = false, 
        wait_for_ports = false, 
        is_disabled = false, 
        is_ignore = false, 
        do_reapply = false
      }, {
        check_async_source = 0x0, 
        req_timeout_source = 0x0, 
        {
          state = NM_DEVICE_IP_STATE_READY, 
          state_ = NM_DEVICE_IP_STATE_READY
        }, 
        wait_for_carrier = false, 
        wait_for_ports = false, 
        is_disabled = false, 
        is_ignore = false, 
        do_reapply = false
      }}
  }, 
  ipmanual_data = {
    carrier_timeout = 0x0, 
    {
      {
        state_6 = NM_DEVICE_IP_STATE_READY, 
        state_4 = NM_DEVICE_IP_STATE_READY
      }, 
      state_x = {NM_DEVICE_IP_STATE_READY, NM_DEVICE_IP_STATE_READY}
    }, 
    carrier_timeout_expired = false
  }, 
  {
    {
      ipdhcp_data_6 = {
        client = 0x0, 
        config = 0x0, 
        notify_sigid = 0, 
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {<No data fields>}, 
          v6 = {
            needed_prefixes = 0, 
            mode = NM_NDISC_DHCP_LEVEL_NONE
          }
        }
      }, 
      ipdhcp_data_4 = {
        client = 0x557685b09550, 
        config = 0x557685b10d90, 
        notify_sigid = 457, 
        state = NM_DEVICE_IP_STATE_READY, 
        {
          v4 = {<No data fields>}, 
          v6 = {
            needed_prefixes = 0, 
            mode = NM_NDISC_DHCP_LEVEL_UNKNOWN
          }
        }
      }
    }, 
    ipdhcp_data_x = {{
        client = 0x0, 
        config = 0x0, 
        notify_sigid = 0, 
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {<No data fields>}, 
          v6 = {
            needed_prefixes = 0, 
            mode = NM_NDISC_DHCP_LEVEL_NONE
          }
        }
      }, {
        client = 0x557685b09550, 
        config = 0x557685b10d90, 
        notify_sigid = 457, 
        state = NM_DEVICE_IP_STATE_READY, 
        {
          v4 = {<No data fields>}, 
          v6 = {
            needed_prefixes = 0, 
            mode = NM_NDISC_DHCP_LEVEL_UNKNOWN
          }
        }
      }}
  }, 
  ipac6_data = {
    ndisc = 0x557685a5e640, 
    ndisc_grace_source = 0x557685aa6900, 
    ndisc_changed_id = 467, 
    ndisc_timeout_id = 468, 
    state = NM_DEVICE_IP_STATE_PENDING, 
    l3cd = 0x0
  }, 
  {
    {
      ipll_data_6 = {
        state = NM_DEVICE_IP_STATE_READY, 
        {
          v4 = {
            ipv4ll = 0x557685b0eda0, 
            ipv4ll_registation = 0x0, 
            timeout_source = 0x80fe00000002
          }, 
          v6 = {
            ipv6ll = 0x557685b0eda0, 
            retry_source = 0x0, 
            llstate = NM_L3_IPV6LL_STATE_READY, 
            lladdr = {
              __in6_u = {
                __u6_addr8 = "\376\200\000\000\000\000\000\000\317M|\225\260\031\320", <incomplete sequence \375>, 
                __u6_addr16 = {33022, 0, 0, 0, 19919, 38268, 6576, 64976}, 
                __u6_addr32 = {33022, 0, 2507951567, 4258273712}
              }
            }
          }
        }
      }, 
      ipll_data_4 = {
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {
            ipv4ll = 0x0, 
            ipv4ll_registation = 0x0, 
            timeout_source = 0x0
          }, 
          v6 = {
            ipv6ll = 0x0, 
            retry_source = 0x0, 
            llstate = NM_L3_IPV6LL_STATE_STARTING, 
            lladdr = {
              __in6_u = {
                __u6_addr8 = '\000' <repeats 15 times>, 
                __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, 
                __u6_addr32 = {0, 0, 0, 0}
              }
            }
          }
        }
      }
    }, 
    ipll_data_x = {{
        state = NM_DEVICE_IP_STATE_READY, 
        {
          v4 = {
            ipv4ll = 0x557685b0eda0, 
            ipv4ll_registation = 0x0, 
            timeout_source = 0x80fe00000002
          }, 
          v6 = {
            ipv6ll = 0x557685b0eda0, 
            retry_source = 0x0, 
            llstate = NM_L3_IPV6LL_STATE_READY, 
            lladdr = {
              __in6_u = {
                __u6_addr8 = "\376\200\000\000\000\000\000\000\317M|\225\260\031\320", <incomplete sequence \375>, 
                __u6_addr16 = {33022, 0, 0, 0, 19919, 38268, 6576, 64976}, 
                __u6_addr32 = {33022, 0, 2507951567, 4258273712}
              }
            }
          }
        }
      }, {
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {
            ipv4ll = 0x0, 
            ipv4ll_registation = 0x0, 
            timeout_source = 0x0
          }, 
          v6 = {
            ipv6ll = 0x0, 
            retry_source = 0x0, 
            llstate = NM_L3_IPV6LL_STATE_STARTING, 
            lladdr = {
              __in6_u = {
                __u6_addr8 = '\000' <repeats 15 times>, 
                __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, 
                __u6_addr32 = {0, 0, 0, 0}
              }
            }
          }
        }
      }}
  }, 
  {
    {
      ipshared_data_6 = {
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {
            dnsmasq_manager = 0x0, 
            shared_ip_handle = 0x0, 
            firewall_config = 0x0, 
            dnsmasq_state_id = 0, 
            l3cd = 0x0
          }, 
          v6 = {<No data fields>}
        }
      }, 
      ipshared_data_4 = {
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {
            dnsmasq_manager = 0x0, 
            shared_ip_handle = 0x0, 
            firewall_config = 0x0, 
            dnsmasq_state_id = 0, 
            l3cd = 0x0
          }, 
          v6 = {<No data fields>}
        }
      }
    }, 
    ipshared_data_x = {{
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {
            dnsmasq_manager = 0x0, 
            shared_ip_handle = 0x0, 
            firewall_config = 0x0, 
            dnsmasq_state_id = 0, 
            l3cd = 0x0
          }, 
          v6 = {<No data fields>}
        }
      }, {
        state = NM_DEVICE_IP_STATE_NONE, 
        {
          v4 = {
            dnsmasq_manager = 0x0, 
            shared_ip_handle = 0x0, 
            firewall_config = 0x0, 
            dnsmasq_state_id = 0, 
            l3cd = 0x0
          }, 
          v6 = {<No data fields>}
        }
      }}
  }, 
  {
    {
      ipdev_data_6 = {
        state = NM_DEVICE_IP_STATE_NONE, 
        failed_reason = NM_DEVICE_STATE_REASON_NONE
      }, 
      ipdev_data_4 = {
        state = NM_DEVICE_IP_STATE_NONE, 
        failed_reason = NM_DEVICE_STATE_REASON_NONE
      }
    }, 
    ipdev_data_x = {{
        state = NM_DEVICE_IP_STATE_NONE, 
        failed_reason = NM_DEVICE_STATE_REASON_NONE
      }, {
        state = NM_DEVICE_IP_STATE_NONE, 
        failed_reason = NM_DEVICE_STATE_REASON_NONE
      }}
  }, 
  ipdev_data_unspec = {
    state = NM_DEVICE_IP_STATE_NONE, 
    failed_reason = NM_DEVICE_STATE_REASON_NONE
  }, 
  addrgenmode6_data = {
    previous_mode_val = 1 '\001', 
    previous_mode_has = true
  }, 
  gw_ping = {
    log_domain = LOGD_NONE, 
    timeout = 0, 
    watch = 0, 
    pid = 0, 
    binary = 0x0, 
    address = 0x0, 
    deadline = 0
  }, 
  fw_state = FIREWALL_STATE_INITIALIZED, 
  fw_mgr = 0x557685a36e30, 
  fw_call = 0x0, 
  ip6_saved_properties = 0x7f9ce40070c0, 
  ethtool_state = 0x0, 
  master = 0x0, 
  master_ready_id = 0, 
  master_ifindex = 0, 
  slaves = {
    next = 0x557685ad9530, 
    prev = 0x557685ad9530
  }, 
  metered = NM_METERED_GUESS_NO, 
  settings = 0x557685a5e030, 
  manager = 0x557685a5b000, 
  netns = 0x7f9ce4007360, 
  lldp_listener = 0x0, 
  concheck_mgr = 0x7f9ce4006940, 
  concheck_lst_head = {
    next = 0x557685ad9570, 
    prev = 0x557685ad9570
  }, 
  concheck_x = {{
      p_cur_id = 12370, 
      p_max_interval = 300, 
      p_cur_interval = 8, 
      p_cur_basetime_ns = 298728545173, 
      state = NM_CONNECTIVITY_NONE
    }, {
      p_cur_id = 12373, 
      p_max_interval = 300, 
      p_cur_interval = 8, 
      p_cur_basetime_ns = 300728521250, 
      state = NM_CONNECTIVITY_NONE
    }}, 
  check_delete_unrealized_id = 0, 
  interface_flags = 1, 
  sriov = {
    pending = 0x0, 
    next = 0x0
  }, 
  sriov_reset_pending = 0, 
  stats = {
    timeout_source = 0x0, 
    refresh_rate_ms = 0, 
    tx_bytes = 5858, 
    rx_bytes = 3146
  }, 
  mtu_force_set_done = false, 
  needs_ip6_subnet = false, 
  promisc_reset = NM_OPTION_BOOL_DEFAULT, 
  ports_variant = 0x557685acf070, 
  prop_ip_iface = 0x557685ae8450 "ens33"
}

通过和正常的centos情况比对,priv->ignore_carrier属性不正常,正常时此属性为false,不正常时为true,priv->carrire属性标识是否链接,此属性正常

搜索资料
- NetworkManager does not react to link state changes in RHEL7, 8 and 9 Server

原来是安装NetworkManager-config-server包后会默认配置忽略carrier

问题解决

  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您好!如果您的 CentOS 7 没有显示桌面,这可能是由于几个原因所致。以下是一些常见的解决方案: 1. 检查是否安装了图形界面:确保已正确安装并配置了桌面环境。默认情况下,CentOS 7 使用 GNOME 作为默认桌面环境。您可以通过运行以下命令检查是否已安装 GNOME: ``` yum groupinfo "GNOME Desktop" ``` 如果没有安装,可以运行以下命令进行安装: ``` yum groupinstall "GNOME Desktop" ``` 2. 检查默认运行级别:确保系统将默认运行级别设置为图形模式。您可以通过编辑 `/etc/inittab` 文件来检查和更改默认运行级别。找到类似于 `id:3:initdefault:` 的行,并将其更改为 `id:5:initdefault:`。 3. 检查 X 服务器配置:确保 X 服务器配置正确。您可以检查 `/etc/X11/xorg.conf` 文件以确保配置正确。 4. 检查日志文件:查看系统日志文件以获取有关问题的更多信息。可以使用以下命令查看 X 服务器的日志文件: ``` cat /var/log/Xorg.0.log ``` 根据日志中的错误消息,可能需要采取进一步的措施来解决问题。 5. 启动桌面环境:如果上述步骤都没有解决问题,您可以尝试手动启动桌面环境。使用以下命令启动 GNOME 桌面: ``` startx ``` 这将尝试启动 GNOME 桌面环境。如果有任何错误消息,请根据错误消息采取进一步的措施。 希望以上解决方案能帮助您解决问题!如果仍然有困惑,请提供更多细节,我将尽力帮助您。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值