SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
3.02k stars 1.23k forks source link

Missing or mismatched architecture in synokernel-usbserial? #5286

Open IngwiePhoenix opened 2 years ago

IngwiePhoenix commented 2 years ago

Is this a new Bug?

Package Name

synokernel-usbserial

Package Version

1.0-7

Device Model

DS413j

Device Architecture

ARMv5

Firmware Version

DSM 6.2.4-25556

What happened?

After installing synokernel-usbserial to obtain the cp210x.ko driver, I still got no driver loaded for a ZigBee stick I plugged in. Digging deeper, I might've found the problem: The module path reported by synoctl-kernelmodule.sh does not have any match.

The output:

$ sudo ./synocli-kernelmodule.sh --spk synokernel-usbserial --config synokernel-usbserial.cfg:ch341,cp210x --udev 60-synokernel-usbserial.rules start
Password:
                     ./synocli-kernelmodule.sh (verbose)
              SynoCommunity kernel driver package name (SPK) [synokernel-usbserial]
                  SynoCommunity configuration file (SPK_CFG) [synokernel-usbserial.cfg]
             SynoCommunity configuration path (SPK_CFG_PATH) [/var/packages/synokernel-usbserial/target/etc]
            SynoCommunity configuration option (SPK_CFG_OPT) [ch341,cp210x]
                                    Synology NAS arch (ARCH) [88f6282]
                          Synology DSM version (DSM_VERSION) [6.2.4]
                               Running kernel version (KVER) [2.6.32.12]
           Module action insmod|rmmod|reload|status (ACTION) [start]
                                 Kernel modules path (MPATH) [/var/packages/synokernel-usbserial/target/lib/modules]
                            Full kernel modules path (KPATH) [/var/packages/synokernel-usbserial/target/lib/modules/88f6282-6.2.4/2.6.32.12]
                                Device firmware path (FPATH) [/var/packages/synokernel-usbserial/target/lib/firmware]
                                   udev rules.d path (UPATH) [/var/packages/synokernel-usbserial/target/rules.d]
                                   udev rules.d file (URULE) [60-synokernel-usbserial.rules]
                               Kernel objects list (KO_LIST) [usbserial ch341 cp210x]
                              Kernel objects found (KO_PATH) [missing: usbserial.ko ch341.ko cp210x.ko]

What I actually find is that at the end of uname -a I have this string: synology_88f6282_413j

Looking at the actual package itself, I only find these folders:

$ ls /volume1/@appstore/synokernel-usbserial/lib/modules/**
/volume1/@appstore/synokernel-usbserial/lib/modules/88f6281-6.1:
2.6.32

/volume1/@appstore/synokernel-usbserial/lib/modules/88f6281-6.2.4:
2.6.32

Notice how the last digit in the arch itself is 1 instead of 2.

This makes me think that this is why the module did not install at all and keeps giving me "Missing kernel modules" errors when trying to do anything.

Have any ideas?

Thanks and kind regards, Ingwie

Reproduction steps

1. Set up a Synology NAS DS413j
2. Enable SSH
3. Add SynoCommunity repo to installer
4. Install USB Serial drivers.

Install Log

2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin preinst
2022/05/27 00:43:03     Begin reload_inst_variables
2022/05/27 00:43:03     End reload_inst_variables
2022/05/27 00:43:03     Begin initialize_variables
2022/05/27 00:43:03     End initialize_variables
2022/05/27 00:43:03     ===> Step preinst. USER= GROUP= SHARE_PATH=
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End preinst ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/rm -rf /volume1/@appstore/synokernel-usbserial
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/rm -rf /volume1/@appstore/synokernel-usbserial ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/package /volume1/@appstore/synokernel-usbserial
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/mv -f /volume1/@tmp/pkginstall/package /volume1/@appstore/synokernel-usbserial ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/rm -rf /var/packages/synokernel-usbserial
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/rm -rf /var/packages/synokernel-usbserial ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/mkdir -p /var/packages/synokernel-usbserial
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/mkdir -p /var/packages/synokernel-usbserial ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/INFO /var/packages/synokernel-usbserial/INFO
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/mv -f /volume1/@tmp/pkginstall/INFO /var/packages/synokernel-usbserial/INFO ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/rm -rf /var/packages/synokernel-usbserial/scripts
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/rm -rf /var/packages/synokernel-usbserial/scripts ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/scripts /var/packages/synokernel-usbserial/scripts
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/mv -f /volume1/@tmp/pkginstall/scripts /var/packages/synokernel-usbserial/scripts ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/rm -rf /var/packages/synokernel-usbserial/conf
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 End /bin/rm -rf /var/packages/synokernel-usbserial/conf ret=[0]
2022/05/27 00:43:03     install synokernel-usbserial 1.0-7 Begin /bin/mv -f /volume1/@tmp/pkginstall/conf /var/packages/synokernel-usbserial/conf
2022/05/27 00:43:04     install synokernel-usbserial 1.0-7 End /bin/mv -f /volume1/@tmp/pkginstall/conf /var/packages/synokernel-usbserial/conf ret=[0]
2022/05/27 00:43:04     install synokernel-usbserial 1.0-7 Begin postinst
2022/05/27 00:43:04     Begin reload_inst_variables
2022/05/27 00:43:04     End reload_inst_variables
2022/05/27 00:43:04     Begin initialize_variables
2022/05/27 00:43:04     End initialize_variables
2022/05/27 00:43:04     ===> Step postinst. USER= GROUP= SHARE_PATH=
2022/05/27 00:43:04     Begin save_wizard_variables
2022/05/27 00:43:04     End save_wizard_variables
2022/05/27 00:43:04     install synokernel-usbserial 1.0-7 End postinst ret=[0]
2022/05/27 00:43:26     install synokernel-usbserial 1.0-7 Begin start-stop-status start
2022/05/27 00:43:26     install synokernel-usbserial 1.0-7 End start-stop-status start ret=[0]
2022/05/27 00:43:29     install synokernel-usbserial 1.0-7 Begin /bin/rm -rf /volume1/@tmp/pkginstall
2022/05/27 00:43:29     install synokernel-usbserial 1.0-7 End /bin/rm -rf /volume1/@tmp/pkginstall ret=[0]
2022/05/27 00:46:19     (system) trigger synokernel-usbserial 1.0-7 Begin start-stop-status stop
2022/05/27 00:46:19     (system) trigger synokernel-usbserial 1.0-7 End start-stop-status stop ret=[0]
2022/05/27 00:50:40     (system) trigger synokernel-usbserial 1.0-7 Begin start-stop-status start
2022/05/27 00:50:40     (system) trigger synokernel-usbserial 1.0-7 End start-stop-status start ret=[0]

Service Log

n/a

Other Logs

Did not seem to have anything in them that wasn't in the installer log already. Sorry.
th0ma7 commented 2 years ago

Hi @IngwiePhoenix I was able to replicate on my DS212j (armv5) and it seems to be due to the kernel extra version (e.g. .12). I'll have to slightly adapt the script to fix that.

But note that the modules won't be automagically loaded after install but rather you will have to invoke the script manually to load them (or add it to your rc.local so they get loaded at boot time).

th0ma7 commented 2 years ago

I was able to fix the issue by changing line 193 of synocli-kernelmodule.sh such as KVER=$(uname -r | awk -F. '{print $1 "." $2 "." $3}'). I'll test on other platforms and confirm it doesn't break anything before releasing an updated synocli-kernel package.

Here's the otuput:

$ sudo ./synocli-kernelmodule.sh --spk synokernel-usbserial --config synokernel-usbserial.cfg:ch341,cp210x --udev 60-synokernel-usbserial.rules start
    [status] kernel modules...
        /drivers/usb/serial/usbserial.ko [usbserial]                        N/A
            /drivers/usb/serial/ch341.ko [ch341]                            N/A
           /drivers/usb/serial/cp210x.ko [cp210x]                           N/A
    [status] of optional udev rules...
                                         [60-synokernel-usbserial.rules]    N/A
Starting synokernel-usbserial ...
    [enable] optional udev rules...
                                         [60-synokernel-usbserial.rules]    OK
    [insmod] kernel modules...
        /drivers/usb/serial/usbserial.ko [usbserial]                        OK
            /drivers/usb/serial/ch341.ko [ch341]                            OK
           /drivers/usb/serial/cp210x.ko [cp210x]                           OK

And related kernel dmesg:

$ sudo dmesg | tail
[1282672.650000] usbcore: registered new interface driver usbserial
[1282672.650000] usbserial: USB Serial Driver core
[1282672.790000] USB Serial support registered for ch341-uart
[1282672.800000] usbcore: registered new interface driver ch341
[1282672.920000] USB Serial support registered for cp210x
[1282672.920000] usbcore: registered new interface driver cp210x
[1282672.930000] cp210x: v0.09:Silicon Labs CP210x RS232 serial adaptor driver
IngwiePhoenix commented 2 years ago

Hello!

But note that the modules won't be automagically loaded after install but rather you will have to invoke the script manually to load them

I am quite new to how the Synology things work; I only have experience with Ubuntu, Debian and Android so I am still feeling my way around :) Bought the NAS by chance.

Looking forward to the update! Thank you for the support.

Kind regards, Ingwie

IngwiePhoenix commented 2 years ago

Hello!

I know you said you would go and test for now; but is there a way I can make the drivers work meanwhile manually?

Thanks and kind regards, Ingwie

th0ma7 commented 2 years ago

Updated package now available (and should show-up in your package center within around 24-48h) https://synocommunity.com/package/synocli-kernel

IngwiePhoenix commented 2 years ago

Just installed it and it's still pointing to the wrong path:

admin@DiskStation:/volume1/@appstore/synocli-kernel/bin$ sudo ./synocli-kernelmodule.sh --spk synokernel-usbserial --config synokernel-usbserial.cfg:ch341,cp210x --udev 60-synokernel-usbserial.rules
 start
Password:
                     ./synocli-kernelmodule.sh (verbose)
              SynoCommunity kernel driver package name (SPK) [synokernel-usbserial]
                  SynoCommunity configuration file (SPK_CFG) [synokernel-usbserial.cfg]
             SynoCommunity configuration path (SPK_CFG_PATH) [/var/packages/synokernel-usbserial/target/etc]
            SynoCommunity configuration option (SPK_CFG_OPT) [ch341,cp210x]
                                    Synology NAS arch (ARCH) [88f6282]
                          Synology DSM version (DSM_VERSION) [6.2.4]
                               Running kernel version (KVER) [2.6.32]
           Module action insmod|rmmod|reload|status (ACTION) [start]
                                 Kernel modules path (MPATH) [/var/packages/synokernel-usbserial/target/lib/modules]
                            Full kernel modules path (KPATH) [/var/packages/synokernel-usbserial/target/lib/modules/88f6282-6.2.4/2.6.32]
                                Device firmware path (FPATH) [/var/packages/synokernel-usbserial/target/lib/firmware]
                                   udev rules.d path (UPATH) [/var/packages/synokernel-usbserial/target/rules.d]
                                   udev rules.d file (URULE) [60-synokernel-usbserial.rules]
                               Kernel objects list (KO_LIST) [usbserial ch341 cp210x]
                              Kernel objects found (KO_PATH) [missing: usbserial.ko ch341.ko cp210x.ko]

   Usage : ./synocli-kernelmodule.sh [-s|--spk <package>] [<insmod,start|rmmod,stop|reload,restart|status>] module1.ko module2.ko ...
          Optional : [-c|--config <file>:<option1>,<option2>,...]
                     [-u|--udev <file>]

                 [-s|--spk <package>] :  SynoCommunity package name containing kernel modules
       [<insmod|rmmod|reload|status>] :  Action to be performed
                          [-h|--help] :  Print this help
                       [-v|--verbose] :  Verbose mode

           Examples :
                     ./synocli-kernelmodule.sh --spk synokernel-cdrom --verbose cdrom sr_mod status
                     ./synocli-kernelmodule.sh --spk synokernel-cdrom --config synokernel-cdrom.cfg:default status
                     ./synocli-kernelmodule.sh --spk synokernel-usbserial --udev 60-synokernel-usbserial.rules usbserial ch341 cp210x status
                     ./synocli-kernelmodule.sh --spk synokernel-usbserial --config synokernel-usbserial.cfg:ch341,cp210x status

ERROR: Missing kernel modules: [usbserial.ko ch341.ko cp210x.ko]

KPATH still uses 88f6282-6.2.4, however that path doesn't exist. Meanwhile, 88f6281 does:

$ tree /var/packages/synokernel-usbserial/target/lib/modules/88f6281-6.2.4/
/var/packages/synokernel-usbserial/target/lib/modules/88f6281-6.2.4/
└── 2.6.32
    └── drivers
        └── usb
            ├── class
            │   └── cdc-acm.ko
            └── serial
                ├── ch341.ko
                ├── cp210x.ko
                ├── ftdi_sio.ko
                ├── pl2303.ko
                ├── ti_usb_3410_5052.ko
                └── usbserial.ko

I verified the update in the GUI, it's definitively there:

image

Anything I can do?

Anonym-tsk commented 2 years ago

+1 still not fixed

th0ma7 commented 2 years ago

Thnx for the reminder, had forgoten by now.

Reading back, I had fixed the 2.6.32.12 vs 2.6.32. But if I get this right, still missing was the CPU arch being 88f6282 vs compiled against 88f6281 ?

Wheras the lookout string could instead be 88f628[1-2]-6.2.4/ (or other regex) on armv5 specifically.

Have I forgoten something?

Anonym-tsk commented 2 years ago

I tested only with 7.1 on apollolake. I created symlink 7.0->7.1 Modules load manually, but after reboot modules don't load automatically.

NoAdO commented 2 years ago

Hello! Looks like i have a similar problem with 918+ and less linux knowledge. The package was installed successfully but no new .ko files were found in /lib/modules/ . My DSM version is 7.1 and tree /var/packages/synokernel-usbserial/target/lib/modules/ contains no 7.1 folders.

NoAdO commented 2 years ago

Well, as nothing happens here for 2 weeks, here's the solution how to manually add drivers: https://github.com/robertklep/dsm7-usb-serial-drivers

david284 commented 1 year ago

Looks like I have the same problem with a DS216j running DSM 6.2 - as above, the package was successfully installed but no drivers added I need the ch341.ko driver to support an RFLink device connected via USB (actually an arduino mega)