环境:centos7.0
#systemctl status network
Unit network.service could not be found.
解决:#yum install systemd
过程:
服务器重启发现网络服务没了,查看之前的操作,因为yum install lvm2报错
[root@vm~]# yum install lvm2
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package lvm2.x86_64 7:2.02.186-7.el7_8.1 will be installed
--> Processing Dependency: lvm2-libs = 7:2.02.186-7.el7_8.1 for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: device-mapper-persistent-data >= 0.7.0-0.1.rc6 for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: liblvm2app.so.2.2(Base)(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02(Base)(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: liblvm2app.so.2.2()(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: libdevmapper-event.so.1.02()(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: 7:lvm2-2.02.186-7.el7_8.1.x86_64
--> Running transaction check
---> Package device-mapper-event-libs.x86_64 7:1.02.164-7.el7_8.1 will be installed
---> Package device-mapper-persistent-data.x86_64 0:0.8.5-2.el7 will be installed
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package lvm2-libs.x86_64 7:2.02.186-7.el7_8.1 will be installed
--> Processing Dependency: device-mapper-event = 7:1.02.164-7.el7_8.1 for package: 7:lvm2-libs-2.02.186-7.el7_8.1.x86_64
--> Running transaction check
---> Package device-mapper-event.x86_64 7:1.02.164-7.el7_8.1 will be installed
--> Processing Dependency: device-mapper = 7:1.02.164-7.el7_8.1 for package: 7:device-mapper-event-1.02.164-7.el7_8.1.x86_64
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.84-14.el7 will be updated
--> Processing Dependency: device-mapper = 7:1.02.84-14.el7 for package: 7:device-mapper-libs-1.02.84-14.el7.x86_64
---> Package device-mapper.x86_64 7:1.02.158-2.el7_7.2 will be updated
--> Processing Dependency: device-mapper = 7:1.02.158-2.el7_7.2 for package: 7:device-mapper-libs-1.02.158-2.el7_7.2.x86_64
---> Package device-mapper.x86_64 7:1.02.164-7.el7_8.1 will be an update
--> Running transaction check
---> Package device-mapper.x86_64 7:1.02.84-14.el7 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.84-14.el7 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.158-2.el7_7.2 will be updated
---> Package device-mapper-libs.x86_64 7:1.02.164-7.el7_8.1 will be an update
--> Finished Dependency Resolution
Error: Package: 7:device-mapper-libs-1.02.84-14.el7.x86_64 (@anaconda)
Requires: device-mapper = 7:1.02.84-14.el7
Removing: 7:device-mapper-1.02.84-14.el7.x86_64 (@anaconda)
device-mapper = 7:1.02.84-14.el7
Updated By: 7:device-mapper-1.02.164-7.el7_8.1.x86_64 (updates)
device-mapper = 7:1.02.164-7.el7_8.1
Removing: 7:device-mapper-1.02.158-2.el7_7.2.x86_64 (installed)
device-mapper = 7:1.02.158-2.el7_7.2
Updated By: 7:device-mapper-1.02.164-7.el7_8.1.x86_64 (updates)
device-mapper = 7:1.02.164-7.el7_8.1
Available: 7:device-mapper-1.02.164-7.el7.x86_64 (base)
device-mapper = 7:1.02.164-7.el7
You could try using --skip-broken to work around the problem
** Found 20 pre-existing rpmdb problem(s), 'yum check' output follows:
audit-libs-2.8.5-4.el7.x86_64 is a duplicate with audit-libs-2.3.3-4.el7.x86_64
centos-release-7-7.1908.0.el7.centos.x86_64 is a duplicate with centos-release-7-0.1406.el7.centos.2.3.x86_64
cryptsetup-libs-2.0.3-5.el7.x86_64 is a duplicate with cryptsetup-libs-1.6.3-2.el7.x86_64
7:device-mapper-1.02.158-2.el7_7.2.x86_64 is a duplicate with 7:device-mapper-1.02.84-14.el7.x86_64
7:device-mapper-libs-1.02.158-2.el7_7.2.x86_64 is a duplicate with 7:device-mapper-libs-1.02.84-14.el7.x86_64
dracut-033-564.el7.x86_64 is a duplicate with dracut-033-161.el7.x86_64
glib2-2.56.1-5.el7.x86_64 is a duplicate with glib2-2.36.3-5.el7.x86_64
kmod-20-25.el7.x86_64 is a duplicate with kmod-14-9.el7.x86_64
libselinux-2.5-14.1.el7.x86_64 has installed conflicts selinux-policy-base < ('0', '3.13.1', '66'): selinux-policy-targeted-3.12.1-153.el7.noarch
libselinux-2.5-14.1.el7.x86_64 has installed conflicts systemd < ('0', '219', '20'): systemd-208-11.el7.x86_64
libselinux-2.5-14.1.el7.x86_64 is a duplicate with libselinux-2.2.2-6.el7.x86_64
libselinux-python-2.5-14.1.el7.x86_64 is a duplicate with libselinux-python-2.2.2-6.el7.x86_64
libsemanage-2.5-14.el7.x86_64 has installed conflicts selinux-policy-base < ('0', '3.13.1', '66'): selinux-policy-targeted-3.12.1-153.el7.noarch
libsemanage-2.5-14.el7.x86_64 is a duplicate with libsemanage-2.1.10-16.el7.x86_64
libsepol-2.5-10.el7.x86_64 is a duplicate with libsepol-2.1.9-3.el7.x86_64
systemd-219-67.el7_7.2.x86_64 has installed conflicts dracut < ('0', '033', '243'): dracut-033-161.el7.x86_64
systemd-219-67.el7_7.2.x86_64 has installed conflicts initscripts < ('0', '9.49.28', '1'): initscripts-9.49.17-1.el7.x86_64
systemd-219-67.el7_7.2.x86_64 is a duplicate with systemd-208-11.el7.x86_64
systemd-libs-219-67.el7_7.2.x86_64 is a duplicate with systemd-libs-208-11.el7.x86_64
systemd-sysv-219-67.el7_7.2.x86_64 is a duplicate with systemd-sysv-208-11.el7.x86_64
-----------------------------------------------------------------------------------------------------------------------------------------
查看有问题的包
[root@vm ~]# rpm -qa |grep device-mapper
device-mapper-libs-1.02.158-2.el7_7.2.x86_64
device-mapper-1.02.84-14.el7.x86_64
device-mapper-1.02.158-2.el7_7.2.x86_64
device-mapper-libs-1.02.84-14.el7.x86_64
-------------------------------------------------------------------------------------------------------------------------------------------
删掉问题包的时候,也一起移除了 systemd 这个包
[root@vm ~]# yum remove device-mapper-libs-1.02.158-2.el7_7.2.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package device-mapper-libs.x86_64 7:1.02.158-2.el7_7.2 will be erased
..................
=============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Removing:
device-mapper-libs x86_64 7:1.02.158-2.el7_7.2 installed 391 k
Removing for dependencies:
cryptsetup-libs x86_64 2.0.3-5.el7 installed 1.2 M
device-mapper x86_64 7:1.02.158-2.el7_7.2 installed 332 k
dracut x86_64 033-564.el7 installed 884 k
systemd x86_64 219-67.el7_7.2 installed 23 M
systemd-sysv x86_64 219-67.el7_7.2 installed 3.9 k
Transaction Summary
=============================================================================================================================================
Remove 1 Package (+5 Dependent packages)
Installed size: 26 M
Is this ok [y/N]: y
----------------------------------------------------------------------------------------------------------------
[root@vm ~]# yum install lvm2
....................................................
发现Unit network.service could not be found问题,手工做本地yum源,重新yum install systemd。
[root@systemd]# yum install systemd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package systemd.x86_64 0:208-11.el7 will be updated
--> Processing Dependency: systemd = 208-11.el7 for package: libgudev1-208-11.el7.x86_64
--> Processing Dependency: systemd = 208-11.el7 for package: systemd-sysv-208-11.el7.x86_64
---> Package systemd.x86_64 0:219-73.el7_8.5 will be an update
--> Processing Dependency: systemd-libs = 219-73.el7_8.5 for package: systemd-219-73.el7_8.5.x86_64
--> Processing Dependency: libcryptsetup.so.12(CRYPTSETUP_2.0)(64bit) for package: systemd-219-73.el7_8.5.x86_64
--> Processing Dependency: libcryptsetup.so.12()(64bit) for package: systemd-219-73.el7_8.5.x86_64
--> Running transaction check
---> Package cryptsetup-libs.x86_64 0:1.6.3-2.el7 will be updated
---> Package cryptsetup-libs.x86_64 0:2.0.3-6.el7 will be an update
---> Package libgudev1.x86_64 0:208-11.el7 will be updated
---> Package libgudev1.x86_64 0:219-73.el7_8.5 will be an update
---> Package systemd-libs.x86_64 0:208-11.el7 will be updated
---> Package systemd-libs.x86_64 0:219-67.el7_7.2 will be updated
---> Package systemd-libs.x86_64 0:219-73.el7_8.5 will be an update
---> Package systemd-sysv.x86_64 0:208-11.el7 will be updated
---> Package systemd-sysv.x86_64 0:219-73.el7_8.5 will be an update
--> Processing Conflict: systemd-219-73.el7_8.5.x86_64 conflicts initscripts < 9.49.28-1
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package initscripts.x86_64 0:9.49.17-1.el7 will be updated
---> Package initscripts.x86_64 0:9.49.49-1.el7 will be an update
--> Processing Conflict: initscripts-9.49.49-1.el7.x86_64 conflicts redhat-release < 7.5-0.11
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package centos-release.x86_64 0:7-0.1406.el7.centos.2.3 will be updated
---> Package centos-release.x86_64 0:7-7.1908.0.el7.centos will be updated
---> Package centos-release.x86_64 0:7-8.2003.0.el7.centos will be an update
--> Processing Conflict: systemd-219-73.el7_8.5.x86_64 conflicts dracut < 033-243
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package dracut.x86_64 0:033-161.el7 will be updated
--> Processing Dependency: dracut = 033-161.el7 for package: dracut-config-rescue-033-161.el7.x86_64
--> Processing Dependency: dracut = 033-161.el7 for package: dracut-network-033-161.el7.x86_64
---> Package dracut.x86_64 0:033-568.el7 will be an update
--> Running transaction check
---> Package dracut-config-rescue.x86_64 0:033-161.el7 will be updated
---> Package dracut-config-rescue.x86_64 0:033-568.el7 will be an update
---> Package dracut-network.x86_64 0:033-161.el7 will be updated
---> Package dracut-network.x86_64 0:033-568.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Updating:
centos-release x86_64 7-8.2003.0.el7.centos base 26 k
dracut x86_64 033-568.el7 base 329 k
initscripts x86_64 9.49.49-1.el7 base 440 k
systemd x86_64 219-73.el7_8.5 updates 5.1 M
Updating for dependencies:
cryptsetup-libs x86_64 2.0.3-6.el7 base 339 k
dracut-config-rescue x86_64 033-568.el7 base 60 k
dracut-network x86_64 033-568.el7 base 103 k
libgudev1 x86_64 219-73.el7_8.5 updates 106 k
systemd-libs x86_64 219-73.el7_8.5 updates 416 k
systemd-sysv x86_64 219-73.el7_8.5 updates 93 k
Transaction Summary
=============================================================================================================================================
Upgrade 4 Packages (+6 Dependent packages)
Total download size: 6.9 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/10): centos-release-7-8.2003.0.el7.centos.x86_64.rpm | 26 kB 00:00:00
(2/10): cryptsetup-libs-2.0.3-6.el7.x86_64.rpm | 339 kB 00:00:00
(3/10): dracut-033-568.el7.x86_64.rpm | 329 kB 00:00:00
(4/10): dracut-config-rescue-033-568.el7.x86_64.rpm | 60 kB 00:00:00
(5/10): dracut-network-033-568.el7.x86_64.rpm | 103 kB 00:00:00
(6/10): initscripts-9.49.49-1.el7.x86_64.rpm | 440 kB 00:00:00
(7/10): libgudev1-219-73.el7_8.5.x86_64.rpm | 106 kB 00:00:00
(8/10): systemd-libs-219-73.el7_8.5.x86_64.rpm | 416 kB 00:00:00
(9/10): systemd-sysv-219-73.el7_8.5.x86_64.rpm | 93 kB 00:00:00
(10/10): systemd-219-73.el7_8.5.x86_64.rpm | 5.1 MB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------
Total 23 MB/s | 6.9 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : systemd-libs-219-73.el7_8.5.x86_64 1/22
Updating : centos-release-7-8.2003.0.el7.centos.x86_64 2/22
Updating : cryptsetup-libs-2.0.3-6.el7.x86_64 3/22
Updating : systemd-219-73.el7_8.5.x86_64 4/22
Updating : dracut-033-568.el7.x86_64 5/22
Updating : dracut-config-rescue-033-568.el7.x86_64 6/22
Updating : dracut-network-033-568.el7.x86_64 7/22
Updating : initscripts-9.49.49-1.el7.x86_64 8/22
Updating : systemd-sysv-219-73.el7_8.5.x86_64 9/22
Updating : libgudev1-219-73.el7_8.5.x86_64 10/22
UPGRADE: Automatically re-enabling default systemd units:
brandbot.path
rhel-autorelabel.service
rhel-autorelabel-mark.service
rhel-configure.service
rhel-dmesg.service
rhel-domainname.service
rhel-import-state.service
rhel-loadmodules.service
rhel-readonly.service
Cleanup : initscripts-9.49.17-1.el7.x86_64 11/22
Cleanup : libgudev1-208-11.el7.x86_64 12/22
Cleanup : systemd-sysv-208-11.el7.x86_64 13/22
Cleanup : dracut-network-033-161.el7.x86_64 14/22
Cleanup : dracut-config-rescue-033-161.el7.x86_64 15/22
Cleanup : centos-release.x86_64 16/22
Cleanup : dracut-033-161.el7.x86_64 17/22
Cleanup : systemd-208-11.el7.x86_64 18/22
Cleanup : centos-release.x86_64 19/22
Cleanup : cryptsetup-libs-1.6.3-2.el7.x86_64 20/22
Cleanup : systemd-libs.x86_64 21/22
Cleanup : systemd-libs.x86_64 22/22
Verifying : libgudev1-219-73.el7_8.5.x86_64 1/22
Verifying : dracut-config-rescue-033-568.el7.x86_64 2/22
Verifying : centos-release-7-8.2003.0.el7.centos.x86_64 3/22
Verifying : cryptsetup-libs-2.0.3-6.el7.x86_64 4/22
Verifying : initscripts-9.49.49-1.el7.x86_64 5/22
Verifying : dracut-033-568.el7.x86_64 6/22
Verifying : dracut-network-033-568.el7.x86_64 7/22
Verifying : systemd-sysv-219-73.el7_8.5.x86_64 8/22
Verifying : systemd-libs-219-73.el7_8.5.x86_64 9/22
Verifying : systemd-219-73.el7_8.5.x86_64 10/22
Verifying : systemd-libs-219-67.el7_7.2.x86_64 11/22
Verifying : centos-release-7-7.1908.0.el7.centos.x86_64 12/22
Verifying : dracut-config-rescue-033-161.el7.x86_64 13/22
Verifying : systemd-sysv-208-11.el7.x86_64 14/22
Verifying : dracut-033-161.el7.x86_64 15/22
Verifying : initscripts-9.49.17-1.el7.x86_64 16/22
Verifying : systemd-libs-208-11.el7.x86_64 17/22
Verifying : systemd-208-11.el7.x86_64 18/22
Verifying : dracut-network-033-161.el7.x86_64 19/22
Verifying : libgudev1-208-11.el7.x86_64 20/22
Verifying : centos-release-7-0.1406.el7.centos.2.3.x86_64 21/22
Verifying : cryptsetup-libs-1.6.3-2.el7.x86_64 22/22
Updated:
centos-release.x86_64 0:7-8.2003.0.el7.centos dracut.x86_64 0:033-568.el7 initscripts.x86_64 0:9.49.49-1.el7
systemd.x86_64 0:219-73.el7_8.5
Dependency Updated:
cryptsetup-libs.x86_64 0:2.0.3-6.el7 dracut-config-rescue.x86_64 0:033-568.el7 dracut-network.x86_64 0:033-568.el7
libgudev1.x86_64 0:219-73.el7_8.5 systemd-libs.x86_64 0:219-73.el7_8.5 systemd-sysv.x86_64 0:219-73.el7_8.5
Complete!
[root@systemd]# systemctl status network
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)