I just experienced this error during a normal update while using 21.10. The update failed and using apt install --fix-broken systemd-sysv or apt install --fix-broken systemd triggered the error as shown above.
I found that the binary systemd-machine-id-setup, which causes the error was installed two times on my system, in /usr/bin and in /bin. The version in /usr/bin included the dependency on libsystemd-shared-247.so, which is not available. The version in /bin has the correct dependency on libsystemd-shared-248.so. In my PATH /usr/bin is before /bin. After removing /usr/bin/systemd-machine-id-setup I was able to do apt install systemd systemd-sysv When doing this I got additional warnings concerning the binaries: /usr/bin/journalctl /usr/bin/systemd-tmpfiles related to libsystemd-shared-247.so. Again both are available in /usr/ as well and are correct there. So I removed them too. -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1952191 Title: package systemd 248.3-1ubuntu8 failed to install/upgrade: installed systemd package post-installation script subprocess returned error exit status 127 Status in systemd package in Ubuntu: Confirmed Bug description: Crash on do-release-upgrade 21.04->21.10 ProblemType: Package DistroRelease: Ubuntu 21.10 Package: systemd 248.3-1ubuntu8 ProcVersionSignature: Uname: Linux 5.13.19-1-pve x86_64 ApportVersion: 2.20.11-0ubuntu65.4 Architecture: amd64 CasperMD5CheckResult: unknown Date: Thu Nov 25 08:28:24 2021 DuplicateSignature: package:systemd:248.3-1ubuntu8 Installing new version of config file /etc/systemd/user.conf ... systemd-machine-id-setup: error while loading shared libraries: libsystemd-shared-247.so: cannot open shared object file: No such file or directory dpkg: error processing package systemd (--configure): installed systemd package post-installation script subprocess returned error exit status 127 ErrorMessage: installed systemd package post-installation script subprocess returned error exit status 127 MachineType: Micro-Star International Co., Ltd. MS-7B79 ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.13.19-1-pve root=/dev/mapper/pve-root ro quiet Python3Details: /usr/bin/python3.9, Python 3.9.7, python3-minimal, 3.9.4-1build1 PythonDetails: N/A RelatedPackageVersions: dpkg 1.20.9ubuntu2 apt 2.3.9 SourcePackage: systemd Title: package systemd 248.3-1ubuntu8 failed to install/upgrade: installed systemd package post-installation script subprocess returned error exit status 127 UpgradeStatus: Upgraded to impish on 2021-11-25 (0 days ago) dmi.bios.date: 12/01/2020 dmi.bios.release: 5.17 dmi.bios.vendor: American Megatrends Inc. dmi.bios.version: H.90 dmi.board.asset.tag: To be filled by O.E.M. dmi.board.name: X470 GAMING PLUS MAX (MS-7B79) dmi.board.vendor: Micro-Star International Co., Ltd. dmi.board.version: 3.0 dmi.chassis.asset.tag: To be filled by O.E.M. dmi.chassis.type: 3 dmi.chassis.vendor: Micro-Star International Co., Ltd. dmi.chassis.version: 3.0 dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrH.90:bd12/01/2020:br5.17:svnMicro-StarInternationalCo.,Ltd.:pnMS-7B79:pvr3.0:rvnMicro-StarInternationalCo.,Ltd.:rnX470GAMINGPLUSMAX(MS-7B79):rvr3.0:cvnMicro-StarInternationalCo.,Ltd.:ct3:cvr3.0:skuTobefilledbyO.E.M.: dmi.product.family: To be filled by O.E.M. dmi.product.name: MS-7B79 dmi.product.sku: To be filled by O.E.M. dmi.product.version: 3.0 dmi.sys.vendor: Micro-Star International Co., Ltd. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1952191/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp