解決 yum源出現的常見問題、scp傳輸軟體包報錯 、無法連線虛擬機器、u盤只讀
阿新 • • 發佈:2018-12-23
1.虛擬機器無法下載軟體 該怎麼辦?
(1)檢查真機yum源是否完好
#1.先執行 df 檢視掛載是否正確
#2.如果repolist數量為0該怎麼辦?
[[email protected] 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
[[email protected] 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
解決方案:
[[email protected] kiosk]# systemctl remove httpd -y
[[email protected] kiosk]# systemctl intall httpd -y
[[email protected] 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
[[email protected] 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源出現如下問題,該怎麼解決?
[[email protected] ~]# 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幹掉它即可
[[email protected] ~]# kill -9 18512
[[email protected] ~]# 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 報錯怎麼辦?
[[email protected] 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
[[email protected] 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資料庫被損壞,按照下面的方法進行重建
[[email protected] yum.repos.d]# cd /var/lib/rpm/
[[email protected] rpm]# ls
Basenames __db.002 Group Obsoletename Requirename Triggername
Conflictname __db.003 Installtid Packages Sha1header
__db.001 Dirnames Name Providename Sigmd5
[[email protected] rpm]# rm __db.* -rf
[[email protected] rpm]# rpm --rebuilddb
[[email protected] 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
[[email protected] 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
[[email protected] 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 [email protected]
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 [email protected]
[email protected]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