FreeBSD - メンテナンス・トラブルシュート - ウェブサーバ - apache24 2.4.46_2 → 2.4.48

 クラウディア
1. 概要
2. ソース
3. pkg 適用

1. 概要

 これを書いているのは、2021年7月7日ですが、実はずいぶん前から発生中。

$ pkg version -vl "<"
apache24-2.4.46_2                  <   needs updating (index has 2.4.48)
mod_php80-8.0.6                    <   needs updating (index has 8.0.8)
 という状況であります。  「mod_php80」は、「apache24」に依存するから、同様の状態であります。

portupgrade -Rr apache24
 すると

[Reading data from pkg(8) ... - 361 packages found - done]

・・・	略	・・・

/usr/local/share/apr/build-1/libtool --silent --mode=compile cc    -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing      -DLIBICONV_PLUG   -I. -I/usr/ports/www/apache24/work/httpd-2.4.48/os/unix -I/usr/ports/www/apache24/work/httpd-2.4.48/include -I/usr/local/include/apr-1 -I/usr/local/include -I/usr/local/include/db5 -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/aaa -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/cache -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/core -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/database -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/filters -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/ldap -I/usr/ports/www/apache24/work/httpd-2.4.48/server -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/loggers -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/lua -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/proxy -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/http2 -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/session -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/ssl -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/test -I/usr/ports/www/apache24/work/httpd-2.4.48/server -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/md -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/arch/unix -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/dav/main -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/generators -I/usr/ports/www/apache24/work/httpd-2.4.48/modules/mappers  -prefer-non-pic -static -c unixd.c && touch unixd.lo
unixd.c:245:25: error: variable has incomplete type 'union semun'
            union semun ick;
                        ^
unixd.c:245:19: note: forward declaration of 'union semun'
            union semun ick;
                  ^
1 error generated.
*** [unixd.lo] Error code 1

・・・	略	・・・

make[2]: stopped in /usr/ports/www/apache24/work/httpd-2.4.48
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/apache24
*** Error code 1

Stop.
make: stopped in /usr/ports/www/apache24
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade20210707-41046-mxp58b env UPGRADE_TOOL=portupgrade UPGRADE_PORT=apache24-2.4.46_2 UPGRADE_PORT_VER=2.4.46_2 make
** Fix the problem and try again.
--->  Skipping 'www/mod_php80' (mod_php80-8.0.6) because a requisite package 'apache24-2.4.46_2' (www/apache24) failed (specify -k to force)
** Listing the failed packages (-:ignored / *:skipped / !:failed)
        ! www/apache24 (apache24-2.4.46_2)      (unknown build error)
        * www/mod_php80 (mod_php80-8.0.6)
 これ

make MAKE_JOBS_UNSAFE=yes
 しても同じになります。

2. ソース

 この手順で、「make」はできますが、「apache24」が起動できなくなりますので、次項、「pkg」を適用してください。  エラーになるソースを見てみます。

vi /usr/ports/www/apache24/work/httpd-2.4.48/os/unix/unixd.c
 ここですにゃ。

AP_DECLARE(apr_status_t) ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
{
    if (!geteuid()) {
        apr_lockmech_e mech = proc_mutex_mech(pmutex);

        switch(mech) {
#if APR_HAS_SYSVSEM_SERIALIZE
        case APR_LOCK_SYSVSEM:
        {
            apr_os_proc_mutex_t ospmutex;
#if !APR_HAVE_UNION_SEMUN
            union semun {
                long val;
                struct semid_ds *buf;
                unsigned short *array;
            };
#endif
            union semun ick;
            struct semid_ds buf = { { 0 } };

            apr_os_proc_mutex_get(&ospmutex, pmutex);
            buf.sem_perm.uid = ap_unixd_config.user_id;
            buf.sem_perm.gid = ap_unixd_config.group_id;
            buf.sem_perm.mode = 0600;
            ick.buf = &buf;
            if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) {
                return errno;
            }
        }
 238~244行間の「#if」が機能していないように思われます。  238、244行をコメントアウトして

cd /usr/ports/www/apache24
make
 「make」が通りました。

cd /usr/ports/www/apache24
make deinstall
make install
 なにやら、アンインストール、インストール時に気になるログが表示されたので記録しておきます。  アンインストール時。

$ make deinstall
===>  Deinstalling for apache24
===>   Deinstalling apache24-2.4.46_2
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        apache24: 2.4.46_2

Number of packages to be removed: 1

The operation will free 27 MiB.
[1/1] Deinstalling apache24-2.4.46_2...
[1/1] Deleting files for apache24-2.4.46_2: 100%
You may need to manually remove /usr/local/etc/apache24/extra/httpd-default.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/apache24/extra/httpd-info.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/apache24/extra/httpd-ssl.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/apache24/extra/httpd-vhosts.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/apache24/httpd.conf if it is no longer needed.
 なんかいらなくなったものがある的な・・・。  インストール時。

$ make install
===>  Installing for apache24-2.4.48
===>  Checking if apache24 is already installed
===>   Registering installation for apache24-2.4.48
Installing apache24-2.4.48...
===> Creating groups.
Using existing group 'www'.
===> Creating users
Using existing user 'www'.
To run apache www server from startup, add apache24_enable="yes"
in your /etc/rc.conf. Extra options can be found in startup script.

Your hostname must be resolvable using at least 1 mechanism in
/etc/nsswitch.conf typically DNS or /etc/hosts or apache might
have issues starting depending on the modules you are using.


- apache24 default build changed from static MPM to modular MPM
- more modules are now enabled per default in the port
- icons and error pages moved from WWWDIR to DATADIR

   If build with modular MPM and no MPM is activated in
   httpd.conf, then mpm_prefork will be activated as default
   MPM in etc/apache24/modules.d to keep compatibility with
   existing php/perl/python modules!

Please compare the existing httpd.conf with httpd.conf.sample
and merge missing modules/instructions into httpd.conf!

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/apache24/mod_cgid.so

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
https://httpd.apache.org/
 これで

portupgrade -Rr mod_php80
 も無事通りましたが、この手順で、「make」はできますが、「apache24」が起動できなくなりますので、次項、「pkg」を適用してください。

3. pkg 適用

 再起動する前に

service apache24 configtest
 すると省略しますが、あれこれと連鎖的にいろいろ困ったことが起きたのです。  仕方なく

pkg install apache24
 わちゃわちゃに、モジュールがダウングレードされたりしますが、仕方ない。  もう後へは引けませんわな・・・。  目をつぶって、進めます。  インストール後。  「apache24」の方は

$ service apache24 configtest
Performing sanity check on apache24 configuration:
Syntax OK
 と、エラーは出なくなりましたでな・・・  あれこれ、アンインストールされたものがありました。  「mysql57-server」ほか、サーバアプリケーションで、「ports」上でインストールされたものではないと判断されてしまっているものもたくさんあります。

service アプリケーション status
 で、「runnig」以外になっているものを見つけては、再インストールします。  一通り終わったら、

$ pkg version -vl "<"
ca_root_nss-3.63                   <   needs updating (index has 3.67)
ghc-8.10.4_1                       <   needs updating (index has 8.10.5)
gnupg-2.2.27                       <   needs updating (index has 2.3.1)
libassuan-2.5.4                    <   needs updating (index has 2.5.5)
libksba-1.5.0                      <   needs updating (index has 1.6.0)
nettle-3.7.2_1                     <   needs updating (index has 3.7.3)
oniguruma-6.9.6                    <   needs updating (index has 6.9.7.1)
tiff-4.2.0                         <   needs updating (index has 4.3.0)
 これらを、ひとつずつ、アップグレードしていきます。  その後、「apache24」を再起動しまして・・・。  無事、起動することができました。
ハイスピードプランStar Naming Gift