apache2.service 不是本机服务(ubuntu 16.04)

apache2.service 不是本机服务(ubuntu 16.04)

我的操作系统是 Ubuntu 16.04 LTS。我从 ubuntu 存储库安装了 apache2。应用此命令后:

sudo systemctl 启用 apache2

我收到以下错误:

apache2.service 不是本机服务,重定向到 systemd-sysv-install 执行 /lib/systemd/systemd-sysv-install enable apache2

这根本不能让我满意。这些命令执行没有任何问题:

sudo systemctl restart apache2 
sudo systemctl start apache2

journalctl-exapache2ctl 配置测试没说什么。

journalctl -ex output:
бер 01 21:24:47 medion-laptop NetworkManager[917]: <info>  [1519932287.3295]   lease time 7200
    бер 01 21:24:47 medion-laptop NetworkManager[917]: <info>  [1519932287.3298]   nameserver '192.168.0.1'
    бер 01 21:24:47 medion-laptop NetworkManager[917]: <info>  [1519932287.3300] dhcp4 (wlp8s0): state changed bound -> bound
    бер 01 21:24:47 medion-laptop dbus[908]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-d
    бер 01 21:24:47 medion-laptop systemd[1]: Starting Network Manager Script Dispatcher Service...
    -- Subject: Unit NetworkManager-dispatcher.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- 
Unit NetworkManager-dispatcher.service has begun starting up.
    бер 01 21:24:47 medion-laptop dbus[908]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
    бер 01 21:24:47 medion-laptop nm-dispatcher[8011]: req:1 'dhcp4-change' [wlp8s0]: new request (1 scripts)
    бер 01 21:24:47 medion-laptop nm-dispatcher[8011]: req:1 'dhcp4-change' [wlp8s0]: start running ordered scripts...
    бер 01 21:24:47 medion-laptop systemd[1]: Started Network Manager Script Dispatcher Service.
    -- Subject: Unit NetworkManager-dispatcher.service has finished start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit NetworkManager-dispatcher.service has finished starting up.
    -- 
    -- The start-up result is done.
    бер 01 21:24:47 medion-laptop dhclient[1073]: bound to 192.168.0.102 -- renewal in 2970 seconds.
    бер 01 21:33:40 medion-laptop org.gnome.evolution.dataserver.Sources5[1711]: ** (evolution-source-registry:1911): WARNING **: secret_service_search_sy


medion@medion-laptop:~$ apache2ctl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

我也尝试重新安装我的 apache2 (像这儿),但错误仍然出现。

因此,在搜索了这个问题之后,我发现这个问题通常出现在配置文件有语法错误的时候。但我没有遇到这样的问题,可能是因为我几分钟前才安装了 apache2,从来没有处理过 apache2 的配置文件。

答案1

这不是一个错误,而是一个信息,Ubuntu 16.04 仍然使用 SysV init 样式文件来启动 Apache,而 systemd 只是对其进行了包装。

/lib/systemd/systemd-sysv-install

# This script is called by "systemctl enable/disable" when the given unit is a
# SysV init.d script. It needs to call the distribution's mechanism for
# enabling/disabling those, such as chkconfig, update-rc.d, or similar.

答案2

apache 正在运行吗?此错误并不反映 apache 本身存在任何问题,但它通知您,即使您使用 systemd 命令启用服务,它实际上也会调用 SysVinit 样式脚本。如果 apache 运行正常,您可以放心地忽略此错误。

相关内容