BeardOverflow / msi-ec

GNU General Public License v2.0
134 stars 41 forks source link

Modern 15 A5M - modprobe error: Operation not supported #83

Closed pg-goose closed 1 month ago

pg-goose commented 9 months ago

Laptop model

Modern 15 A5M

EC firmware version

No such file or directory

Description

My Laptop is not on the list of tested machines but a very similar model is

Distro: Ubuntu 22.04 Kernel: 6.2.0-33

sudo make

make[1]: Entering directory '/usr/src/linux-headers-6.2.0-33-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /home/pgalopa/development/msi-ec/msi-ec.o
  MODPOST /home/pgalopa/development/msi-ec/Module.symvers
  CC [M]  /home/pgalopa/development/msi-ec/msi-ec.mod.o
  LD [M]  /home/pgalopa/development/msi-ec/msi-ec.ko
  BTF [M] /home/pgalopa/development/msi-ec/msi-ec.ko
Skipping BTF generation for /home/pgalopa/development/msi-ec/msi-ec.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.2.0-33-generic'
sudo make install

mkdir -p /lib/modules/6.2.0-33-generic/extra
cp msi-ec.ko /lib/modules/6.2.0-33-generic/extra
depmod -a
echo msi-ec > /etc/modules-load.d/msi-ec.conf
modprobe -v msi-ec
insmod /lib/modules/6.2.0-33-generic/extra/msi-ec.ko 
modprobe: ERROR: could not insert 'msi_ec': Key was rejected by service
make: *** [Makefile:38: install] Error 1

So I've added -vvv to modprobe command at the makefile and resulted in:

modprobe: ERROR: could not insert 'MODULE': Operation not permitted

A little google-fu and found this article and executed this as root:

echo 1 > /proc/sys/kernel/sysrq
echo x > /proc/sysrq-trigger

Which scares me AF as I don't have any idea of what I'm doing... but as we say in spain 'hemos venido a jugar, no?' (We've come to play, right?) So I repeat the process:

sudo make

make[1]: Entering directory '/usr/src/linux-headers-6.2.0-34-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /home/pgalopa/development/msi-ec/msi-ec.o
  MODPOST /home/pgalopa/development/msi-ec/Module.symvers
  CC [M]  /home/pgalopa/development/msi-ec/msi-ec.mod.o
  LD [M]  /home/pgalopa/development/msi-ec/msi-ec.ko
  BTF [M] /home/pgalopa/development/msi-ec/msi-ec.ko
Skipping BTF generation for /home/pgalopa/development/msi-ec/msi-ec.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.2.0-34-generic'
sudo make install

mkdir -p /lib/modules/6.2.0-34-generic/extra
cp msi-ec.ko /lib/modules/6.2.0-34-generic/extra
depmod -a
echo msi-ec > /etc/modules-load.d/msi-ec.conf
modprobe -v msi-ec
insmod /lib/modules/6.2.0-34-generic/extra/msi-ec.ko 
modprobe: ERROR: could not insert 'msi_ec': Operation not supported
make: *** [Makefile:38: install] Error 1
$ dmesg | grep modprobe

[    2.271431] systemd[1]: Created slice Slice /system/modprobe.
[    2.301049] systemd[1]: modprobe@configfs.service: Deactivated successfully.
[    2.301816] systemd[1]: modprobe@efi_pstore.service: Deactivated successfully.
[    2.302461] systemd[1]: modprobe@fuse.service: Deactivated successfully.
[    2.319332] systemd[1]: modprobe@drm.service: Deactivated successfully.
[    3.135184] audit: type=1400 audit(1696521183.899:3): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe" pid=526 comm="apparmor_parser"
[    3.135192] audit: type=1400 audit(1696521183.899:4): apparmor="STATUS" operation="profile_load" profile="unconfined" name="nvidia_modprobe//kmod" pid=526 comm="apparmor_parser"

Any other troubleshoot steps or is it clear where is the problem? Thanks!! (This repo is an absolut blessing)

glpnk commented 9 months ago

Hi, @pg-goose, your model is not merged to main branch, but you can use draft version from PR #66 with:

  1. Download

    git clone -b modern-15-a5m https://github.com/teackot/msi-ec.git
  2. Make and install

    make
    sudo make install

    If your kernel contains older version of module use load for testing #71

    make
    sudo make load

Main discussion in #57

UPD: Also you can load module from main branch in debug mode by

sudo make load-debug
pg-goose commented 9 months ago

Thanks @glpnk !!

What does make load do?

Trying with Modern 15 A5M branch

I've runned sudo make uninstall clean (just in case), rm the folder and then cloned the branch and got the same result as before I'm afraid...

make

make[1]: Entering directory '/usr/src/linux-headers-6.2.0-34-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  You are using:           gcc-11 (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
  CC [M]  /home/pgalopa/development/msi-ec/msi-ec.o
  MODPOST /home/pgalopa/development/msi-ec/Module.symvers
  CC [M]  /home/pgalopa/development/msi-ec/msi-ec.mod.o
  LD [M]  /home/pgalopa/development/msi-ec/msi-ec.ko
  BTF [M] /home/pgalopa/development/msi-ec/msi-ec.ko
Skipping BTF generation for /home/pgalopa/development/msi-ec/msi-ec.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.2.0-34-generic'
sudo make install 
mkdir -p /lib/modules/6.2.0-34-generic/extra
cp msi-ec.ko /lib/modules/6.2.0-34-generic/extra
depmod -a
echo msi-ec > /etc/modules-load.d/msi-ec.conf
modprobe -v msi-ec
insmod /lib/modules/6.2.0-34-generic/extra/msi-ec.ko 
modprobe: ERROR: could not insert 'msi_ec': Operation not supported
make: *** [Makefile:38: install] Error 1

Trying make load

sudo make load

insmod msi-ec.ko
insmod: ERROR: could not insert module msi-ec.ko: Operation not supported
make: *** [Makefile:21: load] Error 1

Trying sudo make load-debug at main branch

sudo make load-debug

insmod msi-ec.ko debug=1

Seems like it works on 'debug mode'! I wonder which is the difference but I also don't know which may be the problem :S

I've done this, is it useful?


/sys/devices/platform/msi-ec/debug$ cat fw_version ec_dump >> /home/pgalopa/ec_debug_summary.txt

cat /home/pgalopa/ec_debug_summary.txt 

155LEMS1.105

     | _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _a _b _c _d _e _f
-----+------------------------------------------------
0x0_ | 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x2_ | 00 00 00 00 00 00 00 00 00 00 00 80 c0 06 0b 0b
0x3_ | 03 03 01 0d 51 0a 05 00 f8 11 88 2c cc 01 80 00
0x4_ | f8 11 39 00 37 0c d6 05 e5 06 00 2f f4 0b fa 32
0x5_ | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x6_ | 00 00 00 00 00 00 00 00 22 00 32 3a 41 46 5a 5f
0x7_ | 64 2d 2d 3a 41 48 50 55 64 00 03 05 05 05 05 03
0x8_ | 00 00 32 3c 46 52 5a 5d 64 00 2d 32 41 48 50 55
0x9_ | 64 00 03 05 05 06 03 03 02 00 6e 02 00 66 00 00
0xa_ | 31 35 35 4c 45 4d 53 31 2e 31 30 35 30 37 32 38
0xb_ | 32 30 32 31 31 36 3a 31 38 3a 30 32 37 0c 00 28
0xc_ | 00 07 25 0f 00 00 00 00 00 f4 00 a1 00 96 00 00
0xd_ | 00 00 40 00 70 a1 00 00 21 c0 22 80 00 00 00 00
0xe_ | e2 02 00 00 10 00 00 00 00 22 60 00 00 83 00 80
0xf_ | 00 00 c1 82 0d 00 05 00 00 00 00 00 00 00 00 00
glpnk commented 9 months ago

@pg-goose thanks for your report. Your EC firmware version is 105, but version in PR #66 is 106. Frequently settings between versions remain the same. According to change log from MSI service page:

Change log spoiler ```txt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; MSI EC Release Notes ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Model : MS-155L MKT Name : Modern 15 A5M ****************************************************************************; New EC Firmware: 155LEMS1.106 ROM CheckSum : 7EA1 Release date : 2022/1/21 ;--------------------------- Description ------------------------------------; Improve the system stability. ****************************************************************************; New EC Firmware: 155LEMS1.105 ROM CheckSum : 7FF6 Release date : 2021/8/12 ;--------------------------- Description ------------------------------------; 1. Add hotkey: Fn+P(Pause key); Fn+B(Break key); Fn+L(Scrll Lock key) ****************************************************************************; New EC Firmware: 155LEMS1.104 ROM CheckSum : 9AF7 Release date : 2021/7/16 ;--------------------------- Description ------------------------------------; First Release. ```

I think they are the same, so you need to add 155LEMS1.105 to ALLOWED_FW_12 array like this

static const char *ALLOWED_FW_12[] __initconst = {
        "155LEMS1.105",
    "155LEMS1.106", // MSI Modern 15 A5M
    NULL
};

Or you can just update EC

pg-goose commented 9 months ago

After the adding that line the output of sudo make install seems nominal

sudo make install 

mkdir -p /lib/modules/6.2.0-34-generic/extra
cp msi-ec.ko /lib/modules/6.2.0-34-generic/extra
depmod -a
echo msi-ec > /etc/modules-load.d/msi-ec.conf
modprobe -v msi-ec
insmod /lib/modules/6.2.0-34-generic/extra/msi-ec.ko 

Changing the contents of /sys/devices/platform/msi-ec/webcam to off while using it turned off the camera. I would asume that it's working correctly and I can safely tweak other params, correct?

@glpnk If I can do anything else to contribute please feel free to request!

Update

I've went ahead and tweaked some things:

teackot commented 9 months ago

Hi!

cpu/basic_fan_speed

We don't know the address for this one on your firmware yet, it is set to MSI_EC_ADDR_UNKNOWN

fan_mode I don't understand this one, what does it mean that in 'advanced' there are 6 levels? Can I set those? fan speed swiches levels depending on temperature or my input?

There are 4 options:

teackot commented 1 month ago

Closing since no more info is needed yet