FreePBX / sng_freepbx_debian_install

FreePBX 17 Installation Script
92 stars 31 forks source link

[bug]: install failure if system has no IPv6 #83

Closed asarubbo closed 1 month ago

asarubbo commented 1 month ago

FreePBX Version

FreePBX 17

Issue Description

With a system that have no ipv6, the install does not work.

To reproduce use the following in /etc/default/grub:

GRUB_CMDLINE_LINUX="ipv6.disable=1"

And then regenerate grub.cfg with:

grub-mkconfig -o /boot/grub/grub.cfg

then reboot then proceed with the installation with bash /tmp/sng_freepbx_debian_install.sh

Operating Environment

Debian 12

Relevant log output

freepbx-17 ~ # cd /tmp && wget https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh -O /tmp/sng_freepbx_debian_install.sh && bash /tmp/sng_freepbx_debian_install.sh
--2024-08-14 09:30:35--  https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/FreePBX/sng_freepbx_debian_install/master/sng_freepbx_debian_install.sh [following]
--2024-08-14 09:30:35--  https://raw.githubusercontent.com/FreePBX/sng_freepbx_debian_install/master/sng_freepbx_debian_install.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.111.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 43062 (42K) [text/plain]
Saving to: ‘/tmp/sng_freepbx_debian_install.sh’

/tmp/sng_freepbx_debian_install.sh            100%[================================================================================================>]  42.05K  --.-KB/s    in 0.004s  

2024-08-14 09:30:35 (10.7 MB/s) - ‘/tmp/sng_freepbx_debian_install.sh’ saved [43062/43062]

Performing version check...
Perfect! You're already running the latest version.
2024-08-14 09:30:35 - Starting installation.
2024-08-14 09:30:35 -   Starting FreePBX 17 installation process for freepbx-17 Linux freepbx-17 6.1.0-22-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.94-1 (2024-06-21) x86_64 GNU/Linux
2024-08-14 09:30:35 -   Please refer to the /var/log/pbx/freepbx17-install-2024.08.14-09.30.35.log to know the process...
2024-08-14 09:30:35 - Making sure installation is same
2024-08-14 09:30:38 - Setting up default configuration
2024-08-14 09:30:38 - Installing software-properties-common ....
2024-08-14 09:30:43 - software-properties-common installed successfully....
2024-08-14 09:30:43 - Setting up repositories
2024-08-14 09:30:54 - Setting up Sangoma repository
2024-08-14 09:30:54 -  You are installing FreePBX 17 on kernel 6.1.0-22..
2024-08-14 09:30:54 -  Please note that if you have plan to use DAHDI then:
2024-08-14 09:30:54 -  Ensure that you either choose DAHDI option so script will configure DAHDI
2024-08-14 09:30:54 -                                   OR
2024-08-14 09:30:54 -  Ensure you are always running DAHDI supported Kernel. Current DAHDI supporter latest kernel version is 6.1.0-23
2024-08-14 09:30:54 - Updating repository
2024-08-14 09:30:56 - Installing required packages
2024-08-14 09:30:56 - Installing redis-server ....
2024-08-14 09:30:58 - redis-server installed successfully....
2024-08-14 09:30:58 - Installing libsnmp-dev ....
2024-08-14 09:31:02 - libsnmp-dev installed successfully....
2024-08-14 09:31:02 - Installing libtonezone-dev ....
2024-08-14 09:31:03 - libtonezone-dev installed successfully....
2024-08-14 09:31:03 - Installing libpq-dev ....
2024-08-14 09:31:04 - libpq-dev installed successfully....
2024-08-14 09:31:04 - Installing liblua5.2-dev ....
2024-08-14 09:31:05 - liblua5.2-dev installed successfully....
2024-08-14 09:31:05 - Installing libpri-dev ....
2024-08-14 09:31:06 - libpri-dev installed successfully....
2024-08-14 09:31:06 - Installing libbluetooth-dev ....
2024-08-14 09:31:07 - libbluetooth-dev installed successfully....
2024-08-14 09:31:07 - Installing libunbound-dev ....
2024-08-14 09:31:08 - libunbound-dev installed successfully....
2024-08-14 09:31:08 - Installing libsybdb5 ....
2024-08-14 09:31:10 - libsybdb5 installed successfully....
2024-08-14 09:31:10 - Installing libspeexdsp-dev ....
2024-08-14 09:31:10 - libspeexdsp-dev installed successfully....
2024-08-14 09:31:10 - Installing libiksemel-dev ....
2024-08-14 09:31:11 - libiksemel-dev installed successfully....
2024-08-14 09:31:11 - Installing libresample1-dev ....
2024-08-14 09:31:12 - libresample1-dev installed successfully....
2024-08-14 09:31:12 - Installing libgmime-3.0-dev ....
2024-08-14 09:31:15 - libgmime-3.0-dev installed successfully....
2024-08-14 09:31:15 - Installing libc-client2007e-dev ....
2024-08-14 09:31:17 - libc-client2007e-dev installed successfully....
2024-08-14 09:31:17 - Installing dpkg-dev ....
2024-08-14 09:31:19 - dpkg-dev installed successfully....
2024-08-14 09:31:19 - Installing ghostscript ....
2024-08-14 09:31:24 - ghostscript installed successfully....
2024-08-14 09:31:24 - Installing libtiff-tools ....
2024-08-14 09:31:25 - libtiff-tools installed successfully....
2024-08-14 09:31:26 - Installing iptables-persistent ....
2024-08-14 09:31:28 - iptables-persistent installed successfully....
2024-08-14 09:31:28 - Installing rsyslog ....
2024-08-14 09:31:30 - rsyslog installed successfully....
2024-08-14 09:31:30 - Installing nmap ....
2024-08-14 09:31:32 - nmap installed successfully....
2024-08-14 09:31:32 - Installing apache2 ....
2024-08-14 09:31:37 - apache2 installed successfully....
2024-08-14 09:31:37 - Installing zip ....
2024-08-14 09:31:38 - zip installed successfully....
2024-08-14 09:31:38 - Installing incron ....
2024-08-14 09:31:40 - incron installed successfully....
2024-08-14 09:31:40 - Installing chrony ....
2024-08-14 09:31:42 - chrony installed successfully....
2024-08-14 09:31:43 - Installing vim ....
2024-08-14 09:31:45 - vim installed successfully....
2024-08-14 09:31:45 - Installing build-essential ....
2024-08-14 09:31:49 - build-essential installed successfully....
2024-08-14 09:31:49 - Installing mariadb-server ....
2024-08-14 09:31:54 - mariadb-server installed successfully....
2024-08-14 09:31:54 - Installing bison ....
2024-08-14 09:31:56 - bison installed successfully....
2024-08-14 09:31:56 - Installing flex ....
2024-08-14 09:31:57 - flex installed successfully....
2024-08-14 09:31:57 - Installing flite ....
2024-08-14 09:31:59 - flite installed successfully....
2024-08-14 09:31:59 - Installing php8.2 ....
2024-08-14 09:32:08 - php8.2 installed successfully....
2024-08-14 09:32:08 - Installing php8.2-curl ....
2024-08-14 09:32:09 - php8.2-curl installed successfully....
2024-08-14 09:32:09 - Installing php8.2-zip ....
2024-08-14 09:32:11 - php8.2-zip installed successfully....
2024-08-14 09:32:11 - Installing php8.2-redis ....
2024-08-14 09:32:12 - php8.2-redis installed successfully....
2024-08-14 09:32:12 - Installing php8.2-mysql ....
2024-08-14 09:32:14 - php8.2-mysql installed successfully....
2024-08-14 09:32:14 - Installing php8.2-gd ....
2024-08-14 09:32:16 - php8.2-gd installed successfully....
2024-08-14 09:32:16 - Installing php8.2-mbstring ....
2024-08-14 09:32:17 - php8.2-mbstring installed successfully....
2024-08-14 09:32:17 - Installing php8.2-intl ....
2024-08-14 09:32:18 - php8.2-intl installed successfully....
2024-08-14 09:32:18 - Installing php8.2-xml ....
2024-08-14 09:32:21 - php8.2-xml installed successfully....
2024-08-14 09:32:21 - Installing php8.2-bz2 ....
2024-08-14 09:32:22 - php8.2-bz2 installed successfully....
2024-08-14 09:32:22 - Installing php8.2-ldap ....
2024-08-14 09:32:23 - php8.2-ldap installed successfully....
2024-08-14 09:32:24 - Installing php8.2-sqlite3 ....
2024-08-14 09:32:25 - php8.2-sqlite3 installed successfully....
2024-08-14 09:32:25 - Installing php8.2-bcmath ....
2024-08-14 09:32:26 - php8.2-bcmath installed successfully....
2024-08-14 09:32:26 - Installing php8.2-soap ....
2024-08-14 09:32:27 - php8.2-soap installed successfully....
2024-08-14 09:32:27 - Installing php8.2-ssh2 ....
2024-08-14 09:32:28 - php8.2-ssh2 installed successfully....
2024-08-14 09:32:28 - Installing php-pear ....
2024-08-14 09:32:29 - php-pear installed successfully....
2024-08-14 09:32:29 - Installing sox ....
2024-08-14 09:32:31 - sox installed successfully....
2024-08-14 09:32:31 - Installing libncurses5-dev ....
2024-08-14 09:32:32 - libncurses5-dev installed successfully....
2024-08-14 09:32:32 - Installing mpg123 ....
2024-08-14 09:32:34 - mpg123 installed successfully....
2024-08-14 09:32:34 - Installing libxml2-dev ....
2024-08-14 09:32:36 - libxml2-dev installed successfully....
2024-08-14 09:32:36 - Installing libnewt-dev ....
2024-08-14 09:32:37 - libnewt-dev installed successfully....
2024-08-14 09:32:37 - Installing sqlite3 ....
2024-08-14 09:32:39 - sqlite3 installed successfully....
2024-08-14 09:32:39 - Installing libsqlite3-dev ....
2024-08-14 09:32:40 - libsqlite3-dev installed successfully....
2024-08-14 09:32:40 - Installing automake ....
2024-08-14 09:32:41 - automake installed successfully....
2024-08-14 09:32:41 - Installing libtool ....
2024-08-14 09:32:42 - libtool installed successfully....
2024-08-14 09:32:42 - Installing git ....
2024-08-14 09:32:44 - git installed successfully....
2024-08-14 09:32:44 - Installing unixodbc-dev ....
2024-08-14 09:32:45 - unixodbc-dev installed successfully....
2024-08-14 09:32:45 - Installing uuid ....
2024-08-14 09:32:47 - uuid installed successfully....
2024-08-14 09:32:47 - Installing libasound2-dev ....
2024-08-14 09:32:48 - libasound2-dev installed successfully....
2024-08-14 09:32:48 - Installing libogg-dev ....
2024-08-14 09:32:49 - libogg-dev installed successfully....
2024-08-14 09:32:49 - Installing libvorbis-dev ....
2024-08-14 09:32:50 - libvorbis-dev installed successfully....
2024-08-14 09:32:50 - Installing libcurl4-openssl-dev ....
2024-08-14 09:32:51 - libcurl4-openssl-dev installed successfully....
2024-08-14 09:32:51 - Installing odbc-mariadb ....
2024-08-14 09:32:52 - odbc-mariadb installed successfully....
2024-08-14 09:32:52 - Installing libical-dev ....
2024-08-14 09:32:53 - libical-dev installed successfully....
2024-08-14 09:32:53 - Installing libneon27-dev ....
2024-08-14 09:32:55 - libneon27-dev installed successfully....
2024-08-14 09:32:55 - Installing libsrtp2-dev ....
2024-08-14 09:32:56 - libsrtp2-dev installed successfully....
2024-08-14 09:32:56 - Installing libspandsp-dev ....
2024-08-14 09:32:58 - libspandsp-dev installed successfully....
2024-08-14 09:32:58 - Installing subversion ....
2024-08-14 09:33:00 - subversion installed successfully....
2024-08-14 09:33:00 - Installing libtool-bin ....
2024-08-14 09:33:01 - libtool-bin installed successfully....
2024-08-14 09:33:01 - Installing python-dev-is-python3 ....
2024-08-14 09:33:03 - python-dev-is-python3 installed successfully....
2024-08-14 09:33:03 - Installing unixodbc ....
2024-08-14 09:33:04 - unixodbc installed successfully....
2024-08-14 09:33:05 - Installing libjansson-dev ....
2024-08-14 09:33:05 - libjansson-dev installed successfully....
2024-08-14 09:33:05 - Installing nodejs ....
2024-08-14 09:33:07 - nodejs installed successfully....
2024-08-14 09:33:07 - Installing npm ....
2024-08-14 09:33:26 - npm installed successfully....
2024-08-14 09:33:26 - Installing ipset ....
2024-08-14 09:33:27 - ipset installed successfully....
2024-08-14 09:33:27 - Installing fail2ban ....
2024-08-14 09:33:30 - fail2ban installed successfully....
2024-08-14 09:33:30 - Installing liburiparser-dev ....
2024-08-14 09:33:31 - liburiparser-dev installed successfully....
2024-08-14 09:33:31 - Installing postfix ....
2024-08-14 09:33:41 - postfix installed successfully....
2024-08-14 09:33:41 - Installing tcpdump ....
2024-08-14 09:33:42 - tcpdump installed successfully....
2024-08-14 09:33:42 - Installing sngrep ....
2024-08-14 09:33:43 - sngrep installed successfully....
2024-08-14 09:33:43 - Installing libavdevice-dev ....
2024-08-14 09:33:58 - libavdevice-dev installed successfully....
2024-08-14 09:33:58 - Installing tftpd-hpa ....
2024-08-14 09:34:00 - Exiting script
kguptasangoma commented 1 month ago

Hi @asarubbo but logs are not saying this got exited due to ipv6 ?

Ideally after tftpd-hpa it should install remaining packages like xinetd,lame, haproxy etc etc

JoseGoncalves commented 1 month ago

I also hit this issue because I normally setup VMs without IPv6 support.

It's due to the tftpd-hpa package default config assumes the system has IPv6 support and the tftp daemon crashes when there is no IPv6.

My workaround for this was to install tftpd-hpa package prior to installing FreePBX and change /etc/default/tftpd-hpa to configure an IPV4 only daemon:

TFTP_OPTIONS="--secure --ipv4 --verbose"
kguptasangoma commented 1 month ago

thanks @JoseGoncalves just pushed the changes in the install script to use ipv4 for tftpd process.

JoseGoncalves commented 1 month ago

Hi @kguptasangoma. Your fix does not work, because the installation fails just after the tftpd-hpa package installation, due to using the default config that only works with systems with IPv6 support. Here is the relevant log in /var/log/pbx/ when the script aborts:

2024-08-21 18:23:24 - ############################### 
2024-08-21 18:23:24 - Installing tftpd-hpa ....
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
  pxelinux
The following NEW packages will be installed:
  tftpd-hpa
Preconfiguring packages ...
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/41.9 kB of archives.
After this operation, 117 kB of additional disk space will be used.
Selecting previously unselected package tftpd-hpa.
(Reading database ... 90670 files and directories currently installed.)
Preparing to unpack .../tftpd-hpa_5.2+20150808-1.4_amd64.deb ...
Unpacking tftpd-hpa (5.2+20150808-1.4) ...
Setting up tftpd-hpa (5.2+20150808-1.4) ...
tftpd user (tftp) already exists, doing nothing.
Job for tftpd-hpa.service failed because the control process exited with error code.
See "systemctl status tftpd-hpa.service" and "journalctl -xeu tftpd-hpa.service" for details.
invoke-rc.d: initscript tftpd-hpa, action "start" failed.
× tftpd-hpa.service - LSB: HPA's tftp server
     Loaded: loaded (/etc/init.d/tftpd-hpa; generated)
     Active: failed (Result: exit-code) since Wed 2024-08-21 18:23:26 WEST; 13ms ago
       Docs: man:systemd-sysv-generator(8)
    Process: 33061 ExecStart=/etc/init.d/tftpd-hpa start (code=exited, status=71)
        CPU: 20ms

ago 21 18:23:26 st-3 systemd[1]: Starting tftpd-hpa.service - LSB: HPA's tftp server...
ago 21 18:23:26 st-3 in.tftpd[33067]: cannot open IPv6 socket, disable IPv6: Address family not supported by protocol
ago 21 18:23:26 st-3 in.tftpd[33067]: Cannot set nonblock flag on socket: Bad file descriptor
ago 21 18:23:26 st-3 systemd[1]: tftpd-hpa.service: Control process exited, code=exited, status=71/OSERR
ago 21 18:23:26 st-3 tftpd-hpa[33061]: Starting HPA's tftpd: in.tftpd
ago 21 18:23:26 st-3 systemd[1]: tftpd-hpa.service: Failed with result 'exit-code'.
ago 21 18:23:26 st-3 systemd[1]: Failed to start tftpd-hpa.service - LSB: HPA's tftp server.
dpkg: error processing package tftpd-hpa (--configure):
 installed tftpd-hpa package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.11.2-2) ...
Errors were encountered while processing:
 tftpd-hpa
E: Sub-process /usr/bin/dpkg returned an error code (1)
2024-08-21 18:23:26 - Exiting script
kguptasangoma commented 1 month ago

ohh okay, installation time itself process will not start due to ipv6.