Debian 8.4 : Dahdi Startup Scripts ?

Home » Asterisk Users » Debian 8.4 : Dahdi Startup Scripts ?
Asterisk Users 9 Comments

Hello,

I just made a asterisk / dahdi fresh install on Debian 8.4, and ended up with the following packages :

$ sudo dpkg -l|grep -Ei ‘dahdi|asterisk|libpri’
ii asterisk 1:11.13.1~dfsg-2+b1 amd64 Open Source Private Branch Exchange (PBX)
ii asterisk-config 1:11.13.1~dfsg-2 all Configuration files for Asterisk ii asterisk-core-sounds-en 1.4.22-1 all asterisk PBX sound files – US English ii asterisk-core-sounds-en-gsm 1.4.22-1 all asterisk PBX sound files – en-us/gsm ii asterisk-dahdi 1:11.13.1~dfsg-2+b1 amd64 DAHDI devices support for the Asterisk PBX
ii asterisk-modules 1:11.13.1~dfsg-2+b1 amd64 loadable modules for the Asterisk PBX
ii asterisk-moh-opsound-gsm 2.03-1 all asterisk extra sound files – English/gsm ii asterisk-voicemail 1:11.13.1~dfsg-2+b1 amd64 simple voicemail support for the Asterisk PBX
ii dahdi 1:2.10.0.1-1 amd64 utilities for using the DAHDI kernel modules ii dahdi-firmware-nonfree 2.10.0-1 all DAHDI non-free firmware ii dahdi-linux 1:2.10.0.1~dfsg-1 all DAHDI telephony interface – Linux userspace parts ii dahdi-modules-3.16.0-4-amd64:amd64 1:2.10.0.1~dfsg-1+3.16.7-ckt25-2 amd64 DAHDI modules for Linux (kernel 3.16.0-4-amd64)
ii dahdi-source 1:2.10.0.1~dfsg-1 all DAHDI telephony interface – source code for kernel driver ii libpri1.4 1.4.15-1 amd64 Primary Rate ISDN specification library

However, i can’t find any dahdi startup script, neither init.d neither systemd fashion.

$ sudo dpkg -l|grep -Ei ‘dahdi’|cut -d ” ” -f3 |xargs dpkg -L|grep -E ‘init.d|system’
/usr/share/doc/dahdi/examples/system.conf.sample.gz
/etc/init.d

Am I missing something?

Thank you,

9 thoughts on - Debian 8.4 : Dahdi Startup Scripts ?

  • Hi Eric,

    Mine only contain /etc/init.d but not the dahdi script which should be inside :

    $ sudo dpkg -l dahdi ii dahdi 1:2.10.0.1-1 amd64 utilities for using the DAHDI kernel modules

    $ sudo dpkg -L dahdi
    […]
    /etc
    /etc/init.d

    $ dpkg -c /var/cache/apt/archives/dahdi_1%3a2.10.0.1-1_amd64.deb
    […]
    drwxr-xr-x root/root 0 2014-10-26 18:48 ./etc/
    drwxr-xr-x root/root 0 2014-10-26 18:48 ./etc/init.d/

    $ md5sum /var/cache/apt/archives/dahdi_1%3a2.10.0.1-1_amd64.deb

    Tried to download the package from another mirror, same md5, no init script. This is consistent with this :
    https://packages.debian.org/jessie/amd64/dahdi/filelist

    Maybe you did upgrade from another dahdi version and you kept the script from it ?

    I manually downloaded dahdi_2.5.0.1-2_amd64.deb and extracted /etc/init.d/dahdi , I hope no side effect.

    $ diff -u dahdi_files_2.5.0.1 dahdi_files_2.10.0.1
    — dahdi_files_2.5.0.1 2016-04-12 16:40:27.779886736 +0000
    +++ dahdi_files_2.10.0.1 2016-04-12 16:40:36.515886917 +0000
    @@ -1,7 +1,10 @@
    ./
    ./etc/
    ./etc/init.d/
    -./etc/init.d/dahdi
    +./lib/
    +./lib/udev/
    +./lib/udev/rules.d/
    +./lib/udev/rules.d/60-dahdi.rules
    ./usr/
    ./usr/sbin/
    ./usr/sbin/astribank_allow
    @@ -9,18 +12,18 @@
    ./usr/sbin/astribank_is_starting
    ./usr/sbin/astribank_tool
    ./usr/sbin/dahdi_cfg
    -./usr/sbin/dahdi_diag
    ./usr/sbin/dahdi_genconf
    ./usr/sbin/dahdi_hardware
    ./usr/sbin/dahdi_maint
    ./usr/sbin/dahdi_monitor
    ./usr/sbin/dahdi_registration
    ./usr/sbin/dahdi_scan
    +./usr/sbin/dahdi_span_assignments
    +./usr/sbin/dahdi_span_types
    ./usr/sbin/dahdi_test
    ./usr/sbin/dahdi_tool
    -./usr/sbin/fpga_load
    +./usr/sbin/dahdi_waitfor_span_assignments
    ./usr/sbin/fxotune
    -./usr/sbin/fxstest
    ./usr/sbin/lsdahdi
    ./usr/sbin/sethdlc
    ./usr/sbin/twinstar
    @@ -29,6 +32,15 @@
    ./usr/share/
    ./usr/share/dahdi/
    ./usr/share/dahdi/astribank_hook
    +./usr/share/dahdi/dahdi_auto_assign_compat
    +./usr/share/dahdi/dahdi_handle_device
    +./usr/share/dahdi/dahdi_span_config
    +./usr/share/dahdi/handle_device.d/
    +./usr/share/dahdi/handle_device.d/10-span-types
    +./usr/share/dahdi/handle_device.d/20-span-assignments
    +./usr/share/dahdi/span_config.d/
    +./usr/share/dahdi/span_config.d/10-dahdi-cfg
    +./usr/share/dahdi/span_config.d/20-fxotune
    ./usr/share/dahdi/waitfor_xpds
    ./usr/share/dahdi/xpp_fxloader
    ./usr/share/doc/
    @@ -37,33 +49,15 @@
    ./usr/share/doc-base/dahdi.astribank
    ./usr/share/doc/dahdi/
    ./usr/share/doc/dahdi/changelog.Debian.gz
    -./usr/share/doc/dahdi/changelog.gz
    ./usr/share/doc/dahdi/copyright
    -./usr/share/doc/dahdi/dahdi_cfg.8
    -./usr/share/doc/dahdi/dahdi_cfg.8.html
    -./usr/share/doc/dahdi/dahdi_diag.8
    -./usr/share/doc/dahdi/dahdi_diag.8.html
    -./usr/share/doc/dahdi/dahdi_monitor.8
    -./usr/share/doc/dahdi/dahdi_monitor.8.html
    -./usr/share/doc/dahdi/dahdi_scan.8
    -./usr/share/doc/dahdi/dahdi_scan.8.html
    -./usr/share/doc/dahdi/dahdi_test.8
    -./usr/share/doc/dahdi/dahdi_test.8.html
    -./usr/share/doc/dahdi/dahdi_tool.8
    -./usr/share/doc/dahdi/dahdi_tool.8.html
    ./usr/share/doc/dahdi/examples/
    +./usr/share/doc/dahdi/examples/50-asterisk
    +./usr/share/doc/dahdi/examples/assigned-spans.conf.sample
    ./usr/share/doc/dahdi/examples/genconf_parameters.gz
    ./usr/share/doc/dahdi/examples/init.conf.sample
    ./usr/share/doc/dahdi/examples/modprobe.conf.sample
    +./usr/share/doc/dahdi/examples/span-types.conf.sample
    ./usr/share/doc/dahdi/examples/system.conf.sample.gz
    -./usr/share/doc/dahdi/fxotune.8.gz
    -./usr/share/doc/dahdi/fxotune.8.html
    -./usr/share/doc/dahdi/fxstest.8
    -./usr/share/doc/dahdi/fxstest.8.html
    -./usr/share/doc/dahdi/patgen.8
    -./usr/share/doc/dahdi/patgen.8.html
    -./usr/share/doc/dahdi/pattest.8
    -./usr/share/doc/dahdi/pattest.8.html
    ./usr/share/doc/dahdi/README.Astribank.gz
    ./usr/share/doc/dahdi/README.Astribank.html
    ./usr/share/doc/dahdi/README.Debian
    @@ -77,17 +71,18 @@
    ./usr/share/man/man8/astribank_is_starting.8.gz
    ./usr/share/man/man8/astribank_tool.8.gz
    ./usr/share/man/man8/dahdi_cfg.8.gz
    -./usr/share/man/man8/dahdi_diag.8.gz
    ./usr/share/man/man8/dahdi_genconf.8.gz
    ./usr/share/man/man8/dahdi_hardware.8.gz
    +./usr/share/man/man8/dahdi_maint.8.gz
    ./usr/share/man/man8/dahdi_monitor.8.gz
    ./usr/share/man/man8/dahdi_registration.8.gz
    ./usr/share/man/man8/dahdi_scan.8.gz
    +./usr/share/man/man8/dahdi_span_assignments.8.gz
    +./usr/share/man/man8/dahdi_span_types.8.gz
    ./usr/share/man/man8/dahdi_test.8.gz
    ./usr/share/man/man8/dahdi_tool.8.gz
    -./usr/share/man/man8/fpga_load.8.gz
    +./usr/share/man/man8/dahdi_waitfor_span_assignments.8.gz
    ./usr/share/man/man8/fxotune.8.gz
    -./usr/share/man/man8/fxstest.8.gz
    ./usr/share/man/man8/lsdahdi.8.gz
    ./usr/share/man/man8/twinstar.8.gz
    ./usr/share/man/man8/xpp_blink.8.gz
    @@ -97,9 +92,12 @@
    ./usr/share/perl5/Dahdi/Chans.pm
    ./usr/share/perl5/Dahdi/Config/
    ./usr/share/perl5/Dahdi/Config/Gen/
    +./usr/share/perl5/Dahdi/Config/Gen/Assignedspans.pm
    ./usr/share/perl5/Dahdi/Config/Gen/Chandahdi.pm
    +./usr/share/perl5/Dahdi/Config/Gen/Freepbxdb.pm
    ./usr/share/perl5/Dahdi/Config/Gen/Modules.pm
    ./usr/share/perl5/Dahdi/Config/Gen.pm
    +./usr/share/perl5/Dahdi/Config/Gen/Spantypes.pm
    ./usr/share/perl5/Dahdi/Config/Gen/System.pm
    ./usr/share/perl5/Dahdi/Config/Gen/Unicall.pm
    ./usr/share/perl5/Dahdi/Config/Gen/Users.pm

    Thank you,


    Bertrand LUPART

  • According to a last-year bug report (from me 😉 :

    “I’ll just note that in the Jessie version the preffered mode of operation would be not to use the init script at all and rely on running dahdi_cfg from a udev hook.”

    https://bugs.debian.org/cgi-bin/bugreport.cgi?bugw9292

    I’m not sure i understand how it’s supposed to work.

    Apparently, that’s not a way to go.

  • That must be it. I have an old /var/lib/dpkg/info/dahdi.list file that contains /etc/init.d/dahdi, so I was seeing it when I did “dpkg -L dahdi”. But you’re right, the current version doesn’t have it. Want to file a bug report or shall I?

  • It looks like the intent is to use the hotplug scripts called in
    /lib/udev/rules.d/60-dahdi.rules.

    The spans get set up at device detection time, by
    /usr/share/dahdi/dahdi_handle_device, which executes the scripts in /usr/share/dahdi/handle_device.d/

    For my (simple) setup, this will probably “just work”. I’ll try removing /etc/init.d/dahdi next time I reboot my asterisk machine.

  • Yes. README.Debian[1], included as /usr/share/doc/dahdi/README.debian .

    README.Debian (.gz, if it’s long enough) is a file for some extra documentation by the packager. See the section about “Automatic startup”
    there.

    The only real use the DAHDI init script has is for interactive module loading / unloading. Modprobe is not useful on its own, as DAHDI
    includes a set of modules (especially if you use Astribanks. There a bit of extra magic besides the recursive rmmod was added).

    Furthermore, there is really no point is removing of modules at system shutdown. It only wastes time (and some CPU cycles, if you care about power) and increases the chances of exposing bugs at that time.

    IIRC the Asterisk package in Jessie lacks the extra script to get the configured DAHDI channels into Asterisk[2]. You may need to drop it yourself to /usr/share/dahdi/span-config.d

    If things still don’t work, please do report it here on on the BTS.

    [1] http://sources.debian.net/src/dahdi-tools/1:2.10.0.1-1/debian/README.Debian/

    [2] http://git.asterisk.org/gitweb/?p

  • Hello,

    […]

    This startup / shutdown scheme apply to nominal cases where you don’t need to reboot your system 🙂

    Building a brand new box may require you to restart dahdi a bunch of times : “no span” error [1], digium firmware not downloading [2], forgetting Europe requires E1 line mode, new telco uncertain if using crc4 …
    More, in case your telco is failing, he’ll often ask you to reset on your side first. Restarting dahdi feels way more convenient than rebooting a distant system.

    Red a bunch of READMEs of the packages installed before posting, not sure i red this one. Maybe a “Manual startup / shutdown” section would be welcome 😉

    This file is missing on my side (1:2.10.0.1-1), but asterisk seems to be aware of the channels. Not sure how.

    Thank you for your answer,

    [1] http://asteriskfaqs.org/2015/01/15/asterisk-users/dahdi_genconf-fails-with-empty-configuration-no-spans.html
    [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=820802#5


    Bertrand LUPART

  • Thanks for your reply,

    But as you can see from my replies there, the modules were already loaded. All that was needed was to get the spans assigned. Unloading the modules and loading them wouldn’t have mattered.

    My original plan was that if you have a blank configuration (no
    /etc/dahdi/system.conf and no /etc/dahdi/assigned-spans.conf), the spans would be generated and configured automagically at the DAHDI
    level.

    Part of this works: If you have no /etc/dahdi/system.conf, when a new span is created, dahdi_genconf creates configuration for it:

    http://git.asterisk.org/gitweb/?p=dahdi/tools.git;a=blob;f=hotplug/span_config.d/10-dahdi-cfg;hb=HEAD#l25

    Originally this was also the case with a lack of assigned-spans.conf. See the last hunk here:
    http://git.asterisk.org/gitweb/?p=dahdi/tools.git;a=commitdiff;h=1292ea90789aa20bff5a533141086f6ecf4f82df

    Again, in many cases you’ll need to just use:

    dahdi_span_assignment remove dahdi_span_assignment add

    This also runs dahdi_cfg on the span. Thus it already does a partial reset. Not sure how much of a reset. If a full reset is needed, I
    included the module removal and load functionality in the seperate script.

    Will add.

    It’s missing because it should not be part of dahdi (I removed it explicitly in the packaging but forgot to add it to Asterisk in time for Jessie). The DAHDI package should not assume Asterisk is installed (at least not if it’s so simple to fix).

    The directory is theree for hooks to be added. If you have your own interesting action, feel free to add it. Just make it short.


    Tzafrir Cohen icq#16849755 jabber:tzafrir.cohen@xorcom.com
    +972-50-7952406 mailto:tzafrir.cohen@xorcom.com http://www.xorcom.com