[root@rocky8]/etc/yum.repos.d#yum install expect.x86_64
Last metadata expiration check: 0:00:56 ago on Sat 08 Jul 2023 05:08:44 PM CST.
Dependencies resolved.
====================================================================================================================
Package Architecture Version Repository
====================================================================================================================
Installing:
expect x86_64 5.45.4-5.el8 BaseOS
Installing dependencies:
tcl x86_64 1:8.6.8-2.el8 BaseOS
Transaction Summary
====================================================================================================================
Install 2 Packages
Total download size: 1.4 M
Installed size: 4.9 M
Is this ok [y/N]: y
Downloading Packages:
Error opening /misc/cd/BaseOS/Packages/e/expect-5.45.4-5.el8.x86_64.rpm: No such file or directory
Package "expect-5.45.4-5.el8.x86_64" from local repository "BaseOS" has incorrect checksum
Error opening /misc/cd/BaseOS/Packages/t/tcl-8.6.8-2.el8.x86_64.rpm: No such file or directory
Package "tcl-1:8.6.8-2.el8.x86_64" from local repository "BaseOS" has incorrect checksum
Error: Some packages from local repository have incorrect checksum
分析原因:是因为baseurl=file:///misc/cd/BaseOS这项配置的文件路径没有找到,“misc/cd”这个文件夹没有。
检查/etc/yum.repos.d/BaseOS的配置(这里时故障前的配置)
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/BaseOS
https://mirrors.aliyun.com/rockylinux/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
https://mirrors.aliyun.com/rockylinux/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[extras]
name=extras
baseurl=https://mirror.nju.edu.cn/rocky/$releasever/extras/$basearch/os/
gpgcheck=0
[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch
https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/$basearch
https://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basharch
https://mirrors.huaweicloud.com/epel/$releasever/$basearch
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-$releasever
但是我想因为我BaseOS配置了2条寻址路径啊。不应该一条失效后就无法找到目标文件的,尝试修改文件。
以下是修改后的文件
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/BaseOS
baseurl= https://mirrors.aliyun.com/rockylinux/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
baseurl=https://mirrors.aliyun.com/rockylinux/$releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial
[extras]
name=extras
baseurl=https://mirrors.aliyun.com/rockylinux/$releasever/extras/$basearch/os/
gpgcheck=1
[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/$basearch
baseurl=https://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basearch
新增加箭头位置的信息“baseurl”
测试下,发现修改后的一条url失效后另一条还可以正常访问,不影响解决yum下载告警的问题。
以上是repo文本格式配置错误导致备用的url不生效的问题。
以上问题解决后可以正常使用了。
接下来需要解决“ /misc/cd/BaseOS/Packages/e/expect-5.45.4-5.el8.x86_64.rpm: No such file or directory”这个问题。
首先我们要知道 /misc/cd/这个文件夹是由autofs这个工具自动创建的。
所以需要先安装autofs
yum -y install autofs
然后启动这个autofs服务
systemctl restart autofs.service
这时候你可以看下“/misc/cd/”下面是否可以查看到光盘信息
[root@rocky8]/root#cd /misc/cd
[root@rocky8]/misc/cd#ll
total 14
dr-xr-xr-x 4 root root 2048 May 18 07:36 BaseOS
dr-xr-xr-x 3 root root 2048 May 18 07:36 EFI
dr-xr-xr-x 3 root root 2048 May 18 07:36 images
dr-xr-xr-x 2 root root 2048 May 18 07:36 isolinux
-r--r--r-- 1 root root 2204 Apr 26 02:52 LICENSE
-r--r--r-- 1 root root 88 May 18 07:35 media.repo
dr-xr-xr-x 3 root root 2048 May 18 07:36 Minimal
-r--r--r-- 1 root root 883 May 18 07:36 TRANS.TBL
接下来检查磁盘信息
lsblk[root@rocky8]/misc/cd#lsblk
查看是否存在“Sr0”和磁盘大小是否是光盘的大小,如果数据小于1G,就需要 检查虚拟机的配置
如果依然没有查看到光盘的数据,可以检查虚拟机的配置项,如下图