APS-Networks / APS-One-touch

12 stars 9 forks source link

ERROR: can not open /dev/i2c-0 #19

Closed DINGDAMU closed 3 years ago

DINGDAMU commented 3 years ago

Hi,

I followed the README to build the SDE 9.5.0 on our switch (BF6064X_T) by using ALL-IN-ONE package (AOT v1.5.3), there were no errors while building SDE as well as bsp.

When I tried to start the SDE, I got "ERROR: can not open /dev/i2c-0":

root@bf2556:~/APS-One-touch-1.5.3# python3 bf_sde.py /root/APS-One-touch-1.5.3/settings.yaml
Reading settings from file /root/APS-One-touch-1.5.3/settings.yaml
Reading settings from file /root/APS-One-touch-1.5.3/advance_settings.yaml
SDE : build y/[n]?n
BSP : build y/[n]? n
SDE : start y/[n]?y
Starting BF switchd.
Setting environment for BF_SDE.
Environment variables set:
 SDE: /root//BF/bf-sde-9.5.0
 SDE_INSTALL: /root//BF/bf-sde-9.5.0/install/
 PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/root/9.5.0_AOT1.5.4_SAL1.3.4/BF/bf-sde-9.5.0/install/bin:/root/9.5.0_AOT1.5.4_SAL1.3.4/BF/bf-sde-9.5.0/install/bin:/root/BF/bf-sde-9.5.0/install/bin:/root/BF/bf-sde-9.5.0/install/bin:/root//BF/bf-sde-9.5.0/install//bin/
 P4_PROG:
Loading kernel modules.
Executing sys cmd : lsmod
Module bf_kdrv already loaded
Loading bf_kpkt....
Using SDE /root//BF/bf-sde-9.5.0 for loading bf_kpkt.
insmod: ERROR: could not insert module /root//BF/bf-sde-9.5.0/install//lib/modules/bf_kpkt.ko: Device or resource busy
Executing sys cmd : lsmod
Platform info #97~18.04.1-Ubuntu SMP Sat Sep 18 03:11:22 UTC 2021
ERROR:i2c_i801 is not loaded.
Switch model couldn't be retrieved from System, Checking environment for SWITCH_MODEL
Switch model is BF6064X_T
ERROR:Some kernel modules are not loaded.
Starting switchd without p4 program
Executing sys cmd : cat /etc/sysctl.conf
Starting switchd with command :  /root//BF/bf-sde-9.5.0/run_switchd.sh -c /root//BF/bf-sde-9.5.0/pkgsrc/p4-examples/tofino/tofino_skip_p4.conf.in --skip-p4
Using SDE /root//BF/bf-sde-9.5.0
Using SDE_INSTALL /root//BF/bf-sde-9.5.0/install/
Setting up DMA Memory Pool
Using TARGET_CONFIG_FILE /root//BF/bf-sde-9.5.0/pkgsrc/p4-examples/tofino/tofino_skip_p4.conf.in
Using PATH /root//BF/bf-sde-9.5.0/install//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/root/9.5.0_AOT1.5.4_SAL1.3.4/BF/bf-sde-9.5.0/install/bin:/root/9.5.0_AOT1.5.4_SAL1.3.4/BF/bf-sde-9.5.0/install/bin:/root/BF/bf-sde-9.5.0/install/bin:/root/BF/bf-sde-9.5.0/install/bin:/root//BF/bf-sde-9.5.0/install//bin/
Using LD_LIBRARY_PATH /usr/local/lib:/root//BF/bf-sde-9.5.0/install//lib:
bf_sysfs_fname /sys/class/bf/bf0/device/dev_add
Install dir: /root//BF/bf-sde-9.5.0/install/ (0x5584ad491d40)
bf_switchd: system services initialized
bf_switchd: loading conf_file /root//BF/bf-sde-9.5.0/pkgsrc/p4-examples/tofino/tofino_skip_p4.conf.in...
bf_switchd: processing device configuration...
Configuration for dev_id 0
  Family        : Tofino
  pci_sysfs_str : /sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0
  pci_domain    : 0
  pci_bus       : 5
  pci_fn        : 0
  pci_dev       : 0
  pci_int_mode  : 1
  sbus_master_fw: /root//BF/bf-sde-9.5.0/install//
  pcie_fw       : /root//BF/bf-sde-9.5.0/install//
  serdes_fw     : /root//BF/bf-sde-9.5.0/install//
  sds_fw_path   : /root//BF/bf-sde-9.5.0/install//
  microp_fw_path:
bf_switchd: processing P4 configuration...
P4 profile for dev_id 0
  p4_name: dummy
    libpd:
    libpdthrift:
    context:
    config:
  Agent[0]: /root//BF/bf-sde-9.5.0/install//lib/libpltfm_mgr.so
  diag:
  accton diag:
  non_default_port_ppgs: 0
  SAI default initialize: 1
bf_switchd: library /root//BF/bf-sde-9.5.0/install//lib/libpltfm_mgr.so loaded
bf_switchd: agent[0] initialized
Tcl server started..
Tcl server: listen socket created
Tcl server: bind done on port 8008, listening...
Tcl server: waiting for incoming connections...
Health monitor started
ERROR: can not open /dev/i2c-0
ERROR: can not open /dev/i2c-0
ERROR: can not open /dev/i2c-0
ERROR: can not open /dev/i2c-0

It seems that this is because I did not load the module i2c_i801.

root@bf2556:~/APS-One-touch-1.5.3# modprobe i2c_i801 
modprobe: FATAL: Module i2c_i801 not found in directory /lib/modules/5.4.0-86-generic

However, the module cannot be found in our operating system. Is it the problem of the kernel version that we are using? According to the instructions, our kernel version 5.4.0-86-generic should satisfy the requirement 5.4.x.

OS information:

root@bf2556:~/APS-One-touch-1.5.3# lsb_release -a
LSB Version:    core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic

kernel version:

root@bf2556:~/APS-One-touch-1.5.3# uname -r
5.4.0-86-generic

Could you let me know how to solve this problem? Many thanks.

DINGDAMU commented 3 years ago

The problem is that we upgraded the kernel version from 4.15 to 5.4, but we did not rebuild the modules.

It is possible to solve it with the following command:

sudo apt install linux-modules-5.4.0-86-generic linux-modules-extra-5.4.0-86-generic