LINBIT / drbd

LINBIT DRBD kernel module
https://docs.linbit.com/docs/users-guide-9.0/
GNU General Public License v2.0
587 stars 100 forks source link

New kernel 5.10 compile issue on Debian: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding #55

Closed Intensity closed 1 year ago

Intensity commented 1 year ago

Hi,

I'm mentioning "new" because I've gotten drbd to compile just fine before, and even in the same (Debian 11/x86_64) environment.

I'm using coccinelle version 1.1.0.deb-1.1, as this comes with Debian 11 and this also appears to be a sufficient version according to the documentation. Also, Python is version 3.9. I haven't added anything to the environment.

The compile ends here:

  COMPAT  have_time64_to_tm
  COMPAT  have_timer_setup
  COMPAT  have_void_make_request
  COMPAT  have_void_submit_bio
  COMPAT  ib_alloc_pd_has_2_params
  COMPAT  ib_device_has_ops
  COMPAT  ib_post_send_const_params
  COMPAT  ib_query_device_has_3_params
  COMPAT  need_drbd_wrappers
  COMPAT  need_make_request_recursion
  COMPAT  part_stat_read_takes_block_device
  COMPAT  queue_limits_has_discard_zeroes_data
  COMPAT  rdma_create_id_has_net_ns
  COMPAT  sock_create_kern_has_five_parameters
  COMPAT  sock_ops_returns_addr_len
  COMPAT  struct_gendisk_has_backing_dev_info
  UPD     /usr/local/src/drbd/drbd/compat.5.10.167.h
  UPD     /usr/local/src/drbd/drbd/compat.h
  GENPATCHNAMES   5.10.167
  SPATCH   23697dbdc9be21da652a59bd3892db55  5.10.167
    drbd-kernel-compat/cocci_cache/23697dbdc9be21da652a59bd3892db55/.compat.cocci
    : Python path configuration:
    :   PYTHONHOME = '/usr/lib/x86_64-linux-gnu/..'
    :   PYTHONPATH = '/usr/bin/../lib/coccinelle/python'
    :   program name = 'python3'
    :   isolated = 0
    :   environment = 1
    :   user site = 1
    :   import site = 1
    :   sys._base_executable = '/usr/bin/python3'
    :   sys.base_prefix = '/usr/lib/x86_64-linux-gnu/..'
    :   sys.base_exec_prefix = '/usr/lib/x86_64-linux-gnu/..'
    :   sys.platlibdir = 'lib'
    :   sys.executable = '/usr/bin/python3'
    :   sys.prefix = '/usr/lib/x86_64-linux-gnu/..'
    :   sys.exec_prefix = '/usr/lib/x86_64-linux-gnu/..'
    :   sys.path = [
    :     '/usr/bin/../lib/coccinelle/python',
    :     '/usr/lib/x86_64-linux-gnu/../lib/python39.zip',
    :     '/usr/lib/x86_64-linux-gnu/../lib/python3.9',
    :     '/usr/lib/x86_64-linux-gnu/../lib/python3.9/lib-dynload',
    :   ]
    : Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
    : Python runtime state: core initialized
    : ModuleNotFoundError: No module named 'encodings'
    : 
    : Current thread 0x00007f5f384a7180 (most recent call first):
    : <no Python frame>
make[4]: *** [Makefile:177: drbd-kernel-compat/cocci_cache/23697dbdc9be21da652a59bd3892db55/compat.patch] Error 1
make[3]: *** [/usr/local/src/drbd/drbd/Kbuild:122: /usr/local/src/drbd/drbd/drbd-kernel-compat/compat.patch] Error 2
make[2]: *** [Makefile:1819: /usr/local/src/drbd/drbd] Error 2
make[1]: *** [Makefile:134: kbuild] Error 2
make[1]: Leaving directory '/usr/local/src/drbd/drbd'
make: *** [Makefile:126: module] Error 2
MatReiKIT commented 1 year ago

Hi, i got into the same problem on 2 of my machines. For me, my machines are fresh installed, so i can't say it was compiling in the past.

But i wanted to share that i was able to fix this error on my machines by installing the python-is-python3 package from the debian repo.

Maybe this is useful to someone.

rck commented 1 year ago

that is known and I had to fix the same in "spatch as a service" some months ago, adding this, and one more python dependency: https://github.com/LINBIT/saas/commit/7bef2e7976a455550bce2533487c635f20390ccf