web-dev-qa-db-fra.com

Impossible d'installer Apache sur Ubuntu 16.04

Bonjour, je ne parviens pas à installer Apache2 sur Ubuntu 16.04. Je dois exécuter PHPUnit sur Ubuntu, mais je ne parviens pas à installer PHP car Apache n’est pas installé sur mon PC. Ensuite, j'ai essayé d'installer mysql-server, mais je ne pouvais pas l'installer. J'ai donc essayé d'installer docker afin de pouvoir créer un conteneur et l'utiliser, mais docker n'est pas en cours d'installation. Je suis également incapable de les supprimer complètement.

Toute aide serait bénéfique. Merci d'avance

Sudo apt-get install Apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
Apache2-data Apache2-utils
Suggested packages:
Apache2-doc Apache2-suexec-pristine | Apache2-suexec-custom
The following packages will be REMOVED:
docker-ce mysql-server-5.7
The following NEW packages will be installed:
Apache2 Apache2-data Apache2-utils
0 upgraded, 3 newly installed, 2 to remove and 249 not upgraded.
2 not fully installed or removed.
Need to get 0 B/330 kB of archives.
After this operation, 136 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 205320 files and directories currently installed.)
Removing docker-ce (17.03.0~ce-0~ubuntu-xenial) ...
/var/lib/dpkg/info/docker-ce.postrm: 18: /var/lib/dpkg/info/docker-                ce.postrm: deb-systemd-helper: not found
dpkg: error processing package docker-ce (--remove):
subprocess installed post-removal script returned error exit status 127
Removing mysql-server-5.7 (5.7.17-0ubuntu0.16.04.1) ...
/var/lib/dpkg/info/mysql-server-5.7.postrm: /usr/bin/deb-systemd-helper:      /usr/bin/env: bad interpreter: No such file or directory
dpkg: error processing package mysql-server-5.7 (--remove):
subprocess installed post-removal script returned error exit status 126
Errors were encountered while processing:
docker-ce
mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

Modifier après les correctifs mentionnés pour la suppression des packages:

J'ai pu supprimer ces 2 paquets mais même après cela, sur apt-get upgrade, je reçois ce message.

Sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libpango1.0-0 libpangox-1.0-0
Use 'Sudo apt autoremove' to remove them.
The following packages have been kept back:
gnome-software gnome-software-common ubuntu-software
The following packages will be upgraded:
accountsservice adium-theme-ubuntu adwaita-icon-theme apparmor appmenu-qt5
apport apport-gtk appstream apt apt-utils apturl apturl-common bamfdaemon
bash-completion command-not-found command-not-found-data compiz compiz-core
compiz-gnome compiz-plugins-default cups-browsed cups-filters
cups-filters-core-drivers deja-dup desktop-file-utils dh-python
distro-info-data dmidecode dpkg-dev firefox firefox-locale-en fonts-noto-cjk
Fuse fwupd gdb gdbserver gir1.2-appindicator3-0.1 gir1.2-dbusmenu-glib-0.4
gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0
gir1.2-packagekitglib-1.0 gir1.2-unity-5.0 glib-networking
glib-networking-common glib-networking-services gnome-calculator
gnome-calendar gnome-font-viewer gnome-menus gnome-session-bin
gnome-session-common gnome-settings-daemon-schemas gnome-sudoku
gnome-system-monitor grub-common grub-pc grub-pc-bin grub2-common
gstreamer1.0-alsa gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps
gstreamer1.0-plugins-good gstreamer1.0-pulseaudio gstreamer1.0-tools
gstreamer1.0-x gtk2-engines-murrine gvfs gvfs-backends gvfs-bin gvfs-common
gvfs-daemons gvfs-Fuse gvfs-libs humanity-icon-theme im-config
indicator-application indicator-bluetooth isc-dhcp-client isc-dhcp-common
krb5-locales language-pack-en language-pack-en-base language-pack-gnome-en
language-pack-gnome-en-base language-selector-common language-selector-gnome
less libaccountsservice0 libapparmor-Perl libappindicator3-1
libappstream-glib8 libappstream3 libbamf3-2 libboost-date-time1.58.0
libboost-filesystem1.58.0 libboost-iostreams1.58.0 libboost-system1.58.0
libc-bin libc-dev-bin libc6 libc6-dbg libc6-dev libcompizconfig0
libcupsfilters1 libdbusmenu-glib4 libdbusmenu-gtk3-4 libdbusmenu-gtk4
libdecoration0 libdfu1 libdpkg-Perl libexiv2-14 libfcitx-config4
libfcitx-gclient0 libfcitx-utils0 libfdisk1 libfontembed1 libframe6
libfreetype6 libfuse2 libfwupd1 libgail-3-0 libglib2.0-0 libglib2.0-bin
libglib2.0-data libgnome-menu-3-0 libgssapi-krb5-2
libgstreamer-plugins-base1.0-0 libgstreamer-plugins-good1.0-0
libgstreamer1.0-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libgweather-3-6
libgweather-common libido3-0.1-0 libk5crypto3 libkrb5-3 libkrb5support0
libldap-2.4-2 liblightdm-gobject-1-0 libmetacity-private3a
libnautilus-extension1a libnm-glib-vpn1 libnm-glib4 libnm-util2 libnm0
libnux-4.0-0 libnux-4.0-common libp11-kit0 libpackagekit-glib2-16
libplymouth4 libpoppler-glib8 libpoppler58 libpulse-mainloop-glib0 libpulse0
libpulsedsp libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5
libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5widgets5
libqt5xml5 libsmartcols1 libunity-control-center1 libunity-core-6.0-9
libunity-protocol-private0 libunity-scopes-json-def-desktop
libunity-settings-daemon1 libunity9 libupower-glib3 libwhoopsie0
libxatracker2 libxml2 light-themes lightdm locales lsb-release lshw
metacity-common mtools mtr-tiny multiarch-support mythes-en-us nano nautilus
nautilus-data network-manager nux-tools os-prober overlay-scrollbar
overlay-scrollbar-gtk2 p11-kit p11-kit-modules plymouth plymouth-label
plymouth-theme-ubuntu-logo plymouth-theme-ubuntu-text poppler-utils
printer-driver-brlaser pulseaudio pulseaudio-module-bluetooth
pulseaudio-module-x11 pulseaudio-utils python3-apport python3-brlapi
python3-commandnotfound python3-distupgrade python3-problem-report
python3-pyparsing python3-update-manager python3-urllib3 resolvconf
sbsigntool shared-mime-info sni-qt Sudo suru-icon-theme thermald
ubuntu-artwork ubuntu-docs ubuntu-drivers-common ubuntu-mobile-icons
ubuntu-mono ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk
ubuntu-session unattended-upgrades unity unity-control-center
unity-control-center-faces unity-lens-applications unity-schemas
unity-scopes-runner unity-services unity-settings-daemon update-manager
update-manager-core update-notifier update-notifier-common upower
uuid-runtime vino whoopsie xbrlapi xdg-utils xdiagnose xinit
xserver-xorg-video-amdgpu xserver-xorg-video-intel
255 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 60.0 MB/207 MB of archives.
After this operation, 10.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 libc6-dbg AMD64 2.23-0ubuntu6 [3,676 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 libc6-dev AMD64 2.23-0ubuntu6 [2,081 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 libc-dev-bin AMD64 2.23-0ubuntu6 [68.5 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 libc6 AMD64 2.23-0ubuntu6 [2,591 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 locales all 2.23-0ubuntu6 [3,200 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 libc-bin AMD64 2.23-0ubuntu6 [632 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 libfreetype6 AMD64 2.6.1-0.1ubuntu2.1 [316 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 multiarch-support AMD64 2.23-0ubuntu6 [6,826 B]
Get:9 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 firefox AMD64 52.0.1+build2-0ubuntu0.16.04.1 [46.8 MB]
Get:10 http://in.archive.ubuntu.com/ubuntu xenial-updates/main AMD64 firefox-locale-en AMD64 52.0.1+build2-0ubuntu0.16.04.1 [651 kB]
Fetched 60.0 MB in 1min 39s (603 kB/s)                                         
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 205305 files and directories currently installed.)
Preparing to unpack .../libc6-dbg_2.23-0ubuntu6_AMD64.deb ...
Unpacking libc6-dbg:AMD64 (2.23-0ubuntu6) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc6-dev_2.23-0ubuntu6_AMD64.deb ...
Unpacking libc6-dev:AMD64 (2.23-0ubuntu6) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc-dev-bin_2.23-0ubuntu6_AMD64.deb ...
Unpacking libc-dev-bin (2.23-0ubuntu6) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc6_2.23-0ubuntu6_AMD64.deb ...
Unpacking libc6:AMD64 (2.23-0ubuntu6) over (2.23-0ubuntu5) ...
Setting up libc6:AMD64 (2.23-0ubuntu6) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
(Reading database ... 205305 files and directories currently installed.)
Preparing to unpack .../locales_2.23-0ubuntu6_all.deb ...
Unpacking locales (2.23-0ubuntu6) over (2.23-0ubuntu5) ...
Preparing to unpack .../libc-bin_2.23-0ubuntu6_AMD64.deb ...
Unpacking libc-bin (2.23-0ubuntu6) over (2.23-0ubuntu5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libc-bin (2.23-0ubuntu6) ...
(Reading database ... 205305 files and directories currently installed.)
Preparing to unpack .../archives/apt_1.2.19_AMD64.deb ...
/var/lib/dpkg/info/apt.prerm: 11: /var/lib/dpkg/info/apt.prerm: deb-systemd-invoke: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 11: /var/lib/dpkg/tmp.ci/prerm: deb-systemd-invoke: not found
dpkg: error processing archive /var/cache/apt/archives/apt_1.2.19_AMD64.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apt.postinst: 84: /var/lib/dpkg/info/apt.postinst: deb-systemd-helper: not found
/var/lib/dpkg/info/apt.postinst: 87: /var/lib/dpkg/info/apt.postinst: deb-systemd-helper: not found
/var/lib/dpkg/info/apt.postinst: 94: /var/lib/dpkg/info/apt.postinst: deb-systemd-helper: not found
/var/lib/dpkg/info/apt.postinst: 100: /var/lib/dpkg/info/apt.postinst: deb-systemd-invoke: not found
Processing triggers for libc-bin (2.23-0ubuntu6) ...
Errors were encountered while processing:
/var/cache/apt/archives/apt_1.2.19_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Aidez-moi, je dois installer Apache et PHP sur cette machine.

1
Rajat Gupta

Votre système manque de /usr/bin/env, d'un utilitaire principal et/ou de quelques utilitaires systemd. Vous pouvez les restaurer si vous réinstallez leurs paquets d'origine:

Sudo apt-get install -f --reinstall coreutils init-system-helpers

Ensuite, procédez à la mise à niveau ou à l’installation des packages comme d’habitude.

À l'avenir, vous pourrez détecter les paquets corrompus avec l'inofficial sanity check de Ubuntu.

2
David Foerster