Jump to content

djurny

Members
  • Posts

    66
  • Joined

  • Last visited

Posts posted by djurny

  1. Hi Nathan,

    This is something that indeed is done by mdadm configuration. You need to check /etc/cron.d/mdadm:

    #
    # cron.d/mdadm -- schedules periodic redundancy checks of MD devices
    #
    # Copyright © martin f. krafft <madduck@madduck.net>
    # distributed under the terms of the Artistic Licence 2.0
    #
    
    # By default, run at 00:57 on every Sunday, but do nothing unless the day of
    # the month is less than or equal to 7. Thus, only run on the first Sunday of
    # each month. crontab(5) sucks, unfortunately, in this regard; therefore this
    # hack (see #380425).
    57 0 * * 0 root if [ -x /usr/share/mdadm/checkarray ] && [ $(date +\%d) -le 7 ]; then /usr/share/mdadm/checkarray --cron --all --idle --quiet; fi

    You can either disable this cronjob by commenting out the actual cron entry, or by moving the file 'mdadm' out of the '/etc/cron.d' folder.

     

    Easiest would be to write a script that will iterare all mdadm devices, start the redundancy check, wait for the check to complete. then move to the next mdadm device.

     

    Something like:

    #!/bin/bash
    
    case "$( /usr/bin/id -u )" in
    '0')
    	;;
    *)
    	echo "Please run as root user."
    	exit 1
    	;;
    esac
    
    for MD in /dev/md[0-9]*
    do
    	SYNC_ACTION="/sys/block/${MD:?}/md/sync_action"
    	( echo 'check' > "${SYNC_ACTION:?}" ) || exit 1
    
    	while true
    	do
    		case "$( /usr/bin/cat "${SYNC_ACTION:?}" )" in
    		'')
    			exit
    			;;
    		'idle') 
    			break
    			;;
    		esac
    		sleep 10
    	done
    done
    
    # EOF

     

    Note that that code snippet was not tested, but should give you direction to your solution.

     

    Hope that helps,

    Groetjes,

  2. Hi,

    I still have this issue occur occasionally and was not successful in finding & building the v1.11 version of the r8152 kernel module. The symptoms included:

    1. lan0 (the USB attached NIC) sometimes disappeared.
    2. Entire broadcast domain stopped responding:
      1. helios64 reported:
        rk_gmac-dwmac fe300000.ethernet eth0: Reset adapter.

         

      2. orangepi zero reported:
        dwmac-sun8i 1c30000.ethernet eth0: Reset adapter.
      3. nanopi R2S sometimes reported messages about TX buffer/queue overflow (cannot locate this message anymore unfortunately).
      4. The NIC activity LED on one of the nanopi R2S boxen was showing a high amounts of traffic.
      5. The broadcast domain started working again, after I disconnected lan0 NIC of the nanopi R2S from local network.

    These symptoms reminded me of some incident we encountered during my daytime profession; an unresponsive broadcast domain, while all hardware was still OK. Turned out that one device on that network borked out and started flooding the broadcast domain with PAUSE frames, which are broadcast by the first switch it encounters. This will in turn cause all other devices to stop transmitting data as well, leading to the entire broadcast domain to come to a halt.

     

    Knowing this, I tried to disable the PAUSE options from the USB NIC on buster, but this seemed not possible:

    root@nanopi0:~# ethtool -A lan0 autoneg off rx off tx off
    Cannot get device pause settings: Operation not supported

     

    I tried to upgrade to bullseye, and lo and behold, the PAUSE option could be (partially) disabled on the USB NIC (lan0):

    root@nanopi1:~# ethtool -a lan0
    Pause parameters for lan0:
    Autonegotiate:  on
    RX:             off
    TX:             off
    RX negotiated: off
    TX negotiated: off

     

    Currently running bullseye and will keep monitoring. Hopefully either the upgrade to bullseye (or the disabling of PAUSE frames) will prevent this issue from popping up every now and then.

     

    (It had a habit of popping up, when I was away from home, making it impossible to connect to my home network from outside anymore.)

     

    Perhaps this might also help someone here?

    Groetjes,
     

    Spoiler

    Old version:

    Linux nanopi0 5.10.63-rockchip64 #21.08.2 SMP PREEMPT Wed Sep 8 10:57:23 UTC 2021 aarch64 GNU/Linux
    Description:    Debian GNU/Linux 10 (buster)

     

    New version:

    Linux nanopi1 5.15.25-rockchip64 #22.02.1 SMP PREEMPT Sun Feb 27 09:05:47 UTC 2022 aarch64 GNU/Linux
    Description:    Debian GNU/Linux 11 (bullseye)

     

     

  3. Hi Nick,

    That's interesting. After some trial and error on my box, I also could not get it to work on kernel version 5.9.13 (21.02.0-trunk.16).

     

    What happens if you put the "activity" in the trigger file? If I do that on my box, it does seem to light up almost in the same cadence as the activity LED on the ethernet connector.

    echo 'activity' | sudo tee '/sys/class/leds/helios64:blue:net/trigger'

    Note that this is not 'activity' of the network, but activity in the form of CPU activity. Not exactly what you are looking for, but this does seem to generate at least some action on the LED.

    Groetjes,

  4. Hi @IgorS,

    After following the how to's on this forum and the internets, would like to share some other things I did to make it work even better on my OrangePi Zero.

     

    1. Connect DS3231 to TWI0 (PA11+PA12 and +5V/GND of course).
       
    2. Add i2c0 overlay to /boot/armbianEnv.txt (or use armbian-config to enable the i2c0 overlay).
      [...]
      overlays=usbhost2 usbhost3 uart1 pps-gpio i2c0
      [...]

       

    3. Add custom overlay to add DS3231 RTC (using DS3232 module instead of DS1307).
      Spoiler
      /dts-v1/;
      /plugin/;
      
      / {
              compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
      
              /* 
               * Aliases can be used to set the external RTC as rtc0.
               * Needs supplying the correct path to the I2C controller RTC is connected to,
               * this example is for I2C0 on H2+ (TWI0 on PA11/PA12).
               * NOTE: setting time at boot by the kernel
               * may not work in some cases if the external RTC module is loaded too late
               */
              fragment@0 {
                      target-path = "/aliases";
                      __overlay__ {
                              rtc0 = "/soc/i2c@1c2ac00/ds3231@68";
                      };
              };
      
              fragment@1 {
                      target = <&i2c0>;
                      __overlay__ {
                              #address-cells = <1>;
                              #size-cells = <0>;
                              ds3231@68 {
                                      compatible = "dallas,ds3232";
                                      reg = <0x68>;
                                      status = "okay";
                              };
                      };
              };
      
      };

       

      Save as rtc0-i2c0-ds3231.dts.
       

    4. Add the custom DT overlay:
      sudo armbian-add-overlay rtc0-i2c0-ds3231.dts

       

    5. Add custom overlay to rename H2+ SoC RTC to rtc1.
      Spoiler
      /dts-v1/;
      /plugin/;
      
      / {
              compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
      
              /* 
               * Aliases can be used to set the internal RTC as rtc1.
               */
              fragment@0 {
                      target-path = "/aliases";
                      __overlay__ {
                              rtc1 = "/soc/rtc@1f00000";
                      };
              };
      
              fragment@1 {
                      target = <&rtc>;
                      __overlay__ {
                              rtc@1f00000 {
                                      status = "disabled";
                              };
                      };
              };
      };

       

      Save as rtc1-soc.dts.
       

    6. Add the custom DT overlay:
      sudo armbian-add-overlay rtc1-soc.dts

       

    7. Disable fake-hwclock service:
      sudo systemctl stop fake-hwclock.service    # stop
      sudo systemctl disable fake-hwclock.service # disable
      sudo systemctl mask fake-hwclock.service    # really disable
    8. Reboot and verify that you now have 2x RTC on your OrangePi Zero:
      root@sinaspi:~# ls -l /dev/rtc*
      lrwxrwxrwx 1 root root      4 Aug  5 22:57 /dev/rtc -> rtc0
      crw------- 1 root root 253, 0 Aug  5 22:57 /dev/rtc0
      crw------- 1 root root 253, 1 Aug  5 22:57 /dev/rtc1
    9. As mentioned in another post, on the H2+ the SoC supplied RTC is indeed running fast, confirm this as follows:
      for RTC in /dev/rtc[0-9]
      do
      	hwclock --rtc="${RTC:?}" --adjust
      	hwclock --rtc="${RTC:?}" --systohc
      done
      
      sleep $(( 5 * 60 ))
      
      for RTC in /dev/rtc[0-9]
      do
      	echo "${RTC:-N/A}:"
      	hwclock --rtc="${RTC:?}" --get 
      	date --rfc-3339=ns
      done

      On my OrangePi Zero the SoC RTC is dashing ahead:
       

      /dev/rtc0:
      2021-08-08 09:17:52.760046+08:00
      2021-08-08 09:17:52.526062078+08:00
      /dev/rtc1:
      2021-08-08 11:59:11.150733+08:00
      2021-08-08 09:17:54.392611945+08:00

      (rtc0 = DS3231 and rtc1 = SoC RTC.)
       

    10. On the same OrangePi Zero, there is also a GPS receiver connected that has PPS output. Used @Elektrický's how to, to set up GPS and ntpsec. After successfully following the how to, ntp will synchronize and adjust system clock to high(er) accuracy. Once system clock is synchronized, the kernel will also update the RTC (/dev/rtc0) every 11 minutes, giving you a system as follows:

      root@sinaspi:~# timedatectl 
                     Local time: Sun 2021-08-08 09:24:01 CST
                 Universal time: Sun 2021-08-08 01:24:01 UTC
                       RTC time: Sun 2021-08-08 01:24:02
                      Time zone: Asia/Taipei (CST, +0800)
      System clock synchronized: yes
                    NTP service: inactive
                RTC in local TZ: no
      
      root@sinaspi:~# ntpq -p
           remote                                   refid      st t when poll reach   delay   offset   jitter
      =======================================================================================================
       0.debian.pool.ntp.org                   .POOL.          16 p    -  256    0   0.0000   0.0000   0.0019
       1.debian.pool.ntp.org                   .POOL.          16 p    -  256    0   0.0000   0.0000   0.0019
       2.debian.pool.ntp.org                   .POOL.          16 p    -  256    0   0.0000   0.0000   0.0019
       3.debian.pool.ntp.org                   .POOL.          16 p    -   64    0   0.0000   0.0000   0.0019
      oPPS(0)                                  .PPS.            0 l   56   64  377   0.0000  -0.0072   0.0035
      xSHM(0)                                  .GPS.            0 l   21   64  377   0.0000 -15.3659   1.7862
      +SHM(2)                                  .PPS.            0 l   18   64  377   0.0000  -0.0163   0.0094
      +europa.ellipse.net                      209.180.247.49   2 u   40   64  377 167.9069  -0.9358   0.1437
      +ntp1.time.nl                            .MRS.            1 u   43   64  377 210.9643   1.7869   0.1945
      +promethee.boudot.one                    94.198.159.10    2 u   21   64  377 220.2528   2.3322   0.0931
      root@sinaspi:~# 

      As the DS3231 is now set as rtc0, the udev rules in /lib/udev/rules.d/85-hwclock.rules will make sure to read the DS3231 clock time after a reboot, making sure your system clock has a nice starting offset after being powered off for a while.

     

    Hope this helps anyone out there,

    Groetjes,

  5. Hi,

    I found myself in a similar situation, (on OrangePi Zero, but method described here should also apply here) where my I2C based DS3231 was detected last (rtc1) and the SoC's RTC detected first (rtc0). Looks like all kernel and userspace processes & tools use first detected RTC only (11 minute sync), timedatectl, ntp[sec]d. Tried some udev rules to rename the devices based on their DEVPATH, but this did not work. I also did not want to start renaming device nodes or do some symbolic link cooking to get it to work.

     

    What did work (for my OrangePi Zero): Add an overlay where the SoC's RTC is aliased to rtc1 and the I2C based one is aliased as rtc0:

     

    /dts-v1/;
    /plugin/;
    
    / {
            compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
    
            /* 
             * Aliases can be used to set the external RTC as rtc0
             * Needs supplying the correct path to the I2C controller RTC is connected to,
             * this example is for I2C0 on H2+ (TWI0 on PA11 + PA12)
             * NOTE: setting time at boot by the kernel
             * may not work in some cases if the external RTC module is loaded too late
             */
            fragment@0 {
                    target-path = "/aliases";
                    __overlay__ {
                            rtc0 = "/soc/i2c@1c2ac00/ds3231@68";
                    };
            };
    
            fragment@1 {
                    target = <&i2c0>;
                    __overlay__ {
                            #address-cells = <1>;
                            #size-cells = <0>;
                            ds3231@68 {
                                    compatible = "dallas,ds3232";
                                    reg = <0x68>;
                                    status = "okay";
                            };
                    };
            };
    
            fragment@2 {
                    target-path = "/aliases";
                    __overlay__ {
                            rtc1 = "/soc/rtc@1f00000";
                    };
            };
    
            fragment@3 {
                    target = <&rtc>;
                    __overlay__ {
                            rtc@1f00000 {
                                    status = "disabled";
                            };
                    };
            };
    };

     

    The SoC's RTC location should be matched to your SoC in fragments 2 and 3 (or remove fragmet 3 altogether).

    Also, the 'compatible' line should be modified to match your SoC's/board's DT as well.

     

    The overlay is based on the one available here. Modified the ds1307 to ds3232 after reading this post. Added the fragments 2 and 3 to alias the SoC's RTC to rtc1, the 'disable' part is not working.

     

    Hope this helps for you as well:

    Groetjes,

  6. Hi,

    I have a similar possible identical issue. One of my NanoPi R2S systems is running as my VPN gateway (for both data and Pihole DNS). On several occasions my Pihole get shut (pun intended) -- DNS stops working due to my VPN gateway being unreachable on it's LAN side. On the serial console there are no warnings, errors or messages of any kind, bar armbianmonitor.

    02:09:48:  408MHz  0.04   1%   0%   0%   0%   0%   0% 50.8°C  0/5
    02:09:53:  600MHz  0.04   2%   1%   0%   0%   0%   0% 51.2°C  0/5
    02:09:58: 1200MHz  0.27   6%   4%   0%   1%   0%   0% 53.3°C  0/5
    02:10:03:  408MHz  0.25   3%   1%   1%   0%   0%   0% 50.8°C  0/5
    02:10:08:  408MHz  0.31   1%   0%   0%   0%   0%   0% 51.7°C  0/5
    02:10:14:  408MHz  0.41   1%   1%   0%   0%   0%   0% 50.8°C  0/5
    02:10:19:  408MHz  0.38   1%   0%   0%   0%   0%   0% 51.7°C  0/5
    02:10:24:  408MHz  0.43   1%   1%   0%   0%   0%   0% 50.4°C  0/5
    Time        CPU    load %cpu %sys %usr %nice %io %irq   CPU  C.St.
    02:10:29: 1200MHz  0.55   5%   4%   0%   0%   0%   0% 52.1°C  0/5
    02:10:34:  600MHz  0.67   1%   1%   0%   0%   0%   0% 50.8°C  0/5
    02:10:39:  408MHz  0.78   1%   1%   0%   0%   0%   0% 51.2°C  0/5
    02:10:45:  408MHz  0.87   2%   1%   0%   0%   0%   0% 50.4°C  0/5
    02:10:50:  600MHz  0.96   1%   1%   0%   0%   0%   0% 50.8°C  0/5
    02:10:55:  408MHz  1.05   1%   1%   0%   0%   0%   0% 52.5°C  0/5

    The interesting thing is that the load number seems to increase at some point: where it was average around well below 0.8 before, it started to creep up to around 7.00.

    07:23:16:  408MHz  7.05   1%   1%   0%   0%   0%   0% 51.2°C  0/5
    07:23:21: 1200MHz  7.05   1%   1%   0%   0%   0%   0% 52.5°C  0/5
    07:23:26: 1200MHz  7.04   2%   2%   0%   0%   0%   0% 54.6°C  0/5

     

    After attempting to log in on the serial console, there was nothing in 'top' indicating any processes were hogging up the cores causing high load numbers at all:

    Spoiler
    Tasks: 129 total,   1 running, 128 sleeping,   0 stopped,   0 zombie
    %Cpu(s):  3.5 us,  4.7 sy,  0.0 ni, 91.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    MiB Mem :    978.0 total,    328.7 free,    116.5 used,    532.9 buff/cache
    MiB Swap:      0.0 total,      0.0 free,      0.0 used.    766.2 avail Mem 
    
      PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND    
      662 root      20   0    8976   3068   2656 R  15.0   0.3   0:00.07 top        
        1 root      20   0  166444   9816   7116 S   0.0   1.0   0:31.19 systemd    
        2 root      20   0       0      0      0 S   0.0   0.0   0:01.80 kthreadd   
        3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp     
        4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp 
        8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu+ 
        9 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks+ 
       10 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks+ 
       11 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks+ 
       12 root      20   0       0      0      0 S   0.0   0.0   1:16.02 ksoftirqd+ 
       13 root      20   0       0      0      0 I   0.0   0.0   4:08.37 rcu_preem+ 
       14 root      rt   0       0      0      0 S   0.0   0.0   0:00.32 migration+ 
       15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0    
       16 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/1    
       17 root      rt   0       0      0      0 S   0.0   0.0   0:00.35 migration+ 
       18 root      20   0       0      0      0 S   0.0   0.0   1:05.48 ksoftirqd+ 
       21 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/2

     

    (Note that I did have to "terminate all tasks" using <BRK>+e  to be able to login on the serial console, so the 'top' results might be useless here.)

     

    Currently I have added the udev rule to the system to disable TX and RX offloading, as well as to disable the link power management for the RTL8153 device.

    SUBSYSTEM!="net", GOTO="__rtl815x_end"
    ACTION!="add",    GOTO="__rtl815x_end"
    
    ENV{ID_VENDOR_ID}!="0bda",  GOTO="__rtl815x_end"
    ENV{ID_MODEL_ID}!="8153",   GOTO="__rtl815x_end"
    
    LABEL="__rtl815x_disable_lpm"
    RUN+="/bin/sh -c 'echo %E{ID_VENDOR_ID}:%E{ID_MODEL_ID}:k > /sys/module/usbcore/parameters/quirks'"
    
    LABEL="__rtl815x_disable_offloading"
    RUN+="/usr/sbin/ethtool -K $name rx off tx off"
    
    LABEL="__rtl815x_end"

    (Bit modified to also apply to any other RTL8153 device, to use the assigned name instead of hardcoded 'lan0'.)

     

    Spoilers below on 'blocked task state' show some links to the r8152 module and RTL8153 device.

    Spoiler
    [426200.919448] sysrq: Show Blocked State
    [426200.919840] task:ntpd            state:D stack:    0 pid: 1378 ppid:     1 flags:0x00000001
    [426200.920583] Call trace:
    [426200.920817]  __switch_to+0x100/0x158
    [426200.921145]  __schedule+0x268/0x758
    [426200.921463]  schedule+0x40/0xf8
    [426200.921751]  schedule_preempt_disabled+0x18/0x30
    [426200.922167]  __mutex_lock.isra.13+0x16c/0x538
    [426200.922562]  __mutex_lock_slowpath+0x14/0x20
    [426200.922948]  mutex_lock+0x38/0x50
    [426200.923252]  __netlink_dump_start+0x90/0x278
    [426200.923638]  rtnetlink_rcv_msg+0x248/0x338
    [426200.924009]  netlink_rcv_skb+0x5c/0x120
    [426200.924356]  rtnetlink_rcv+0x18/0x28
    [426200.924681]  netlink_unicast+0x1b8/0x278
    [426200.925037]  netlink_sendmsg+0x1d4/0x3e0
    [426200.925393]  sock_sendmsg+0x4c/0x58
    [426200.925712]  __sys_sendto+0xd4/0x140
    [426200.926037]  __arm64_sys_sendto+0x28/0x38
    [426200.926403]  el0_svc_common.constprop.2+0x8c/0x190
    [426200.926833]  do_el0_svc+0x24/0x90
    [426200.927136]  el0_svc+0x14/0x20
    [426200.927416]  el0_sync_handler+0x90/0xb8
    [426200.927763]  el0_sync+0x160/0x180
    [426200.928080] task:atop            state:D stack:    0 pid:22113 ppid:     1 flags:0x00000001
    [426200.928821] Call trace:
    [426200.929050]  __switch_to+0x100/0x158
    [426200.929376]  __schedule+0x268/0x758
    [426200.929693]  schedule+0x40/0xf8
    [426200.929982]  rpm_resume+0x13c/0x718
    [426200.930300]  rpm_resume+0x280/0x718
    [426200.930616]  __pm_runtime_resume+0x3c/0x88
    [426200.930987]  usb_autopm_get_interface+0x24/0x60
    [426200.931407]  rtl8152_get_link_ksettings+0x40/0x390 [r8152]
    [426200.931899]  ethtool_get_settings+0x68/0x1f0
    [426200.932285]  dev_ethtool+0x174/0x20b0
    [426200.932617]  dev_ioctl+0x1f0/0x388
    [426200.932927]  sock_do_ioctl+0x104/0x2c8
    [426200.933266]  sock_ioctl+0x320/0x520
    [426200.933584]  __arm64_sys_ioctl+0xa8/0xe8
    [426200.933941]  el0_svc_common.constprop.2+0x8c/0x190
    [426200.934372]  do_el0_svc+0x24/0x90
    [426200.934676]  el0_svc+0x14/0x20
    [426200.934956]  el0_sync_handler+0x90/0xb8
    [426200.935303]  el0_sync+0x160/0x180
    [426200.935607] task:kworker/0:1     state:D stack:    0 pid: 5745 ppid:     2 flags:0x00000028
    [426200.936355] Workqueue: ipv6_addrconf addrconf_verify_work
    [426200.936839] Call trace:
    [426200.937067]  __switch_to+0x100/0x158
    [426200.937392]  __schedule+0x268/0x758
    [426200.937710]  schedule+0x40/0xf8
    [426200.937998]  schedule_preempt_disabled+0x18/0x30
    [426200.938415]  __mutex_lock.isra.13+0x16c/0x538
    [426200.938808]  __mutex_lock_slowpath+0x14/0x20
    [426200.939194]  mutex_lock+0x38/0x50
    [426200.939498]  rtnl_lock+0x18/0x28
    [426200.939794]  addrconf_verify_work+0x10/0x28
    [426200.940174]  process_one_work+0x1ec/0x4d0
    [426200.940537]  worker_thread+0x48/0x478
    [426200.940869]  kthread+0x140/0x150
    [426200.941165]  ret_from_fork+0x10/0x34
    [426200.941488] task:kworker/2:2     state:D stack:    0 pid: 9367 ppid:     2 flags:0x00000028
    [426200.942233] Workqueue: pm pm_runtime_work
    [426200.942595] Call trace:
    [426200.942823]  __switch_to+0x100/0x158
    [426200.943149]  __schedule+0x268/0x758
    [426200.943467]  schedule+0x40/0xf8
    [426200.943753]  schedule_timeout+0x188/0x368
    [426200.944116]  msleep+0x2c/0x40
    [426200.944390]  napi_disable+0x58/0x100
    [426200.944720]  rtl8152_suspend+0x308/0x468 [r8152]
    [426200.945136]  usb_suspend_both+0x90/0x240
    [426200.945492]  usb_runtime_suspend+0x30/0x80
    [426200.945862]  __rpm_callback+0x100/0x150
    [426200.946211]  rpm_callback+0x5c/0x88
    [426200.946527]  rpm_suspend.part.12+0xd8/0x568
    [426200.946905]  pm_runtime_work+0xb4/0x2b0
    [426200.947252]  process_one_work+0x1ec/0x4d0
    [426200.947614]  worker_thread+0x48/0x478
    [426200.947946]  kthread+0x140/0x150
    [426200.948241]  ret_from_fork+0x10/0x34
    [426200.948565] task:kworker/3:3     state:D stack:    0 pid:11994 ppid:     2 flags:0x00000028
    [426200.949314] Workqueue: events rtl_work_func_t [r8152]
    [426200.949767] Call trace:
    [426200.949995]  __switch_to+0x100/0x158
    [426200.950320]  __schedule+0x268/0x758
    [426200.950639]  schedule+0x40/0xf8
    [426200.950926]  rpm_resume+0x13c/0x718
    [426200.951243]  rpm_resume+0x280/0x718
    [426200.951560]  __pm_runtime_resume+0x3c/0x88
    [426200.951929]  usb_autopm_get_interface+0x24/0x60
    [426200.952341]  rtl_work_func_t+0x74/0x3f8 [r8152]
    [426200.952750]  process_one_work+0x1ec/0x4d0
    [426200.953113]  worker_thread+0x48/0x478
    [426200.953446]  kthread+0x140/0x150
    [426200.953741]  ret_from_fork+0x10/0x34
    [426200.954069] task:ping            state:D stack:    0 pid:19888 ppid: 19885 flags:0x00000024
    [426200.954811] Call trace:
    [426200.955038]  __switch_to+0x100/0x158
    [426200.955365]  __schedule+0x268/0x758
    [426200.955682]  schedule+0x40/0xf8
    [426200.955970]  schedule_preempt_disabled+0x18/0x30
    [426200.956387]  __mutex_lock.isra.13+0x16c/0x538
    [426200.956780]  __mutex_lock_slowpath+0x14/0x20
    [426200.957167]  mutex_lock+0x38/0x50
    [426200.957470]  rtnl_lock+0x18/0x28
    [426200.957766]  ip6mr_sk_done+0x38/0xe8
    [426200.958091]  rawv6_close+0x28/0x68
    [426200.958403]  inet_release+0x50/0xa8
    [426200.958720]  inet6_release+0x34/0x50
    [426200.959045]  __sock_release+0x44/0xb8
    [426200.959376]  sock_close+0x18/0x28
    [426200.959680]  __fput+0x78/0x230
    [426200.959960]  ____fput+0x10/0x20
    [426200.960248]  task_work_run+0x88/0xc8
    [426200.960574]  do_exit+0x370/0xab8
    [426200.960869]  do_group_exit+0x44/0xa0
    [426200.961193]  __wake_up_parent+0x0/0x30
    [426200.961534]  el0_svc_common.constprop.2+0x8c/0x190
    [426200.961965]  do_el0_svc+0x24/0x90
    [426200.962267]  el0_svc+0x14/0x20
    [426200.962548]  el0_sync_handler+0x90/0xb8
    [426200.962895]  el0_sync+0x160/0x180
    [426200.963196] task:ip              state:D stack:    0 pid:29248 ppid:  1373 flags:0x00000000
    [426200.963936] Call trace:
    [426200.964164]  __switch_to+0x100/0x158
    [426200.964489]  __schedule+0x268/0x758
    [426200.964807]  schedule+0x40/0xf8
    [426200.965096]  schedule_preempt_disabled+0x18/0x30
    [426200.965513]  __mutex_lock.isra.13+0x16c/0x538
    [426200.965906]  __mutex_lock_slowpath+0x14/0x20
    [426200.966291]  mutex_lock+0x38/0x50
    [426200.966594]  rtnetlink_rcv_msg+0xe4/0x338
    [426200.966956]  netlink_rcv_skb+0x5c/0x120
    [426200.967303]  rtnetlink_rcv+0x18/0x28
    [426200.967628]  netlink_unicast+0x1b8/0x278
    [426200.967983]  netlink_sendmsg+0x1d4/0x3e0
    [426200.968339]  sock_sendmsg+0x4c/0x58
    [426200.968657]  ____sys_sendmsg+0x284/0x2c8
    [426200.969013]  ___sys_sendmsg+0x84/0xc8
    [426200.969346]  __sys_sendmsg+0x6c/0xc0
    [426200.969672]  __arm64_sys_sendmsg+0x24/0x30
    [426200.970043]  el0_svc_common.constprop.2+0x8c/0x190
    [426200.970473]  do_el0_svc+0x24/0x90
    [426200.970776]  el0_svc+0x14/0x20
    [426200.971056]  el0_sync_handler+0x90/0xb8
    [426200.971403]  el0_sync+0x160/0x180
    [426200.971712] task:ip              state:D stack:    0 pid:29980 ppid: 29979 flags:0x00000001
    [426200.972452] Call trace:
    [426200.972680]  __switch_to+0x100/0x158
    [426200.973006]  __schedule+0x268/0x758
    [426200.973324]  schedule+0x40/0xf8
    [426200.973613]  schedule_preempt_disabled+0x18/0x30
    [426200.974030]  __mutex_lock.isra.13+0x16c/0x538
    [426200.974422]  __mutex_lock_slowpath+0x14/0x20
    [426200.974808]  mutex_lock+0x38/0x50
    [426200.975111]  __netlink_dump_start+0x90/0x278
    [426200.975496]  rtnetlink_rcv_msg+0x248/0x338
    [426200.975866]  netlink_rcv_skb+0x5c/0x120
    [426200.976214]  rtnetlink_rcv+0x18/0x28
    [426200.976540]  netlink_unicast+0x1b8/0x278
    [426200.976895]  netlink_sendmsg+0x1d4/0x3e0
    [426200.977250]  sock_sendmsg+0x4c/0x58
    [426200.977568]  __sys_sendto+0xd4/0x140
    [426200.977892]  __arm64_sys_sendto+0x28/0x38
    [426200.978257]  el0_svc_common.constprop.2+0x8c/0x190
    [426200.978688]  do_el0_svc+0x24/0x90
    [426200.978991]  el0_svc+0x14/0x20
    [426200.979271]  el0_sync_handler+0x90/0xb8
    [426200.979617]  el0_sync+0x160/0x180
    [426200.979921] task:sudo            state:D stack:    0 pid:30561 ppid: 30516 flags:0x00000001
    [426200.980662] Call trace:
    [426200.980889]  __switch_to+0x100/0x158
    [426200.981215]  __schedule+0x268/0x758
    [426200.981532]  schedule+0x40/0xf8
    [426200.981821]  schedule_preempt_disabled+0x18/0x30
    [426200.982237]  __mutex_lock.isra.13+0x16c/0x538
    [426200.982630]  __mutex_lock_slowpath+0x14/0x20
    [426200.983015]  mutex_lock+0x38/0x50
    [426200.983318]  __netlink_dump_start+0x90/0x278
    [426200.983703]  rtnetlink_rcv_msg+0x248/0x338
    [426200.984073]  netlink_rcv_skb+0x5c/0x120
    [426200.984421]  rtnetlink_rcv+0x18/0x28
    [426200.984746]  netlink_unicast+0x1b8/0x278
    [426200.985102]  netlink_sendmsg+0x1d4/0x3e0
    [426200.985457]  sock_sendmsg+0x4c/0x58
    [426200.985774]  __sys_sendto+0xd4/0x140
    [426200.986099]  __arm64_sys_sendto+0x28/0x38
    [426200.986463]  el0_svc_common.constprop.2+0x8c/0x190
    [426200.986893]  do_el0_svc+0x24/0x90
    [426200.987195]  el0_svc+0x14/0x20
    [426200.987476]  el0_sync_handler+0x90/0xb8
    [426200.987823]  el0_sync+0x160/0x180

     

     

    Backtrace of all active CPUs below.

    Spoiler
    [426121.505605] sysrq: Show backtrace of all active CPUs
    [426121.506080] sysrq: CPU0:
    [426121.506336] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G         C        5.10.43-rockchip64 #21.05.4
    [426121.507130] Hardware name: FriendlyElec NanoPi R2S (DT)
    [426121.507613] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
    [426121.508173] pc : arch_cpu_idle+0x18/0x28
    [426121.508544] lr : arch_cpu_idle+0x10/0x28
    [426121.508909] sp : ffff8000118b3e90
    [426121.509222] x29: ffff8000118b3e90 x28: ffff800011510108 
    [426121.509725] x27: 0000000000000000 x26: ffff8000118c3ac0 
    [426121.510226] x25: 0000000000000000 x24: ffff800011307b70 
    [426121.510727] x23: ffff80001157e8b8 x22: ffff8000118b9948 
    [426121.511228] x21: ffff8000118ba2e8 x20: 0000000000000001 
    [426121.511728] x19: ffff8000118ba208 x18: 0000000000000000 
    [426121.512228] x17: 0000000000000000 x16: 0000000000000000 
    [426121.512728] x15: 0000000000000000 x14: 0000000000000000 
    [426121.513229] x13: 0000000000000000 x12: 0000000000000002 
    [426121.513729] x11: 0000000000000000 x10: 0000000000000a40 
    [426121.514229] x9 : ffff8000118b3de0 x8 : ffff8000118c4560 
    [426121.514730] x7 : 0000000000003b3e x6 : 0000094d2d44750d 
    [426121.515230] x5 : 00ffffffffffffff x4 : ffff80002e7c8000 
    [426121.515731] x3 : 0000000000000001 x2 : 0000000000000000 
    [426121.516230] x1 : 00000000778bc530 x0 : 00000000000000e0 
    [426121.516732] Call trace:
    [426121.516979]  arch_cpu_idle+0x18/0x28
    [426121.517320]  default_idle_call+0x44/0x1bc
    [426121.517699]  do_idle+0x204/0x278
    [426121.518009]  cpu_startup_entry+0x24/0x60
    [426121.518380]  rest_init+0xd4/0xe4
    [426121.518692]  arch_call_rest_init+0x10/0x1c
    [426121.519080]  start_kernel+0x818/0x850
    [426121.519534] sysrq: CPU2:
    [426121.519786] Call trace:
    [426121.520037]  dump_backtrace+0x0/0x200
    [426121.520389]  show_stack+0x18/0x28
    [426121.520708]  showacpu+0x68/0x80
    [426121.521015]  flush_smp_call_function_queue+0x100/0x250
    [426121.521495]  generic_smp_call_function_single_interrupt+0x14/0x20
    [426121.522056]  ipi_handler+0x7c/0x370
    [426121.522394]  handle_percpu_devid_fasteoi_ipi+0x9c/0x1f0
    [426121.522878]  generic_handle_irq+0x30/0x48
    [426121.523254]  __handle_domain_irq+0x94/0x108
    [426121.523650]  gic_handle_irq+0xc4/0xe0
    [426121.523997]  el1_irq+0xc8/0x180
    [426121.524304]  ep_item_poll.isra.24+0x68/0xe0
    [426121.524701]  ep_scan_ready_list.isra.23+0xa4/0x1d0
    [426121.525147]  ep_poll+0x100/0x3b8
    [426121.525461]  do_epoll_wait+0xd8/0x128
    [426121.525812]  __arm64_sys_epoll_pwait+0x5c/0xd8
    [426121.526231]  el0_svc_common.constprop.2+0x8c/0x190
    [426121.526679]  do_el0_svc+0x24/0x90
    [426121.526998]  el0_svc+0x14/0x20
    [426121.527295]  el0_sync_handler+0x90/0xb8
    [426121.527658]  el0_sync+0x160/0x180
    [426121.527974] sysrq: CPU1:
    [426121.528225] Call trace:
    [426121.528476]  dump_backtrace+0x0/0x200
    [426121.528828]  show_stack+0x18/0x28
    [426121.529157]  showacpu+0x68/0x80
    [426121.529465]  flush_smp_call_function_queue+0x100/0x250
    [426121.529946]  generic_smp_call_function_single_interrupt+0x14/0x20
    [426121.530508]  ipi_handler+0x7c/0x370
    [426121.530844]  handle_percpu_devid_fasteoi_ipi+0x9c/0x1f0
    [426121.531337]  generic_handle_irq+0x30/0x48
    [426121.531715]  __handle_domain_irq+0x94/0x108
    [426121.532111]  gic_handle_irq+0xc4/0xe0
    [426121.532460]  el1_irq+0xc8/0x180
    [426121.532767]  syslog_print+0x120/0x278
    [426121.533119]  do_syslog.part.27+0x33c/0x488
    [426121.533506]  do_syslog+0x44/0x58
    [426121.533820]  kmsg_read+0x4c/0x68
    [426121.534134]  proc_reg_read+0x30/0xf8
    [426121.534477]  vfs_read+0xac/0x1d0
    [426121.534788]  ksys_read+0x68/0xf0
    [426121.535100]  __arm64_sys_read+0x1c/0x28
    [426121.535467]  el0_svc_common.constprop.2+0x8c/0x190
    [426121.535915]  do_el0_svc+0x24/0x90
    [426121.536236]  el0_svc+0x14/0x20
    [426121.536534]  el0_sync_handler+0x90/0xb8
    [426121.536897]  el0_sync+0x160/0x180

     

     

    As I did spot several references to either suspend states of the RTL8153 (rtl8152_get_link_ksettings, rtl8152_suspend, __pm_runtime_resume), it might be more related to the link power management issue referenced in this thread.

     

    In the meantime, as this 'hangup' occurs only perhaps once every 1-2 weeks, I will monitor the system to see if it will happen still after the LPM and RX/TX offloading tweaks.

     

    If anyone is interested in some more backtrace content, I can provide.

    Groetjes,

     

  7. Hi @tparys,

    LUKS2 on-disk format is not supported/understood by cryptsetup 1.x, it requires cryptsetup 2.0 or higher. At that time, I do recall I had to build it (cryptsetup 2.x) from source on my Helios4 and Helios64 boxes which were at 4.4.x back then.

     

    As mentioned, my memory is failing here as I cannot recollect or find any logs on the actual errors I encountered, but the errors thrown at me by LUKS(1) were putting me on all my wrong feet at that time.

     

    Anyhow, I thought it is worth to check out to see if this might help out - or not of course.

     

    Groetjes,

  8. Hi @a5s397,

    I also had some issues with my LUKS encrypted partitions after a kernel upgrade before, but I have a hard time remembering what actually happened and how I managed to get it working again.

     

    Perhaps I'm stating the obvious, but are you sure you have a LUKS or LUKS2 type setup on your drive? As for me, I had to recompile LUKS2 in the past to get it to work for sure. Cannot really recall about the ... stopping here, just read your console.txt and you indeed have a LUKS2 format.

     

    Can you paste the output of cryptsetup --version and a syslog or dmesg output just before, during and after your first initial attempt to luksOpen your device on the working and non-working setups?

     

    Groetjes,

  9. Hi,

    You can try the following to get an idea of which process is modifying the file:

     

    sudo apt-get install auditd
    sudo auditctl -w /boot/armbianEnv.txt -p wa
    sudo tail -F /var/log/audit/audit.log

     

    The output should show actions performed on the file and (IIRC) the process ID performing those actions, perhaps that might help?

     

    e.g.:

    type=CWD msg=audit(1624526184.097:207): cwd="/home/djurny"
    type=PATH msg=audit(1624526184.097:207): item=0 name="/boot/" inode=7601 dev=b3:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
    type=PATH msg=audit(1624526184.097:207): item=1 name="/boot/armbianEnv.txt" inode=43198 dev=b3:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=CREATE cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
    type=PROCTITLE msg=audit(1624526184.097:207): proctitle=xx
    type=SYSCALL msg=audit(1624526184.109:208): arch=40000028 syscall=94 per=800000 success=yes exit=0 a0=3 a1=81a4 a2=c80eeb00 a3=81a4 items=1 ppid=9641 pid=9642 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts5 ses=2 comm="vi" exe="/usr/bin/vim.basic" subj==unconfined key=(null)
    type=PATH msg=audit(1624526184.109:208): item=0 name=(null) inode=43198 dev=b3:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
    type=PROCTITLE msg=audit(1624526184.109:208): proctitle=xx
    type=SYSCALL msg=audit(1624526184.109:209): arch=40000028 syscall=226 per=800000 success=yes exit=0 a0=1787820 a1=b6e3e1a0 a2=1907fc0 a3=1c items=1 ppid=9641 pid=9642 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts5 ses=2 comm="vi" exe="/usr/bin/vim.basic" subj==unconfined key=(null)
    type=CWD msg=audit(1624526184.109:209): cwd="/home/djurny"
    type=PATH msg=audit(1624526184.109:209): item=0 name="/boot/armbianEnv.txt" inode=43198 dev=b3:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
    type=PROCTITLE msg=audit(1624526184.109:209): proctitle=xx

     

    Source: Find which process is modifying a file [duplicate]

     

    It honestly sounds a bit more like a filesystem that has lost track or a inode mixup somewhere? As someone mentioned, perhaps something else is writing to this file, thinking it is something else? Perhaps try to locate a symbolic (or hard)link to armbanEnv.txt:

    ## find any symbolic links to armbianEnv.txt
    sudo find / -xdev -type l -ls | egrep -i -- armbianEnv.txt
    
    ## find hardlinks to armbianEnv.txt - need to be on the same filesystem!
    sudo find / -xdev -samefile /boot/armbianEnv.txt

     

    Groetjes,

  10. Hi,

    To enable the armbianmonitor to show information on the running system on the serial console, I used to have a custom startup script, called from /etc/rc.local. After some time, I thought it was more neat to have this automatically started (and stopped) for login sessions that are started on serial consoles/terminals.

     

    This lead (led?) me to the following systemd unit file:

    [Unit]
    Description=armbianmonitor on ttyS2
    Requires=serial-getty@ttyS2.service
    After=serial-getty@ttyS2.service 
    After=getty.target
    BindsTo=serial-getty@ttyS2.service 
    
    [Service]
    Type=idle
    ExecStartPre=-/bin/sleep 10
    ExecStart=/usr/bin/armbianmonitor -m
    TTYPath=/dev/ttyS2
    StandardInput=null
    StandardOutput=tty
    StandardError=syslog
    KillSignal=SIGKILL
    SendSIGHUP=yes
    
    [Install]
    WantedBy=serial-getty@ttyS2.service

     

    File goes into /usr/lib/systemd/system/armbianmonitor@ttyS2.service. To 'activate' it, perform the following after creating the file at the specified location:

    sudo systemctl daemon-reload
    sudo systemctl enable armbianmonitor@ttyS2
    sudo systemctl stop armbianmonitor@ttyS2
    sudo systemctl start armbianmonitor@ttyS2

     

    This is currently working for me on OrangePi Zero, NanoPi R2S, Helios4 (@ttyS0) and Helios64.

     

    If you do not have serial-getty services started on ttyS2 - like in the example unit file - you will need to modify the 'ttyS2' with the serial console matching your situation.

     

    Note that the new armbianmonitor@ttyX service will auto-start when seial-getty@ttyX is started and it will also stop when serial-getty@ttyX is stopped. This is to prevent orphaned armbianmonitors. Fun thing to try is to stop and start serial-getty@ttyX and also see the armbianmonitor service for that tty stop/start in tandem.

     

    Hope this helps anyone out there, it's always nice to have serial output available in case things happen (and they always happen unexpectedly).

     

    Groetjes,

     

    p.s. See below spoiler for auto-adding these unit files based on your currently enabled serial-getty services.

    Spoiler
    
    #!/bin/bash
    
    systemctl list-units --type=service --state=active,inactive --full --no-pager --no-legend --plain "serial-getty@*" |
        while read _UNIT _DONTCARE
        do
            _DEVICE="${_UNIT%.service}"
            _DEVICE="${_DEVICE##*@}"
            _FILE="/lib/systemd/system/armbianmonitor@${_DEVICE:?}.service"
            
            {
                cat << EOF
    [Unit]
    Description=armbianmonitor on ${_DEVICE:?}
    Requires=${_UNIT:?}
    After=${_UNIT:?} 
    After=getty.target
    BindsTo=${_UNIT:?} 
    
    [Service]
    Type=idle
    ExecStartPre=-/bin/sleep 10
    ExecStart=/usr/bin/armbianmonitor -m
    TTYPath=/dev/${_DEVICE:?}
    StandardInput=null
    StandardOutput=tty
    StandardError=syslog
    KillSignal=SIGKILL
    SendSIGHUP=yes
    
    [Install]
    WantedBy=${_UNIT:?}
    EOF
            } | sudo tee "${_FILE:?}" > /dev/null
    
            sudo chown root:root "${_FILE:?}"
            sudo chmod 0644 "${_FILE:?}"
            sudo systemctl daemon-reload
        done
        
    # EOF

     

     

  11. Hi @Elektrický,

    Nice tutorial, worked great for me. Bought a cheap GPS module:

    image.png.c3dd5954a863a0b70dd4254b9f3480a7.png

     

    And a pinheader to solder onto the OrangePi Zero board itself.

    P_20210621_112118-mod.thumb.jpg.fb96183c04cff4a0ccb2f17725cbede2.jpg

     

    The only thing I had to change was to swap the RX/TX wires, as a straight connection did not work for my GPS board.

    P_20210618_162823-mod.thumb.jpg.3b36c83e15d50f9abf75065412bbe163.jpg

    P_20210618_162716.thumb.jpg.157c0571f8a9e601a385cc999eb1c8f3.jpg

     

    I did not have any success getting PPS to work through the USB connection (works as ttyACM). I had to use the GPIO dtb overlay and electrical connection as per your tut.

    gpsd in action:

    gpsd-output.jpg.f528d43f1dd3c76f7cbdf0c6fb73ab0d.jpg

     

    ntp[sec] in action:

    ntpq.png.e68e361ff071f77a5da2d4b3059af1ab.png

     

    Thanks a lot!

    Groetjes,

     

    p.s. I still have to figure out why I needed this :thumbup:

  12. Hi @lanefu,

    For your usecase, best to do the following:

    for A in /dev/ttyUSB*
    do
    	(
    		echo "${A:?}"
    		udevadm info --query property "${A:?}" | egrep -- '^ID_(PATH|SERIAL_SHORT)=' 
    	) | xargs
    done

     

    That will give you either the USB port location in the USB tree (ID_PATH) or any serial number (ID_SERIAL_SHORT) as provided by udev, ready to make rules with.

     

    As I bought a lot of low-end USB-serial dongles, they do not have any serial - hence the use of the USB port location. I run the script (attached in earlier post) every time I change something in the hub, or when I plug the hub into another device.

     

    Let me know if this helped you!

    Groetjes,

  13. Hi, sorry, I forgot to mention that the configure-serial-tty script does require some target modification: it depends on the baudrate being fixed on the target, as sending <BRK> both triggers Magic SysRq and optional baudrate switch by *getty. To get this to work on my setup with highish successrate, I reconfigured the target's serial-getty configurations to only work on one baudrate.

     

    See parts of my ansible task that sets that puppy up:

    Spoiler
    
    #...
        -   name: Determine serial-getty services
            shell: |
                systemctl list-units --type=service --state=active,inactive --full --no-pager --no-legend --plain "{{item}}@*" |
                    while read _UNIT _DONTCARE
                    do
                        echo "{{item}} ${_UNIT:-N/A}"
                    done
            with_items:
            -   'serial-getty'
            -   'armbianmonitor'
            register: service_units
                
        -   name: Modify serial-getty console baudrate
            shell: |
                set -x
                _TIMESTAMP=`date -Isec`
                _TMP=`mktemp`
                _ITEM_STDOUT="{{item.stdout}}"
                echo "${_ITEM_STDOUT:-}" |
                    while read _SERVICE _UNIT
                    do
                        _UNITFILE=`systemctl show "${_UNIT:?}" | sed -n '/FragmentPath/ { s/^FragmentPath=//p; q; }'`
                        sed -n 's/^ExecStart=//p;' "${_UNITFILE:?}" > "${_TMP}"
                        read -r _CMDLINE < "${_TMP}"
                        eval set -- ${_CMDLINE:-}
                        OPTIND=2 # skip ARGV[0]
                        while getopts ':o:-:' OPT 
                        do
                            :
                        done
                        shift $(( ${OPTIND:-} - 1 ))
                        _BAUDRATES="${1:?}"
                        _BAUDRATE_NEW="${_BAUDRATES%%,*}"
                        if [ "${_BAUDRATE_NEW:-}" != "${_BAUDRATES:-}" ]
                        then
                            _BACKUP="${_UNITFILE:?}.${_TIMESTAMP:?}~"
                            echo "Making backup of '${_UNITFILE:-N/A}' to '${_BACKUP:-N/A}'."
                            cp -ab "${_UNITFILE:?}" "${_BACKUP:?}"
                            echo "Modifying '${_UNITFILE:-N/A}'."
                            ## Example:
                            ##   ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 1500000 %I $TERM          
                            sed -i -E "
                                /^ExecStart=/ {
                                    h;
                                    s/^[ \t]*[^#].*/#[DISABLED by Ansible] &/p;
                                    g;
                                    i #[BEGIN] Ansible managed
                                    s/ *\<-s\>//;
                                    s/--keep-baud[[:blank:]]//;
                                    s/--extract-baud[[:blank:]]//;
                                    s/${_BAUDRATES}/${_BAUDRATE_NEW}/;
                                    a #[END] Ansible managed
                                }" "${_UNITFILE:?}"
                            echo "# diff -y -W\${COLUMNS:-} '${_UNITFILE:-}' '${_BACKUP:-}'"
                            echo "Changed!"
                            systemctl daemon-reload
                        fi
                    done
                rm "${_TMP:?}"
            register: serial_getty_config
            changed_when: "'Changed!' in serial_getty_config.stdout"
            vars:
            -   __item: 'serial-getty'
            loop: "{{ service_units.results }}"
            when: 
            -   __item == item.item
    #...

     

    The ansible task shell script will try to parse the commandline to get the currently configured baudrates. It assumes the baudrates are sorted from high to low, i.e. 1500000,115200,38400,9600 for my NanoPi R2S and Helios64 boxen. It will replace the baudrates with the most-left it had parsed (which should be the highest baudrate). It also will disable the options to *getty that skip setting the baudrate explicitly (i.e. keep-baud and extract-baud).

     

    Let me know if this worked out for you!

    Groetjes,

  14. Hi,

    See below udevadm rule:

    Spoiler
    
    ##
    ## __usb_serial
    ##
    
    ACTION=="remove", GOTO="__usb_serial_end"
    SUBSYSTEM!="tty", GOTO="__usb_serial_end"
    
    ENV{ID_VENDOR_ID}!="067b",  GOTO="__usb_serial_ftdi"
    ENV{ID_MODEL_ID}!="2303",   GOTO="__usb_serial_ftdi"
    
    LABEL="__usb_serial_pl2303"
    
    ## these devices do not have a serial number
    ## assignment is done based on physical location: usb-port, usb-hub
    ## be sure to plug in all the usb dongles in the same positions, otherwise this assignment is messed up!
    
    #[BEGIN] AUTOMATICALLY GENERATED CONTENT
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.2:1.0",    SYMLINK+="serial/by-name/sinaspi"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.3:1.0",    SYMLINK+="serial/by-name/orangepi"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.1.2:1.0",  SYMLINK+="serial/by-name/pi2-01"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.1.3:1.0",  SYMLINK+="serial/by-name/pi2-02"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.4.1:1.0",  SYMLINK+="serial/by-name/nanopi0"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.1.4:1.0",  SYMLINK+="serial/by-name/pi2-03"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.4.2:1.0",  SYMLINK+="serial/by-name/nanopi1"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.1.1:1.0",  SYMLINK+="serial/by-name/kobol0"
    ENV{ID_PATH}=="platform-3f980000.usb-usb-0:1.5.4.4:1.0",  SYMLINK+="serial/by-name/bluebox1"
    #[END] AUTOMATICALLY GENERATED CONTENT
    
    LABEL="__usb_serial_ftdi"
    
    ENV{ID_VENDOR_ID}!="0403",  GOTO="__usb_serial_end"
    ENV{ID_MODEL_ID}!="6015",   GOTO="__usb_serial_end"
    
    ## these devices have a serial number
    
    ENV{ID_SERIAL_SHORT}=="DT03O6AD", SYMLINK+="serial/by-name/kobol0"
    ENV{ID_SERIAL_SHORT}=="DJ00JULE", SYMLINK+="serial/by-name/bluebox1"
    ENV{ID_SERIAL_SHORT}=="DJ00JDCX", SYMLINK+="serial/by-name/bluebox0"
    
    LABEL="__usb_serial_end"
    
    ## EOF

     

    And below bash snippet of how to generate it:

    generate_udev_rule() { # <dev> <name>
        typeset _DEV="${1:?}"
        typeset _NAME="${2:?}"
        typeset _ID_PATH
        
        _ID_PATH="$( udevadm info --query property "${_DEV}" | sed -n '/^ID_PATH/ { s/^ID_PATH=//p; q; }' )"
    
        printf "ENV{ID_PATH}==\"%s\",      SYMLINK+=\"serial/by-name/%s\"\n" \
            "${_ID_PATH:?}" \
            "${_NAME:?}"
    }

     

    Hope that helps!

    Groetjes,

    configure-serial-tty

  15. Hi,

    I made a small detection script using expect. That will spit out the hosts it found per try and baudraute guesstimate. Afterwards it will query the USB port location using udevadm info and build udev rules on a name basis for the hosts it found on those ports.

    It's not a generic solution, let me know if you are interested, I'll share when back at my workstation.

    Groetjes,

  16. Hi,

    How are you configuring your interfaces? ifup/ifdown or NetworkManager?

    How many NICs do you have on the system? Both are connected to the same network?

     

    Can you share output of:

    # show current dhcp clients
    pgrep -al dhclient
    # show network manager info
    sudo nmcli dev sh
    sudo nmcli con sh
    # show interface info
    sudo ifconfig -a
    # show ifup/ifdown config
    cat /etc/network/interfaces
    cat /etc/network/interfaces.d/*
    # show current listening adresses of dnsmasq
    sudo netstat -anp -Aip

     

    Groetjes,

  17. Hi,

    On my orangepi zero (256MB) running armbian image, I am observing some odd behavior that I do not fully understand.

    Spoiler
    
    Linux sinaspi 5.10.16-sunxi #21.02.2 SMP Sun Feb 14 21:12:17 CET 2021 armv7l GNU/Linux
    
    Distributor ID: Debian
    Description:    Debian GNU/Linux 10 (buster)
    Release:        10
    Codename:       buster

     

    http://ix.io/3mQX

     

    In an effort to 'harden' the orangepi zero configuration (by making the user experience annoying), I have shortened the sudo password prompt timeout. On the orangepi zero board, the following setting results in a timeout of only 2 seconds, instead of 15 seconds:

     

    #[BEGIN] Ansible managed
    ## DMZ special: Authentication always required except for TOOLS
    djurny ALL = (root) PASSWD: ALL, NOPASSWD: TOOLS
    
    ## DMZ special: Stricter timeout settings
    Defaults:djurny passwd_timeout=0.25
    Defaults:djurny timestamp_timeout=0
    
    Defaults:djurny !logfile
    Defaults:djurny !syslog
    #[END]

     

    The exact same setting works as expected on raspberrypi and also as expected on nanopi R2S (armbian). Even more odd, setting the timeout to 1, the timeout is indeed set to 1 minute. Setting it to any fractional value like 0.3 or 0.5 it seems that the timeout calculation/interpretation is just not working as per manpage.

     

    I'm not blocked by this, but if this is something that can be fixed easily, I will. For now, I've just the timeout to 1 minute (still more annoying than 15 minute timeout :-)

     

    Anyone have experienced this as well?

     

    Groetjes,

  18. On 4/6/2021 at 12:10 PM, gprovost said:

    I observe the same behavior. It  seems to be linked to the introduction of the ESSIV kernel module in Linux Kernel 5.4

     

    When creating and opening a new LUKS2 device, I can still see the interrupt of the crypto engine increasing. However when exercising the mounted encrypted device I don't see anymore increase of interrupt. What I realized is that there is this module essiv that get loaded and it seems to suggest it bypass the CESA crypto engine.

     

    We need to find a way to force dm-crypt to use marvell_cesa

    [..]

     

    I also see the same. Tried simple things, like blacklisting essiv kernel module, but that prevents cryptsetup from working at all. There seems to be a dependency of the authenc kernel module to essiv. Not sure what it was before, as I don't have any box running on older kernel at the moment:

    filename:       /lib/modules/5.10.21-mvebu/kernel/crypto/essiv.ko
    [..]
    depends:        authenc
    intree:         Y
    name:           essiv
    [..]

     

    Without authenc, crytpsetup starts complaining:

    Apr  7 22:52:04 localhost kernel: [  126.468108] device-mapper: ioctl: error adding target to table
    Apr  7 22:53:36 localhost kernel: [  218.613317] essiv: Unknown symbol crypto_authenc_extractkeys (err -2)

     

    Groetjes,

  19. @jsr my bad for the filename. Will check on my box as soon as I can.
    Can you also do cryptsetup benchmark? I wonder if the names in crypto and the ones used by cryptsetup might have changed somehow.
    Can you also share syslog of your box? The Marvell crypto drivers are also announced there, something might be off.
    (Note I'm not an expert in this crypto business so I might be barking up the verkeerde boom.)
    Groetjes,

    Sent from my SM-T500 using Tapatalk

×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines