解决 yum源出现的常见问题、scp传输软件包报错 、无法连接虚拟机、u盘只读

1.虚拟机无法下载软件 该怎么办?

1)检查真机yum源是否完好
#1.先执行 df 查看挂载是否正确
#2.如果repolist数量为0该怎么办? 
[root@computer kiosk]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: openstack source7.3
Cleaning up everything
[root@computer kiosk]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                               repo name                            status
!openstack                            
!source7.3                            source7.3                              0
repolist: 0
解决方案:
[root@computer kiosk]# systemctl remove httpd -y
[root@computer kiosk]# systemctl intall httpd -y
[root@computer kiosk]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: openstack source7.3
Cleaning up everything
[root@computer kiosk]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
source7.3                                                  | 4.1 kB     00:00     
(1/2): source7.3/group_gz                                  | 136 kB   00:00     
(2/2): source7.3/primary_db                                | 3.9 MB   00:00     
repo id                              repo name                            status
source7.3                            source7.3                            4,751
repolist: 4,751
#3.如果真机yum源出现如下问题,该怎么解决?
[root@foundation52 ~]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Existing lock /var/run/yum.pid: another copy is running as pid 18512. ## pid为18512的进程正在运行
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory :  31 M RSS (373 MB VSZ)
    Started: Tue Aug 28 14:36:29 2018 - 12:12 ago
    State  : Traced/Stopped, pid: 18512
##可能是系统自动升级正在运行,yum在锁定状态中,已经有一个yum进程在运行了,使用kill干掉它即可
[root@foundation52 ~]# kill -9 18512
[root@foundation52 ~]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: source7.3
Cleaning up everything
(2)检查虚拟机的/etc/yum.repos.d/redhat.repo文件是否编写正确
如果yum源出现rpmdb open failed 报错怎么办?
[root@test2 yum.repos.d]# yum repolist
error: rpmdb: BDB0113 Thread/process 2807/140603860920128 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
[root@test2 yum.repos.d]# yum makecache
error: rpmdb: BDB0113 Thread/process 2807/140603860920128 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed
##根据提示可以知道rpm数据库被损坏,按照下面的方法进行重建
[root@test2 yum.repos.d]# cd /var/lib/rpm/
[root@test2 rpm]# ls
Basenames     __db.002  Group       Obsoletename  Requirename  Triggername
Conflictname  __db.003  Installtid  Packages      Sha1header
__db.001      Dirnames  Name        Providename   Sigmd5
[root@test2 rpm]# rm __db.* -rf
[root@test2 rpm]# rpm --rebuilddb
[root@test2 rpm]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel-source
Cleaning up everything
[root@test2 rpm]# yum update
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel-source                                                        | 4.1 kB  00:00:00     
(1/2): rhel-source/group_gz                                        | 136 kB  00:00:01     
(2/2): rhel-source/primary_db                                      | 3.9 MB  00:00:01     
No packages marked for update
[root@test2 rpm]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id               repo name                                                     status
rhel-source           Red Hat Enterprise Linux 7Server - x86_64 - Source            4,751
repolist: 4,751

2.给企业7的虚拟机执行scp命令传输软件包时出现如下问题该怎么办?

[root@foundation52 kiosk]# scp docker-engine-* 172.25.52.33:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
3b:91:b1:fb:bf:9f:18:7f:e8:cf:19:af:d0:b4:d8:76.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:5
RSA host key for 172.25.52.33 has changed and you have requested strict checking.
Host key verification failed.
lost connection
解决方案:
##(1).删除文件所有内容
[root@foundation52 kiosk]# vim .ssh/known_hosts 
##(2).如果还是不能scp传输 则直接删除该文件即可
[root@foundation52 kiosk]# rm -f /root/.ssh/known_hosts 

3.无法连接虚拟机怎么办?

[root@foundation52 images]# ssh root@172.25.52.33
ssh: connect to host 172.25.52.33 port 22: No route to host
##查看桥接 发现vnet2桥接位置有误
[root@foundation52 images]# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.0021cc6f6201   no      enp0s25
                            vnet0
                            vnet1
virbr0      8000.52540066ca08   yes     virbr0-nic
                            vnet2
virbr1      8000.52540084f928   yes     virbr1-nic
##断开错误桥接
[root@foundation52 images]# brctl delif virbr0 vnet2
##重新添加桥接
[root@foundation52 images]# brctl addif br0 vnet2
[root@foundation52 images]# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.0021cc6f6201   no      enp0s25
                            vnet0
                            vnet1
                            vnet2
virbr0      8000.52540066ca08   yes     virbr0-nic
virbr1      8000.52540084f928   yes     virbr1-nic
[root@foundation52 images]# ssh root@172.25.52.33
root@172.25.52.33's password: 
Last login: Wed Aug 22 15:04:08 2018

3.u盘只读该如何拷贝文件?

##查看到u盘设备/dev/sdb1
[root@foundation52 ~]# df
Filesystem                         1K-blocks     Used Available Use% Mounted on
/dev/mapper/rhel_foundation52-root 307430744 50738816 256691928  17% /
devtmpfs                             1949996        0   1949996   0% /dev
tmpfs                                1963368      192   1963176   1% /dev/shm
tmpfs                                1963368     9152   1954216   1% /run
tmpfs                                1963368        0   1963368   0% /sys/fs/cgroup
/dev/sda1                            1038336   143456    894880  14% /boot
/dev/loop0                           3704296  3704296         0 100% /source7.3
/dev/loop1                           3704296  3704296         0 100% /var/www/html/source7.3
/dev/loop2                           3762278  3762278         0 100% /source6.5
/dev/loop3                           3762278  3762278         0 100% /var/www/html/source6.5
tmpfs                                 392676       28    392648   1% /run/user/1000
overlay                            307430744 50738816 256691928  17% /var/lib/docker/overlay/6f3a2da503660108724d36517baea79a820ebd27d19c2974eed361a03a2458b9/merged
shm                                    65536        0     65536   0% /var/lib/docker/containers/99ee302d848c741a020c90f1533a4303a326abfd150b061c45dc221b5847f554/shm
/dev/sdb1                           60493856 43991616  16502240  73% /run/media/kiosk/KINGSTON
[root@foundation52 ~]# mount -o rw,remount /dev/sdb1  
[root@foundation52 ~]# umount /dev/sdb1
[root@foundation52 ~]# df
Filesystem                         1K-blocks     Used Available Use% Mounted on
/dev/mapper/rhel_foundation52-root 307430744 50738836 256691908  17% /
devtmpfs                             1949996        0   1949996   0% /dev
tmpfs                                1963368      192   1963176   1% /dev/shm
tmpfs                                1963368     9144   1954224   1% /run
tmpfs                                1963368        0   1963368   0% /sys/fs/cgroup
/dev/sda1                            1038336   143456    894880  14% /boot
/dev/loop0                           3704296  3704296         0 100% /source7.3
/dev/loop1                           3704296  3704296         0 100% /var/www/html/source7.3
/dev/loop2                           3762278  3762278         0 100% /source6.5
/dev/loop3                           3762278  3762278         0 100% /var/www/html/source6.5
tmpfs                                 392676       28    392648   1% /run/user/1000
overlay                            307430744 50738836 256691908  17% /var/lib/docker/overlay/6f3a2da503660108724d36517baea79a820ebd27d19c2974eed361a03a2458b9/merged
shm                                    65536        0     65536   0% /var/lib/docker/containers/99ee302d848c741a020c90f1533a4303a326abfd150b061c45dc221b5847f554/shm
[root@foundation52 ~]# mount /dev/sdb1 /mnt
[root@foundation52 ~]# cd /mnt
##可查看到盘里的东西
[root@foundation52 mnt]# ls
??  ???     docker1.wps  file14~  rhel-server-7.3-x86_64-dvd.iso  WESTOS_OS_DOCS
??  docker  ??file       hym      ss                              zobbix??
##拷贝图片
[root@foundation52 mnt]# mv /home/kiosk/Desktop/tu /mnt
##拷贝软件包
[root@foundation52 tu]# cd /home/kiosk/Desktop/gitlab/
[root@foundation52 gitlab]# cp * /mnt
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值