kubuntu 22.04 (.iso 下载自 kubuntu.com) 坏了?也可以 apt 升级吗?

kubuntu 22.04 (.iso 下载自 kubuntu.com) 坏了?也可以 apt 升级吗?

在刚刚安装了几个月前版本的 Kubuntu 22.04 LTS 的系统上,“sudo su -”之后的“apt upgrade”对我来说不起作用:

~# cd /var/www
-bash: cd: /var/www: No such file or directory
~# apt install apache2 git
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 apache2 : Depends: apache2-bin (= 2.4.52-1ubuntu4.2) but it is not going to be installed
           Depends: apache2-data (= 2.4.52-1ubuntu4.2) but it is not going to be installed
           Depends: apache2-utils (= 2.4.52-1ubuntu4.2)
 libnss-systemd : Depends: systemd (= 249.11-0ubuntu3.6)
 libpam-systemd : Depends: systemd (= 249.11-0ubuntu3.6)
 systemd : Depends: libsystemd0 (= 249.11-0ubuntu3.4) but 249.11-0ubuntu3.6 is to be installed
 systemd-sysv : Depends: systemd (= 249.11-0ubuntu3.6)
 systemd-timesyncd : Depends: systemd (= 249.11-0ubuntu3.6)
 udev : Breaks: systemd (< 249.11-0ubuntu3.6)
        Breaks: systemd:i386 (< 249.11-0ubuntu3.6)
        Recommends: systemd-hwe-hwdb but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
~# apt update
Hit:1 http://nl.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://nl.archive.ubuntu.com/ubuntu jammy-updates InRelease                                                                    
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease                                                                     
Hit:4 http://nl.archive.ubuntu.com/ubuntu jammy-backports InRelease             
Hit:5 https://dl.google.com/linux/chrome/deb stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
291 packages can be upgraded. Run 'apt list --upgradable' to see them.
~# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libnss-systemd : Depends: systemd (= 249.11-0ubuntu3.6)
 libpam-systemd : Depends: systemd (= 249.11-0ubuntu3.6)
 systemd : Depends: libsystemd0 (= 249.11-0ubuntu3.4) but 249.11-0ubuntu3.6 is installed
 systemd-sysv : Depends: systemd (= 249.11-0ubuntu3.6)
 systemd-timesyncd : Depends: systemd (= 249.11-0ubuntu3.6)
 udev : Breaks: systemd (< 249.11-0ubuntu3.6)
        Breaks: systemd:i386 (< 249.11-0ubuntu3.6)
        Recommends: systemd-hwe-hwdb but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
~# apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  systemd
Suggested packages:
  systemd-container libtss2-rc0
The following packages will be upgraded:
  systemd
1 upgraded, 0 newly installed, 0 to remove and 290 not upgraded.
15 not fully installed or removed.
Need to get 0 B/4.580 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 168775 files and directories currently installed.)
Preparing to unpack .../systemd_249.11-0ubuntu3.6_amd64.deb ...
Unpacking systemd (249.11-0ubuntu3.6) over (249.11-0ubuntu3.4) ...
dpkg-deb (subprocess): ZSTD_decompressStream error : Corrupted block detected 

dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb (--unpack):
 cannot copy extracted data for './lib/systemd/libsystemd-shared-249.so' to '/lib/systemd/libsystemd-shared-249.so.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
 /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
~# 


答案1

缺失的环节是做

rm -rf /var/cache/apt/*
apt --fix-broken install
apt update
apt upgrade

在通过 git 安装基本服务器操作系统应用程序和你自己的应用程序之前

apt install certbot apache2 git

或者对于公开可见的网络服务器:

apt install certbot nginx apache2 git

其次是:

cd /var/www
mkdir MYDOMAIN.TLD && chown MY_LINUX_USERNAME:www-data MYDOMAIN.TLD && chmod 664 MYDOMAIN.TLD
git clone https://github.com/MY_COMPANY_NAME/MY_REPOSITORY_NAME MYDOMAIN.TLD

(我把我的列在https://github.com/NicerEnterprises/NicerApp-WebOS

最后,这是完整的安装日志,证明了我的观点。在 Linux 开发时间线的这个点上,来自 DPKG 的彩色警告会非常酷,好吗?:)

~# apt update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:2 http://nl.archive.ubuntu.com/ubuntu jammy InRelease                                       
Hit:3 https://dl.google.com/linux/chrome/deb stable InRelease                                   
Hit:4 http://nl.archive.ubuntu.com/ubuntu jammy-updates InRelease                   
Hit:5 http://nl.archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
291 packages can be upgraded. Run 'apt list --upgradable' to see them.
~# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libnss-systemd : Depends: systemd (= 249.11-0ubuntu3.6)
 libpam-systemd : Depends: systemd (= 249.11-0ubuntu3.6)
 systemd : Depends: libsystemd0 (= 249.11-0ubuntu3.4) but 249.11-0ubuntu3.6 is installed
 systemd-sysv : Depends: systemd (= 249.11-0ubuntu3.6)
 systemd-timesyncd : Depends: systemd (= 249.11-0ubuntu3.6)
 udev : Breaks: systemd (< 249.11-0ubuntu3.6)
        Breaks: systemd:i386 (< 249.11-0ubuntu3.6)
        Recommends: systemd-hwe-hwdb but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
with the other options
~# apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  systemd
Suggested packages:
  systemd-container libtss2-rc0
The following packages will be upgraded:
  systemd
1 upgraded, 0 newly installed, 0 to remove and 290 not upgraded.
15 not fully installed or removed.
Need to get 0 B/4.580 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 168775 files and directories currently installed.)
Preparing to unpack .../systemd_249.11-0ubuntu3.6_amd64.deb ...
Unpacking systemd (249.11-0ubuntu3.6) over (249.11-0ubuntu3.4) ...
dpkg-deb (subprocess): ZSTD_decompressStream error : Corrupted block detected 

dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb (--unpack):
 cannot copy extracted data for './lib/systemd/libsystemd-shared-249.so' to '/lib/systemd/libsystemd-shared-249.so.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
 /var/cache/apt/archives/systemd_249.11-0ubuntu3.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
~# rm /var/cache/apt/*
rm: cannot remove '/var/cache/apt/archives': Is a directory
~# rm -rf /var/cache/apt/*
~# apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  systemd
Suggested packages:
  systemd-container libtss2-rc0
The following packages will be upgraded:
  systemd
1 upgraded, 0 newly installed, 0 to remove and 290 not upgraded.
15 not fully installed or removed.
Need to get 4.580 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://nl.archive.ubuntu.com/ubuntu jammy-updates/main amd64 systemd amd64 249.11-0ubuntu3.6 [4.580 kB]
Fetched 4.580 kB in 0s (15,2 MB/s)
(Reading database ... 168775 files and directories currently installed.)
Preparing to unpack .../systemd_249.11-0ubuntu3.6_amd64.deb ...
Unpacking systemd (249.11-0ubuntu3.6) over (249.11-0ubuntu3.4) ...
Setting up systemd (249.11-0ubuntu3.6) ...
Setting up systemd-sysv (249.11-0ubuntu3.6) ...
Setting up libnss-systemd:amd64 (249.11-0ubuntu3.6) ...
Setting up libobjc4:amd64 (12.1.0-2ubuntu1~22.04) ...
Setting up libgomp1:amd64 (12.1.0-2ubuntu1~22.04) ...
Setting up perl-modules-5.34 (5.34.0-3ubuntu1.1) ...
Setting up libquadmath0:amd64 (12.1.0-2ubuntu1~22.04) ...
Setting up systemd-timesyncd (249.11-0ubuntu3.6) ...
Setting up udev (249.11-0ubuntu3.6) ...
Setting up libgfortran5:amd64 (12.1.0-2ubuntu1~22.04) ...
Setting up libpam-systemd:amd64 (249.11-0ubuntu3.6) ...
Setting up xserver-common (2:21.1.3-2ubuntu2.5) ...
Setting up xserver-xorg-legacy (2:21.1.3-2ubuntu2.5) ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
Setting up libperl5.34:amd64 (5.34.0-3ubuntu1.1) ...
Setting up xserver-xorg-core (2:21.1.3-2ubuntu2.5) ...
Setting up perl (5.34.0-3ubuntu1.1) ...
Processing triggers for install-info (6.8-4build1) ...
Processing triggers for initramfs-tools (0.140ubuntu13) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-43-generic
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for dbus (1.12.20-2ubuntu4) ...
~# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  libflashrom1 libftdi1-2
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  linux-headers-5.15.0-58 linux-headers-5.15.0-58-generic linux-image-5.15.0-58-generic linux-modules-5.15.0-58-generic
  linux-modules-extra-5.15.0-58-generic plasma-distro-release-notifier python3-debconf update-notifier-common
The following packages have been kept back:
  grub-common grub-pc grub-pc-bin grub2-common linux-modules-nvidia-515-generic nvidia-kernel-common-515
The following packages will be upgraded:
  alsa-ucm-conf apport apport-kde apt apt-utils bind9-dnsutils bind9-host bind9-libs binutils binutils-common
  binutils-x86-64-linux-gnu bluedevil breeze breeze-cursor-theme ca-certificates cpp-11 cryptsetup cryptsetup-bin
  cryptsetup-initramfs dbus dbus-user-session dbus-x11 distro-info-data dmidecode drkonqi firmware-sof-signed fonts-opensymbol
  freerdp2-x11 fwupd gcc-11-base gdb ghostscript ghostscript-x gir1.2-gdkpixbuf-2.0 git git-man grub-efi-amd64-bin
  grub-efi-amd64-signed initramfs-tools initramfs-tools-bin initramfs-tools-core intel-microcode isc-dhcp-client isc-dhcp-common
  kde-config-sddm kde-config-updates kde-style-breeze kde-style-oxygen-qt5 kdeplasma-addons-data kinfocenter kscreen ksystemstats
  kubuntu-desktop kubuntu-wallpapers kwin-addons kwin-common kwin-data kwin-style-breeze kwin-x11 layer-shell-qt libapt-pkg6.0
  libbinutils libbpf0 libcolorcorrect5 libcryptsetup12 libctf-nobfd0 libctf0 libcurl3-gnutls libcurl4 libdbus-1-3 libegl-mesa0
  libexpat1 libflac8 libfreerdp-client2-2 libfreerdp2-2 libfwupd2 libfwupdplugin5 libgbm1 libgdk-pixbuf-2.0-0 libgdk-pixbuf2.0-bin
  libgdk-pixbuf2.0-common libgl1-mesa-dri libglapi-mesa libglib2.0-0 libglib2.0-bin libglib2.0-data libglx-mesa0 libgs9
  libgs9-common libjbig0 libkf5newstuff-data libkf5newstuff5 libkf5newstuffcore5 libkf5su-bin libkf5su-data libkf5su5
  libkf5sysguard-data libkfontinst5 libkfontinstui5 libksba8 libksgrd9 libksysguardformatter1 libksysguardsensorfaces1
  libksysguardsensors1 libksysguardsystemstats1 libkwaylandserver5 libkwineffects13 libkwinglutils13 libkwinxrenderutils13
  libkworkspace5-5 liblayershellqtinterface5 libldap-2.5-0 libldap-common libllvm13 libnetplan0 libnftables1 libnotificationmanager1
  libntfs-3g89 liboxygenstyle5-5 liboxygenstyleconfig5-5 libpcre2-16-0 libpcre2-8-0 libpipewire-0.3-0 libpipewire-0.3-common
  libpipewire-0.3-modules libpixman-1-0 libplasma-geolocation-interface5 libpoppler-cpp0v5 libpoppler-glib8 libpoppler-qt5-1
  libpoppler118 libpowerdevilcore2 libpowerdevilui5 libprocesscore9 libprocessui9 libpulse-mainloop-glib0 libpulse0 libpulsedsp
  libpython3-stdlib libpython3.10 libpython3.10-minimal libpython3.10-stdlib libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5gui5
  libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5widgets5 libqt5xml5
  libreoffice-base-core libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-impress libreoffice-kf5
  libreoffice-math libreoffice-plasma libreoffice-qt5 libreoffice-style-breeze libreoffice-style-colibre libreoffice-writer
  libsasl2-2 libsasl2-modules libsasl2-modules-db libsmbclient libsnmp-base libsnmp40 libspa-0.2-modules libspeechd2 libsqlite3-0
  libssl3 libtaskmanager6 libtiff5 libuno-cppu3 libuno-cppuhelpergcc3-3 libuno-purpenvhelpergcc3-3 libuno-sal3
  libuno-salhelpergcc3-3 libwayland-client0 libwayland-cursor0 libwayland-egl1 libwayland-server0 libwbclient0 libweather-ion7
  libwinpr2-2 libxatracker2 libxml2 libxml2-utils libxpm4 libxslt1.1 linux-firmware linux-generic linux-headers-generic
  linux-image-generic mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers milou netplan.io nftables ntfs-3g openssh-client
  openssl oxygen-sounds passwd pipewire pipewire-bin plasma-calendar-addons plasma-dataengines-addons plasma-desktop
  plasma-desktop-data plasma-discover plasma-discover-backend-fwupd plasma-discover-backend-snap plasma-discover-common plasma-nm
  plasma-pa plasma-runners-addons plasma-thunderbolt plasma-wallpapers-addons plasma-widgets-addons plasma-workspace
  plasma-workspace-data poppler-utils powerdevil powerdevil-data pulseaudio pulseaudio-module-bluetooth pulseaudio-module-gsettings
  pulseaudio-utils python-apt-common python3 python3-apport python3-apt python3-distupgrade python3-gdbm python3-jwt python3-minimal
  python3-oauthlib python3-pil python3-problem-report python3-samba python3-software-properties python3-uno python3-update-manager
  python3.10 python3.10-minimal qml-module-org-kde-ksysguard qml-module-org-kde-newstuff qt5-gtk-platformtheme rsync samba-common
  samba-common-bin samba-dsdb-modules samba-libs sddm-theme-breeze smbclient snapd software-properties-common software-properties-qt
  sudo systemsettings thermald thunderbird tzdata ubuntu-advantage-tools ubuntu-release-upgrader-core ubuntu-release-upgrader-qt
  uno-libs-private unzip update-manager-core ure vim-common vim-tiny xdg-desktop-portal-kde xdg-utils xserver-xorg-video-amdgpu xxd
284 upgraded, 8 newly installed, 0 to remove and 6 not upgraded.
83 standard security updates
Need to get 745 MB of archives.
After this operation, 619 MB of additional disk space will be used.
Do you want to continue? [Y/n] ^C
~# 

相关内容