我有一台 Ubuntu 20.04 PC,我正在将其设置为带有 Apache 2.4 Web 服务器的 Subversion 服务器,以便我在 Windows 10 PC 上将 Ankh 客户端插件与 Visual Studio 一起使用。
重新启动时,如何修复Apache2 Web 服务器报告的错误?我认为它可能与我在执行 时Unknown DAV provider: svn
看到的错误有关。dpkg: error processing package libapache2-mod-svn
sudo apt reinstall subversion
我最初安装了 Apache 和 Subversion,在更改配置文件后,它运行良好。
然后我卸载并清理了两者,以便重新进行安装,记录我的过程。我对细节有点模糊,但基本步骤如下:
- 使用
sudo apt remove apache2
和sudo apt remove subversion
- 删除一些剩余的目录,例如
/etc/apache2
重新安装并不顺利。出于某种原因,安装似乎不完整,就好像命令apt install
在查找组件并假设其他组件也已经存在,而实际上它们并不存在。在某些情况下,使用apt reinstall
已解决问题,而在其他情况下,我手动构建了配置文件。
现在,Apache Web 服务器已开始运行并提供页面。Subversion 也已在 Ubuntu 的命令行中运行。
我现在遇到了 Apache 的 DAV 组件问题,因为 Subversion 界面无法正常工作。
当我尝试启用几个相关模块时看到错误dav
。
rick@rick-MS-7B98:/etc/apache2$ sudo a2enmod dav dav_fs dav_svn
Enabling module dav.
Considering dependency dav for dav_fs:
Module dav already enabled
Enabling module dav_fs.
Considering dependency dav for dav_svn:
Module dav already enabled
Enabling module dav_svn.
To activate the new configuration, you need to run:
systemctl restart apache2
rick@rick-MS-7B98:/etc/apache2$ sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
rick@rick-MS-7B98:/etc/apache2$ systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-12-13 15:21:50 EST; 13s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 74845 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Dec 13 15:21:50 rick-MS-7B98 systemd[1]: Starting The Apache HTTP Server...
Dec 13 15:21:50 rick-MS-7B98 apachectl[74858]: [Sun Dec 13 15:21:50.461280 2020] [so:warn] [pid 74858] AH01574: module dav_fs_module is already loaded, skipping
Dec 13 15:21:50 rick-MS-7B98 apachectl[74858]: AH00526: Syntax error on line 16 of /etc/apache2/mods-enabled/dav_svn.conf:
Dec 13 15:21:50 rick-MS-7B98 apachectl[74858]: Unknown DAV provider: svn
Dec 13 15:21:50 rick-MS-7B98 apachectl[74845]: Action 'start' failed.
Dec 13 15:21:50 rick-MS-7B98 apachectl[74845]: The Apache error log may have more information.
Dec 13 15:21:50 rick-MS-7B98 systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Dec 13 15:21:50 rick-MS-7B98 systemd[1]: apache2.service: Failed with result 'exit-code'.
Dec 13 15:21:50 rick-MS-7B98 systemd[1]: Failed to start The Apache HTTP Server.
当我尝试执行reinstall
Subversion 时,我看到了dpkg: error processing package labapache2-mod-svn
rick@rick-MS-7B98:~$ sudo ap reinstall subversion
sudo: ap: command not found
rick@rick-MS-7B98:~$ sudo apt reinstall subversion
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/824 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 196796 files and directories currently installed.)
Preparing to unpack .../subversion_1.13.0-3_amd64.deb ...
Unpacking subversion (1.13.0-3) over (1.13.0-3) ...
Setting up libapache2-mod-svn (1.13.0-3) ...
dpkg: error processing package libapache2-mod-svn (--configure):
installed libapache2-mod-svn package post-installation script subprocess returned error exit status 1
Setting up subversion (1.13.0-3) ...
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
libapache2-mod-svn
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我检查 Subversion 的状态时:
rick@rick-MS-7B98:~$ svn --version
svn, version 1.13.0 (r1867053)
compiled Mar 24 2020, 12:33:36 on x86_64-pc-linux-gnu
Copyright (C) 2019 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/
The following repository access (RA) modules are available:
* ra_svn : Module for accessing a repository using the svn network protocol.
- with Cyrus SASL authentication
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
- using serf 1.3.9 (compiled with 1.3.9)
- handles 'http' scheme
- handles 'https' scheme
The following authentication credential caches are available:
* Gnome Keyring
* GPG-Agent
* KWallet (KDE)
当我检查以找出用途时libapache2-mod-svn
,我得到了以下内容。
rick@rick-MS-7B98:~$ dpkg -S libapache2-mod-svn
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/examples/svnindex.css
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/INSTALL.authz.gz
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/README.Debian
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/changelog.Debian.gz
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/examples/svnindex.xsl
libapache2-mod-svn: /usr/share/lintian/overrides/libapache2-mod-svn
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/copyright
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/examples
libapache2-mod-svn: /usr/share/doc/libapache2-mod-svn/NEWS.Debian.gz
答案1
作为调查设置可通过 Apache Web 服务器访问的 Subversion 存储库的一部分,我想删除 Subversion 和 Apache2,然后重新进行安装。
第二次安装时,似乎安装导致一些文件和组件丢失,特别是文件和目录,/etc/apache2/
例如mods-enabled
。几个dav
文件(dav_fs.conf
、、、和)也丢失了。但是,在使用选项重新执行命令后,文件被重新创建。但没有为文件创建符号链接。dav_fs.load
dav.load
dav_svn.conf
dav_svn.load
apt
reinstall
mods-available
mods-enabled
dav
我可以通过使用命令查看状态systemctl status apache2.service
、查看 Apache2 服务器日志/var/log/apache2
并在互联网上搜索错误消息来纠正 Apache2 服务器启动错误。
对于此错误,有几篇文章提到将指令添加LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
到文件中httpd2.conf
,但是在我的 Apache 服务器中,有一个文件/etc/apache2/apache2.conf
似乎是配置参数的起点,并且在处理此文件期间,根据以下评论,位于子目录中的其他文件/etc/apache2/apache2.conf
:
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
# directories contain particular configuration snippets which manage modules,
# global configuration fragments, or virtual host configurations,
# respectively.
IncludeOptional
附加配置文件通过中的指令加载apache2.conf
。
根据@user535733的建议,他指出Unix & Linux StackExchange:未知 DAV 提供商:svn,我决定通过使用以下命令LoadModule
重新创建文件来尝试该指令:/etc/apache2/mods-available/dav_svn.load
# Depends: dav
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
然后将符号链接到目录中/etc/apache2/mods-enabled/
。
dav_fs.conf
当我为其他 DAV 相关文件( 、dav_fs.load
和dav.load
)创建符号链接时,此方法有效。
sudo apt upgrade 错误
我以为我已经解决了所有问题,但几天后我尝试运行,sudo apt upgrade
却sudo apt update
显示以下错误:
rick@rick-MS-7B98:/etc/apache2/mods-enabled$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libapache2-mod-svn (1.13.0-3) ...
dpkg: error processing package libapache2-mod-svn (--configure):
installed libapache2-mod-svn package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libapache2-mod-svn
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试了几种方法来清除这个错误,最后才成功。
我尝试过sudo apt reinstall libapache2-mod-svn
,但出现了类似的错误。
我尝试了sudo apt remove libapache2-mod-svn
一下,成功了,并且能够sudo apt upgrade
毫无错误地完成操作,但是模块现在已被删除。
我尝试过sudo apt-get install libapache2-mod-svn
,但出现了类似的错误。
然后,我尝试了一篇文章中建议的有关此类错误的一些命令:sudo dpkg --configure -a
但sudo apt-get install -f
出现了以下错误:
rick@rick-MS-7B98:~$ sudo dpkg --configure -a
Setting up libapache2-mod-svn (1.13.0-3) ...
dpkg: error processing package libapache2-mod-svn (--configure):
installed libapache2-mod-svn package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libapache2-mod-svn
rick@rick-MS-7B98:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up libapache2-mod-svn (1.13.0-3) ...
dpkg: error processing package libapache2-mod-svn (--configure):
installed libapache2-mod-svn package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
libapache2-mod-svn
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试通过使用sudo apt remove libapache2-mod-svn
然后执行sudo apt update
然后sudo apt upgrade
然后纠正这些错误sudo apt install libapache2-mod-svn
,但失败并显示类似的错误消息。
最后,我使用了一系列命令来删除(sudo apt remove libapache2-mod-svn
)、清除(sudo apt purge libapache2-mod-svn
),然后安装(sudo apt-get install libapache2-mod-svn
),这些命令似乎运行正常,没有任何错误。然后我必须/etc/apache2/mods-enabled/dav_svn.conf
再次修改文件,然后我才能通过 访问我的 Subversion 存储库http://192.168.0.4/svn
。
rick@rick-MS-7B98:/etc/apache2/mods-enabled$ sudo apt remove libapache2-mod-svn
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libapache2-mod-svn
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 452 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 196824 files and directories currently installed.)
Removing libapache2-mod-svn (1.13.0-3) ...
apache2_invoke authz_svn prerm: No action required
apache2_invoke dav_svn prerm: No action required
rick@rick-MS-7B98:/etc/apache2/mods-enabled$ sudo apt purge libapache2-mod-svn
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libapache2-mod-svn*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 196812 files and directories currently installed.)
Purging configuration files for libapache2-mod-svn (1.13.0-3) ...
apache2_invoke authz_svn postrm: No action required
apache2_invoke postrm: Purging state for dav_svn
rick@rick-MS-7B98:/etc/apache2/mods-enabled$ sudo apt-get install libapache2-mod-svn
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
db5.3-util
The following NEW packages will be installed:
libapache2-mod-svn
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/87.7 kB of archives.
After this operation, 452 kB of additional disk space will be used.
Selecting previously unselected package libapache2-mod-svn.
(Reading database ... 196809 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-svn_1.13.0-3_amd64.deb ...
Unpacking libapache2-mod-svn (1.13.0-3) ...
Setting up libapache2-mod-svn (1.13.0-3) ...
apache2_invoke: Enable module authz_svn
apache2_invoke dav_svn: already enabled
rick@rick-MS-7B98:/etc/apache2/mods-enabled$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.