This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fuss:debian [2020/07/28 01:41] – [Recompile Debian Kernel] office | fuss:debian [2025/08/17 20:14] (current) – [Fixing PHP FPM Binary Version] office | ||
---|---|---|---|
Line 412: | Line 412: | ||
</ | </ | ||
+ | ====== Disable nftables and Continue Using Legacy iptables ====== | ||
+ | <code bash> | ||
+ | update-alternatives --set iptables / | ||
+ | update-alternatives --set ip6tables / | ||
+ | update-alternatives --set arptables / | ||
+ | update-alternatives --set ebtables / | ||
+ | </ | ||
+ | |||
+ | ====== Fix Issues on Release Change ====== | ||
+ | |||
+ | When a repository changes its release data the following error should appear when updating packages: | ||
+ | < | ||
+ | This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details | ||
+ | </ | ||
+ | |||
+ | the solution is to run '' | ||
+ | <code bash> | ||
+ | apt-get update --allow-releaseinfo-change | ||
+ | </ | ||
+ | |||
+ | with the extra '' | ||
+ | |||
+ | ====== Ensuring HostAPd is Started Only After the Bridge Interface ====== | ||
+ | |||
+ | On Debian, bridging the wireless interface to a bridge involves using '' | ||
+ | |||
+ | In order to do this, copy ''/ | ||
+ | |||
+ | Assuming '' | ||
+ | < | ||
+ | [Unit] | ||
+ | Description=Access point and authentication server for Wi-Fi and Ethernet | ||
+ | Documentation=man: | ||
+ | BindsTo=sys-devices-virtual-net-br0.device | ||
+ | After=sys-devices-virtual-net-br0.device sys-subsystem-net-devices-wlan0.device | ||
+ | ConditionFileNotEmpty=/ | ||
+ | |||
+ | [Service] | ||
+ | Type=forking | ||
+ | PIDFile=/ | ||
+ | Restart=on-failure | ||
+ | RestartSec=2 | ||
+ | Environment=DAEMON_CONF=/ | ||
+ | EnvironmentFile=-/ | ||
+ | ExecStart=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | |||
+ | </ | ||
+ | |||
+ | ====== Enabling Wireless Network Roaming using ifupdown and wpasupplicant Roaming ====== | ||
+ | |||
+ | Wireless network roaming is a mechanism through which wireless clients (computers, laptops, etc.) change their network depending on the wireless networks that are currently available. Roaming can be accomplished easily on Linux using ifupdown and plain wpasupplicant by first configuring the wireless interface and then adding networks to the wpa supplicant configuration. | ||
+ | |||
+ | For example, here are the contents of the file ''/ | ||
+ | < | ||
+ | auto wlan0 | ||
+ | allow-hotplug wlan0 | ||
+ | iface wlan0 inet manual | ||
+ | wpa-roam / | ||
+ | |||
+ | iface default inet dhcp | ||
+ | |||
+ | </ | ||
+ | |||
+ | The file defines the network interface '' | ||
+ | |||
+ | The line '' | ||
+ | |||
+ | The next part is to set up '' | ||
+ | < | ||
+ | ctrl_interface=DIR=/ | ||
+ | update_config=1 | ||
+ | country=IS | ||
+ | |||
+ | network={ | ||
+ | ssid=" | ||
+ | # | ||
+ | psk= | ||
+ | priority=1 | ||
+ | id_str=" | ||
+ | } | ||
+ | |||
+ | network={ | ||
+ | ssid=" | ||
+ | # | ||
+ | psk=... | ||
+ | priority=2 | ||
+ | id_str=" | ||
+ | } | ||
+ | |||
+ | network={ | ||
+ | ssid=" | ||
+ | # | ||
+ | psk=... | ||
+ | priority=3 | ||
+ | id_str=" | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | that defines three Wifi networks with SSIDs, '' | ||
+ | |||
+ | Note that the markers '' | ||
+ | < | ||
+ | auto wlan0 | ||
+ | allow-hotplug wlan0 | ||
+ | iface wlan0 inet manual | ||
+ | wpa-roam / | ||
+ | |||
+ | iface default inet dhcp | ||
+ | |||
+ | iface wifi_c inet manual | ||
+ | address 192.168.0.1 | ||
+ | netmask 255.255.255.0 | ||
+ | |||
+ | </ | ||
+ | where '' | ||
+ | |||
+ | ====== mod_qos & Others Undefined Symbol ====== | ||
+ | |||
+ | As rare as it may be, sometimes Debian packages are broken and the built binaries reference libraries that are not available on the current system. As an example, here is the '' | ||
+ | < | ||
+ | mod_qos.so: undefined symbol: pcre_free | ||
+ | </ | ||
+ | |||
+ | One solution is to attempt and upgrade the package to " | ||
+ | |||
+ | A better solution is [[/ | ||
+ | |||
+ | ====== Get Debian Version ====== | ||
+ | |||
+ | The following release should display the current Debian version: | ||
+ | |||
+ | <code bash> | ||
+ | lsb_release -a | ||
+ | </ | ||
+ | |||
+ | ====== Quick Way to Install All Packages from One Machine Onto the Other ====== | ||
+ | |||
+ | Using some command-line tools while logged in on '' | ||
+ | <code bash> | ||
+ | dpkg --get-selections | grep ' | ||
+ | </ | ||
+ | that will get all the installed packages from '' | ||
+ | |||
+ | The transfer is sometimes useful in situations where the same set of packages have to be used across a cluster of nodes, or some uniformity is desired across several machines, such as within a docker swarm. | ||
+ | |||
+ | ====== Retrieve an Original File from the Debian Repository ====== | ||
+ | |||
+ | The following command will create a command-line alias named '' | ||
+ | <code bash> | ||
+ | dist-file() { dpkg -S / | ||
+ | </ | ||
+ | |||
+ | In order to use the alias, just copy-paste the above line into a terminal and press return. If successful, the command will produce no output. | ||
+ | |||
+ | The alias is pretty useful for system administrators that have changed service configuration files and would like to retrieve the original file in order to compare with the local file. The alias can of course be piped into '' | ||
+ | |||
+ | For example, the following command will display that changes between the original package file at ''/ | ||
+ | <code bash> | ||
+ | dist-file / | ||
+ | </ | ||
+ | and it thus shows any local changes that have been made to the main Apache2 configuration file. | ||
+ | |||
+ | The version above picks the currently available Debian package according to distribution settings (oldstable, stable, unstable, experimental, | ||
+ | <code bash> | ||
+ | dist-file-exact() { dpkg -S $1 | awk -F':' | ||
+ | </ | ||
+ | |||
+ | However, be aware that the '' | ||
+ | |||
+ | ====== Filtering Interfaces and Protocol Version in IfUpDown Scripts ====== | ||
+ | |||
+ | IfUpDown scripts run once an interface is added, removed, but also when a given protocol link has been established such as IPv4 or IPv6 such that it is necessary to filter for both in order to ensure that a script runs once. | ||
+ | |||
+ | For example, the following script added to ''/ | ||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | |||
+ | [ " | ||
+ | [ " | ||
+ | |||
+ | brctl addif br0 usb0 | ||
+ | |||
+ | </ | ||
+ | will filter events for the addition of the '' | ||
+ | |||
+ | Iff. the interface being brought up is '' | ||
+ | |||
+ | ====== Fixing PHP FPM Binary Version ====== | ||
+ | |||
+ | For most versioned binaries on Debian, the convention is that the current version of the binary is a symlink that points to the actual binary version being installed. The clearest base-case example is the Linux kernel that appears on the root ''/'' | ||
+ | |||
+ | The problem is that PHP FPM, the CGI binary that can be used to process PHP for Apache, while it does have a generic package name, namely '' | ||
+ | |||
+ | * ''/ | ||
+ | * ''/ | ||
+ | * ''/ | ||
+ | |||
+ | The Apache2 configuration that instructs Apache on how to run PHP FPM at ''/ | ||
+ | |||
+ | In case the configuration is fixed, such as [[/ | ||
+ | |||
+ | The obvious solution is to create symlinks to the paths and current PHP FPM binary. For example, the following command is executed while building a Docker LAMP container after installing PHP FPM: | ||
+ | <code bash> | ||
+ | # link current php-fpm version to a static name | ||
+ | find /usr/sbin/ \ | ||
+ | -type f \ | ||
+ | -regextype posix-extended \ | ||
+ | -regex "/ | ||
+ | -exec ln -sf ' | ||
+ | find /etc/php/ \ | ||
+ | -type d \ | ||
+ | -regextype posix-extended \ | ||
+ | -regex "/ | ||
+ | -exec ln -sf ' | ||
+ | </ | ||
+ | |||
+ | and the commands create the following symlinks for, say, PHP FPM 8.4: | ||
+ | * ''/ | ||
+ | * ''/ | ||
+ | |||
+ | Now, the binary and path can be referenced on the command-line without caring which PHP FPM version is installed because the symlinks will always refer to the version that is currently installed. For example, running PHP FPM becomes a matter of: | ||
+ | <code bash> | ||
+ | # start php cgi server | ||
+ | / | ||
+ | --nodaemonize \ | ||
+ | --fpm-config / | ||
+ | & | ||
+ | |||
+ | # wait for socket | ||
+ | while [ ! -S / | ||
+ | sleep 1 | ||
+ | done | ||
+ | |||
+ | find /run/php/ \ | ||
+ | -type s \ | ||
+ | -regextype posix-extended \ | ||
+ | -regex "/ | ||
+ | -exec ln -sf ' | ||
+ | |||
+ | </ | ||
+ | |||
+ | where the last '' | ||
+ | |||
+ | Lastly, the Apache2 PHP FPM configuration file ''/ |
For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.