Dahdi module installed, /usr/bin/post-apt-run script errors out

I installed FreePBX 17.0.19.24 with the dahdi kernel module, and when I run apt update/upgrade the active kernel version remains at 6.1.0-27-amd64, the latest version with dahdi support.

However, after any apt update/upgrade run the /usr/bin/post-apt-run script throws the error:

/usr/bin/post-apt-run: line 15: [[: "1>2": syntax error: operand expected (error token is ""1>2"")

This is happening because my debian 12 boot menu uses a sub-menu. The first line of the boot menu is the latest available kernel version, and line two is the submenu, conatining all the other kernel versions and other menu choices, and “1>2” is the submenu entry corresponding to 6.1.0-27-amd64, defined as GRUB_DEFAULT in /etc/default/grub.

I did not create this sub-menu; it is what came with the debian 12 installation.

The post-apt-run script continues running after this error, but it does not select a kernel version. It writes the following journal line:

: Checking kernel modules for dahdi and wanpipe for kernel image
: Upgrading dahdi-linux-kmod- and kmod-wanpipe-

Where a kernel version should appear after the ‘-’.

I’m not up to debgging the /usr/bin/post-app-run script or getting grub to build a boot menu with no submenu in it. Today I unconditionally ran:

apt -y upgrade dahdi-linux-kmod-6.1.0-27
apt -y upgrade kmod-wanpipe-6.1.0-27

after the general apt update/upgrade. Apparently the latest versions are already installed. Is this a sufficient work-around?

The DAHDI drivers were rebuilt in the last week or so – they should be working on latest kernel 6.1.0-32 from Debian 12.10

Are you able to re-install this system ?

Are you able to re-install this system ?

I could do that, but I think that the 6.1.0-32 kernel is already installed via apt update/upgrade. It’s only the GRUB_DEFAULT definition in /etc/default/grub that forces the use of 6.1.0-27. Might it not be enough to just remove or change that, run “update-grub”, and re-boot?

I was able to stop grub from buuilding a submenu in the boot menu, by adding the line:

GRUB_DISABLE_SUBMENU=yes

To /etc/default/grub, and then running “update-grub” as root. The resulting boot menu had the newest kernel (6.1.0-32) on top, So I changed the GRUB_DEFAULT value in /etc/default/grub from “1>2” to “0”, and ran “update-grub” once again.

The “/usr/bin/post-apt-run” script no longer errors on the “1>2” entry, but it still fails to extract a kernel version from the full kernel name “vmlinuz-6.1.0-32-amd64”, so it always runs:

apt -y upgrade dahdi-linux-kmod- kmod-wanpipe-

This doesn’t do anything because those modules do not exist.

I modified /usr/bin/post-apt-run and the new version does isolate the “6.1.0-32” version from the kernel name. I am apparently too new of a forum user to upload files, but the diff listing is as follows:

[kurt@op92a Documents]$ diff post-apt-run post-apt-run2
11c11
<     kernel_idx=$(grep GRUB_DEFAULT /etc/default/grub | cut -d '=' -f 2)
---
>     kernel_idx=$(grep -v ^# /etc/default/grub | grep GRUB_DEFAULT | cut -d '=' -f 2)
20c20,29
<       kernel_ver=$(echo $kernel | sed -n -e 's/vmlinuz-\([[:digit:].-]*\).*//' -e 's/-$//p')
---
>         #kernel_ver=$(echo $kernel | sed -n -e 's/vmlinuz-\([[:digit:].-]*\).*//' -e 's/-$//p')
>         #vp1=$(echo $kernel | cut -d- -f 2)
>         #vp2=$(echo $kernel | cut -d- -f 3)
>         #kernel_ver=$(echo $vp1-$vp2)
>         #echo "kernel_ver via cut = $kernel_ver"
> 
> 	archit=$(echo $kernel | awk -F- '{print $NF}')
> 	kernel_ver=$(echo $kernel | sed -e s/vmlinuz-// | sed -e s/-$archit//)
>         #echo "kernel_ver via awk/sed = $kernel_ver"
> 
26d34
< 
[kurt@op92a Documents]$ 

The new script includes an alternate, commented-out way to derive the version number. Both work on my system’s kernel name, but I do not know what a generalized version string looks like.

Welcome to the forums!

We do have a pastebin that you can try out:

Saw something like that earlier today – probably a ‘cut’ command is slipping up somewhere. Not sure if there is an issue in the tracker yet…

We do have a pastebin…

I didn’t know there were such things, but I pasted my debugging version (lots of ‘echo’ statements) of “post-apt-run” in it, at this URL:

https://pastebin.freepbx.org/view/f4a416b7

The generating webpage says this will become invalid as soon as you visit it? I guess that’s the way of pastebins.

probably a ‘cut’ command is slipping up somewhere

This is the “post-apt-run” line that is failing to isolate the kernel version:

kernel_ver=$(echo $kernel | sed -n -e ‘s/vmlinuz-([[:digit:].-]).//’ -e ‘s/-$//p’)

It’s not hard to reproduce the problem:

root@ivr198:~# kernel=vmlinuz-6.1.0-32-amd64
root@ivr198:~# echo $kernel
vmlinuz-6.1.0-32-amd64
root@ivr198:~# echo $kernel | sed -n -e 's/vmlinuz-\([[:digit:].-]*\).*//' -e 's/-$//p'
root@ivr198:~# 

I’m not very good with sed, so I didn’t try to debug this. I instead found a couple of other ways to isolate the “6.1.0-32” part, as shown in the diff output above. This website seems to not want me to mess with the tracker website.

Could be a bug. What burn option did you choose ?

I used the default “Burn on reading”. Maybe I was overly concerned about cluttering up the pastebin?

OK, I did it again, with a 1-month lifetime, at this URL:

Hi @kurt19001 We were able to reproduce this issue locally. Raised issue [bug]: FreePBX V17 DAHDI- post-apt-run script error · Issue #703 · FreePBX/issue-tracker · GitHub

Good! I added a comment to the issue (as ‘GKurt’).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.