staging.inyokaproject.org

Apache2 lässt sich nicht starten

Status: Ungelöst | Ubuntu-Version: Server 22.04 (Jammy Jellyfish)
Antworten |

Wolfmann

Anmeldungsdatum:
7. Oktober 2018

Beiträge: Zähle...

Hallo,

ich wollte auf einem server mit oben genannten Ubuntu-Betriebssystem den apache2 Webserver installieren. Schon bei der Installation gab es einige seltsame Meldungen:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service  /lib/systemd/system/apache2.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service  /lib/systemd/system/apache-htcacheclean.service.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for ufw (0.36.1-4build1) ...
Rules updated for profile 'Apache Full'
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.

Daraufhin lies sich der Webserver auch nicht starten. Ich konnte mir mit systemctl status apache2.service folgende wenig aussagekräftige Melung anzeigen lassen:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
× apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-04-03 15:41:07 UTC; 12s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 6616 ExecStart=/usr/sbin/apachectl start (code=exited, status=127)
        CPU: 5ms
Apr 03 15:41:07 vm67992 systemd[1]: Starting The Apache HTTP Server...
Apr 03 15:41:07 vm67992 apachectl[6619]: /usr/sbin/apachectl: 174: /usr/sbin/apache2: not found
Apr 03 15:41:07 vm67992 apachectl[6616]: Action 'start' failed.
Apr 03 15:41:07 vm67992 apachectl[6616]: The Apache error log may have more information.
Apr 03 15:41:07 vm67992 systemd[1]: apache2.service: Control process exited, code=exited, status=127/n/a
Apr 03 15:41:07 vm67992 systemd[1]: apache2.service: Failed with result 'exit-code'.
Apr 03 15:41:07 vm67992 systemd[1]: Failed to start The Apache HTTP Server.

Weiß jemand, wo das Problem liegen könnte oder wo man da ansetzt? Ich würde mich sehr um ein bisschen Expertenwissen freuen. Normalerweise klappt die Installation von apache2 problemlos...

verdooft

Anmeldungsdatum:
15. September 2012

Beiträge: 3425

Vollständige Ein und Ausgaben wären da von Vorteil. Ich habe den Apache unter 22.04 problemlos so installieren können:

sudo apt install apache2

Ist das Paket bei dir jetzt eigentlich installiert?

apt-cache policy apache2

Die Meldung spricht nicht gerade dafür:

 /usr/sbin/apache2: not found 

Paket purgen, nochmal installieren, dann die Ein- und Ausgabe bitte vollständig posten.

Du verwendest sicher 22-04? Unter 20.04 hatte schonmal wer ein ähnliches Problem:

https://askubuntu.com/questions/1301101/apache2-not-properly-installed-and-not-starting-in-ubuntu-20-04. Falls sich das Paket partou nicht installiern lässt, könntest du mal eine andere Version versuchen, etwa:

apt-cache policy apache2
apache2:
  Installed: 2.4.56-1+ubuntu22.04.1+deb.sury.org+1
  Candidate: 2.4.56-1+ubuntu22.04.1+deb.sury.org+1
  Version table:
 *** 2.4.56-1+ubuntu22.04.1+deb.sury.org+1 500
        500 https://ppa.launchpadcontent.net/ondrej/apache2/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

Wolfmann

(Themenstarter)

Anmeldungsdatum:
7. Oktober 2018

Beiträge: 302

Danke erstmal für die Antwort.

Habe das apache2 mit purge entfernt und neu installiert. Hier mal die komplette Ausgabe der Installation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
sudo apt-get install apache2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser
The following NEW packages will be installed:
  apache2
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/97.8 kB of archives.
After this operation, 546 kB of additional disk space will be used.
Selecting previously unselected package apache2.
(Reading database ... 86197 files and directories currently installed.)
Preparing to unpack .../apache2_2.4.52-1ubuntu4.4_amd64.deb ...
Unpacking apache2 (2.4.52-1ubuntu4.4) ...
Setting up apache2 (2.4.52-1ubuntu4.4) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling module reqtimeout.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service  /lib/systemd/system/apache2.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 142.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service  /lib/systemd/system/apache-htcacheclean.service.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for ufw (0.36.1-4build1) ...
Rules updated for profile 'Apache Full'
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.

Das andere Kommando bringt folgendes:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
apt-cache policy apache2
apache2:
  Installed: 2.4.52-1ubuntu4.4
  Candidate: 2.4.52-1ubuntu4.4
  Version table:
 *** 2.4.52-1ubuntu4.4 500
        500 http://de.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages
        100 /var/lib/dpkg/status
     2.4.52-1ubuntu4 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Scheint also installiert zu sein. Das Problem ist, dass man apache2 nicht starten kann. Kann das was mit irgendwelchen Firewall oder den iptables - Einstellungen zu tun haben?

P.S. habe mit inxi nochmal überprüft. Es ist die Version 22.04

verdooft

Anmeldungsdatum:
15. September 2012

Beiträge: 3425

Hab keine Lösung, wenn man im Web sucht, haben mehrere in Kombination mit verschiedenen Paketen, diese Meldung "Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142." Wenn apache2 noch nicht läuft, gehe ich von einem System aus, das erst kürzlich installiert wurde? Wäre ich in der Situation und das neuere Paket aus der anderen Quelle würde auch nicht vollständig installierbar sein, würde ich Ubuntu wohl einfach mal neu installieren und danach direkt komplett updaten.

Wolfmann

(Themenstarter)

Anmeldungsdatum:
7. Oktober 2018

Beiträge: 302

Ok,das mit dem Neuinstallieren geht nicht so einfach, da es ein gemieteter server ist.

Aber ich habe den pache2 jetzt zum Laufen gebracht. Ich habe mal die Binaries neu installiert:

1
sudo apt-get --reinstall install apache2-bin

Allerdings wenn ich in dem Webbrowser die IP des Servers eingebe, erhalte ich die Meldung: Error 502: Bad Gateway. Blockiert da irgendeine Firewall irgendwas? Wenn ich die Meldung richtig deute, kann der Client nicht auf den server zugreifen...

Edit: Die Standard Seite öffnet sich unter dem Port 33333. Ich habe das Mal so festgelegt, weil ich auf dem Server auch mal einen DNS-Server am Laufen hatte, der den Port 80 benötigte. Den brauche ich aber nicht mehr und ich habe daher bei der 000-default.conf den Virtual Host wieder auf Port 80 gesetzt. Dennoch läuft nach wie vor Port 33333.... Strange.

Wolfmann

(Themenstarter)

Anmeldungsdatum:
7. Oktober 2018

Beiträge: 302

Hat wirklich keiner mehr eine Idee, was es mit dem "Bad Gateway" auf sich haben könnte?

Ich denke, es könnte mit irgendwelchen Firewall-Einstellungen zu tun haben. Ich poste mal meine meine iptables-rules.v4 Datei. Vielleicht findet jemand was auffälliges.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
ilter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4361:872136]
:DOCKER - [0:0]
:DOCKER-ISOLATION-STAGE-1 - [0:0]
:DOCKER-ISOLATION-STAGE-2 - [0:0]
:DOCKER-USER - [0:0]
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m multiport --dports 33333 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m multiport --dports 5000 -j ACCEPT
-A INPUT -p udp -m udp --dport 5353 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -p tcp -m tcp --dport 33333 -j ACCEPT
-A INPUT -p udp -m udp --dport 33333 -j ACCEPT
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN
COMMIT
# Completed on Mon Apr  3 12:58:41 2023
# Generated by iptables-save v1.8.7 on Mon Apr  3 12:58:41 2023
*nat
:PREROUTING ACCEPT [17180:3497841]
:INPUT ACCEPT [342:19430]
:OUTPUT ACCEPT [158:11236]
:POSTROUTING ACCEPT [76:5150]
:DOCKER - [0:0]
-A PREROUTING -s 80.137.133.202/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.106.27/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.101.171/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.113/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.184/32 -i eth0 -j ACCEPT
-A PREROUTING -s 185.40.175.52/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.184/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.184/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.184/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.184/32 -i eth0 -j ACCEPT
-A PREROUTING -s 31.17.39.184/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.137.143.87/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.97.75/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.98.222/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.108.11/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.137.141.15/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.137.141.15/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.108.79/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.132.109.82/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.137.140.176/32 -i eth0 -j ACCEPT
-A PREROUTING -s 80.137.138.220/32 -i eth0 -j ACCEPT
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
-A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
-A PREROUTING -i eth0 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8080
-A PREROUTING -i eth0 -p udp -m udp --dport 53 -j REDIRECT --to-ports 5353
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
-A POSTROUTING -o eth0 -j MASQUERADE
-A DOCKER -i docker0 -j RETURN
COMMIT
# Completed on Mon Apr  3 12:58:41 2023
Antworten |