实验环境:
yg-net-static:~ # uname -a
Linux yg-net-static 5.3.18-22-default #1 SMP Wed Jun 3 12:16:43 UTC 2020 (720aeba) x86_64 x86_64 x86_64 GNU/Linux
yg-net-static:~ # cat /etc/os-release
NAME="SLES"
VERSION="15-SP2"
VERSION_ID="15.2"
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP2"
ID="sles"
ID_LIKE="suse"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:15:sp2"
一、安装crash软件包
1、安装crash
zypper install crash
2、本文分析使用的vmcore文件
yg-net-static:~ # ll -th /var/crash/2021-03-31-11\:23/
total 99M
-rw-r--r-- 1 root root 13M Mar 31 11:23 vmlinux-5.3.18-22-default.gz
-rw-r--r-- 1 root root 4.1M Mar 31 11:23 System.map-5.3.18-22-default
-rw-r--r-- 1 root root 185 Mar 31 11:23 README.txt
-rw------- 1 root root 83M Mar 31 11:23 vmcore
-rw------- 1 root root 116K Mar 31 11:23 dmesg.txt
此时还不能直接使用crash来调试vmcore,因为还没下载安装内核调试包 ,执行crash,有如下报错:
yg-net-static:~ # crash -f /var/crash/2021-03-31-11:23/vmlinux-5.3.18-22-default.gz /var/crash/2021-03-31-11:23/vmcore
crash 7.2.8
Copyright (C) 2002-2020 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
crash: /var/tmp/vmlinux-5.3.18-22-default.gz_TK14UC: no debugging data available
crash: vmlinux-5.3.18-22-default.debug: debuginfo file not found
crash: either install the appropriate kernel debuginfo package, or
copy vmlinux-5.3.18-22-default.debug to this machine
二、安装内核调试包
1、先查看是否安装内核调试包
yg-net-static:~ #
yg-net-static:~ # zypper se kernel | grep debug
yg-net-static:~ #
没有输出,说明没有安装内核调试包。
2、查看可用的已订阅的安装源
yg-net-static:~ # zypper repos
Repository priorities are without effect. All enabled repositories share the same priority.
# | Alias | Name | Enabled | GPG Check | Refresh
---+---------------------------------------------------------------------------------------------------+---------------------------------------------------------+---------+-----------+--------
1 | Basesystem-Module_15.2-0 | sle-module-basesystem | No | ---- | ----
2 | Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Debuginfo-Pool | SLE-Module-Basesystem15-SP2-Debuginfo-Pool | No | ---- | ----
3 | Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Debuginfo-Updates | SLE-Module-Basesystem15-SP2-Debuginfo-Updates | No | ---- | ----
4 | Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Pool | SLE-Module-Basesystem15-SP2-Pool | Yes | (r ) Yes | No
5 | Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Source-Pool | SLE-Module-Basesystem15-SP2-Source-Pool | No | ---- | ----
6 | Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Updates | SLE-Module-Basesystem15-SP2-Updates | Yes | (r ) Yes | Yes
7 | Desktop-Applications-Module_15.2-0 | sle-module-desktop-applications | No | ---- | ----
8 | Desktop_Applications_Module_15_SP2_x86_64:SLE-Module-Desktop-Applications15-SP2-Debuginfo-Pool | SLE-Module-Desktop-Applications15-SP2-Debuginfo-Pool | No | ---- | ----
9 | Desktop_Applications_Module_15_SP2_x86_64:SLE-Module-Desktop-Applications15-SP2-Debuginfo-Updates | SLE-Module-Desktop-Applications15-SP2-Debuginfo-Updates | No | ---- | ----
10 | Desktop_Applications_Module_15_SP2_x86_64:SLE-Module-Desktop-Applications15-SP2-Pool | SLE-Module-Desktop-Applications15-SP2-Pool | Yes | (r ) Yes | No
11 | Desktop_Applications_Module_15_SP2_x86_64:SLE-Module-Desktop-Applications15-SP2-Source-Pool | SLE-Module-Desktop-Applications15-SP2-Source-Pool | No | ---- | ----
12 | Desktop_Applications_Module_15_SP2_x86_64:SLE-Module-Desktop-Applications15-SP2-Updates | SLE-Module-Desktop-Applications15-SP2-Updates | Yes | (r ) Yes | Yes
13 | Development-Tools-Module_15.2-0 | sle-module-development-tools | No | ---- | ----
14 | Development_Tools_Module_15_SP2_x86_64:SLE-Module-DevTools15-SP2-Debuginfo-Pool | SLE-Module-DevTools15-SP2-Debuginfo-Pool | No | ---- | ----
15 | Development_Tools_Module_15_SP2_x86_64:SLE-Module-DevTools15-SP2-Debuginfo-Updates | SLE-Module-DevTools15-SP2-Debuginfo-Updates | No | ---- | ----
16 | Development_Tools_Module_15_SP2_x86_64:SLE-Module-DevTools15-SP2-Pool | SLE-Module-DevTools15-SP2-Pool | Yes | (r ) Yes | No
17 | Development_Tools_Module_15_SP2_x86_64:SLE-Module-DevTools15-SP2-Source-Pool | SLE-Module-DevTools15-SP2-Source-Pool | No | ---- | ----
18 | Development_Tools_Module_15_SP2_x86_64:SLE-Module-DevTools15-SP2-Updates | SLE-Module-DevTools15-SP2-Updates | Yes | (r ) Yes | Yes
19 | SLES15-SP2-15.2-0 | SLES15-SP2-15.2-0 | No | ---- | ----
20 | SUSE_Linux_Enterprise_Server_15_SP2_x86_64:SLE-Product-SLES15-SP2-Debuginfo-Pool | SLE-Product-SLES15-SP2-Debuginfo-Pool | No | ---- | ----
21 | SUSE_Linux_Enterprise_Server_15_SP2_x86_64:SLE-Product-SLES15-SP2-Debuginfo-Updates | SLE-Product-SLES15-SP2-Debuginfo-Updates | No | ---- | ----
22 | SUSE_Linux_Enterprise_Server_15_SP2_x86_64:SLE-Product-SLES15-SP2-Pool | SLE-Product-SLES15-SP2-Pool | Yes | (r ) Yes | No
23 | SUSE_Linux_Enterprise_Server_15_SP2_x86_64:SLE-Product-SLES15-SP2-Source-Pool | SLE-Product-SLES15-SP2-Source-Pool | No | ---- | ----
24 | SUSE_Linux_Enterprise_Server_15_SP2_x86_64:SLE-Product-SLES15-SP2-Updates | SLE-Product-SLES15-SP2-Updates | Yes | (r ) Yes | Yes
25 | Server-Applications-Module_15.2-0 | sle-module-server-applications | No | ---- | ----
26 | Server_Applications_Module_15_SP2_x86_64:SLE-Module-Server-Applications15-SP2-Debuginfo-Pool | SLE-Module-Server-Applications15-SP2-Debuginfo-Pool | No | ---- | ----
27 | Server_Applications_Module_15_SP2_x86_64:SLE-Module-Server-Applications15-SP2-Debuginfo-Updates | SLE-Module-Server-Applications15-SP2-Debuginfo-Updates | No | ---- | ----
28 | Server_Applications_Module_15_SP2_x86_64:SLE-Module-Server-Applications15-SP2-Pool | SLE-Module-Server-Applications15-SP2-Pool | Yes | (r ) Yes | No
29 | Server_Applications_Module_15_SP2_x86_64:SLE-Module-Server-Applications15-SP2-Source-Pool | SLE-Module-Server-Applications15-SP2-Source-Pool | No | ---- | ----
30 | Server_Applications_Module_15_SP2_x86_64:SLE-Module-Server-Applications15-SP2-Updates | SLE-Module-Server-Applications15-SP2-Updates | Yes | (r ) Yes | Yes
yg-net-static:~ #
可用看到并没有启用Debuginfo-Updates及Debuginfo-Pool的安装源。
3、使用zypper modifyrepo启用调试包安装源
yg-net-static:~ # zypper modifyrepo --enable Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Debuginfo-Pool
Repository 'Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Debuginfo-Pool' has been successfully enabled.
yg-net-static:~ # zypper modifyrepo --enable Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Debuginfo-Updates
Repository 'Basesystem_Module_15_SP2_x86_64:SLE-Module-Basesystem15-SP2-Debuginfo-Updates' has been successfully enabled.
4、查看可用调试包
yg-net-static:~ # zypper search -s kernel-*-debuginfo*
Refreshing service 'Basesystem_Module_15_SP2_x86_64'.
Refreshing service 'Desktop_Applications_Module_15_SP2_x86_64'.
Refreshing service 'Development_Tools_Module_15_SP2_x86_64'.
Refreshing service 'SUSE_Linux_Enterprise_Server_15_SP2_x86_64'.
Refreshing service 'Server_Applications_Module_15_SP2_x86_64'.
Loading repository data...
Reading installed packages...
S | Name | Type | Version | Arch | Repository
--+--------------------------------+---------+----------------+--------+----------------------------------------------
| kernel-default-debuginfo | package | 5.3.18-24.52.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.49.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.46.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.43.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.37.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.34.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.29.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.24.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.15.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.12.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-24.9.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-debuginfo | package | 5.3.18-22.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Pool
| kernel-default-devel-debuginfo | package | 5.3.18-24.52.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.49.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.46.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.43.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.37.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.34.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.29.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.24.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.15.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.12.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-24.9.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-default-devel-debuginfo | package | 5.3.18-22.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Pool
| kernel-preempt-debuginfo | package | 5.3.18-24.52.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.49.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.46.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.43.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.37.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.34.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.29.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.24.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.15.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.12.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-24.9.1 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Updates
| kernel-preempt-debuginfo | package | 5.3.18-22.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Pool
For an extended search including not yet activated remote resources you may run 'zypper
search-packages' at any time.
Do you want to run 'zypper search-packages' now? [yes/no/always/never] (no):
yg-net-static:~ # uname -r
5.3.18-22-default
yg-net-static:~ #
5、安装当前系统对应内核版本最接近的调试包
- uname -r可以看出我的系统使用的是5.3.18-22-default内核版本;
- 使用zypper se -s命令查看跟当前内核版本匹配的内核调试包;
- zypper in kernel-default-debuginfo=5.3.18-22.2安装内核调试包。
yg-net-static:~ # uname -r
5.3.18-22-default
yg-net-static:~ #
yg-net-static:~ #
yg-net-static:~ # zypper search -s kernel-*-debuginfo* | grep 5.3.18-22
| kernel-default-debuginfo | package | 5.3.18-22.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Pool
| kernel-default-devel-debuginfo | package | 5.3.18-22.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Pool
| kernel-preempt-debuginfo | package | 5.3.18-22.2 | x86_64 | SLE-Module-Basesystem15-SP2-Debuginfo-Pool
yg-net-static:~ # zypper in kernel-default-debuginfo=5.3.18-22.2
Refreshing service 'Basesystem_Module_15_SP2_x86_64'.
Refreshing service 'Desktop_Applications_Module_15_SP2_x86_64'.
Refreshing service 'Development_Tools_Module_15_SP2_x86_64'.
Refreshing service 'SUSE_Linux_Enterprise_Server_15_SP2_x86_64'.
Refreshing service 'Server_Applications_Module_15_SP2_x86_64'.
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
kernel-default-debuginfo kernel-default-debugsource
The following recommended package was automatically selected:
kernel-default-debugsource
The following 2 packages have no support information from their vendor:
kernel-default-debuginfo kernel-default-debugsource
2 new packages to install.
Overall download size: 876.2 MiB. Already cached: 0 B. After the operation, additional 3.1 GiB will be used.
Continue? [y/n/v/...? shows all options] (y):
In cache kernel-default-debugsource-5.3.18-22.2.x86_64.rpm (1/2), 65.0 MiB (355.9 MiB unpacked)
Retrieving package kernel-default-debuginfo-5.3.18-22.2.x86_64 (2/2), 811.2 MiB ( 2.78 GiB unpacked)
Retrieving: kernel-default-debuginfo-5.3.18-22.2.x86_64.rpm ..................................................................................................................................[done (304.8 KiB/s)]
Checking for file conflicts: ...............................................................................................................................................................................[done]
(1/2) Installing: kernel-default-debugsource-5.3.18-22.2.x86_64 ............................................................................................................................................[done]
(2/2) Installing: kernel-default-debuginfo-5.3.18-22.2.x86_64 ..............................................................................................................................................[done]
Installation has completed.
yg-net-static:~ #
6、查看调试包文件及内核源码目录
安装完内核调试包后,就可以看到/usr/lib/debug/boot/目录下已经有了vmlinux调试版文件了,同时/usr/src/debug下也有了5.3.18-22.2.x86_6的内核源代码:
yg-net-static:~ # ll -th /usr/lib/debug/boot/vmlinux-5.3.18-22-default.debug
-rw-r--r-- 1 root root 419M Jun 7 2020 /usr/lib/debug/boot/vmlinux-5.3.18-22-default.debug
yg-net-static:~ # ll /usr/src/
debug/ linux/ linux-5.3.18-22/ linux-5.3.18-22-obj/ linux-obj/ packages/
yg-net-static:~ # ll /usr/src/debug/kernel-default-5.3.18-22.2.x86_64/linux-5.3/
arch/ block/ certs/ crypto/ drivers/ fs/ include/ init/ ipc/ kernel/ lib/ linux-obj/ mm/ net/ security/ sound/ tools/ virt/
yg-net-static:~ # ll /usr/src/debug/kernel-default-5.3.18-22.2.x86_64/linux-5.3/
total 0
drwxr-xr-x 1 root root 6 Apr 2 08:03 arch
drwxr-xr-x 1 root root 1438 Apr 2 08:03 block
drwxr-xr-x 1 root root 116 Apr 2 08:03 certs
drwxr-xr-x 1 root root 2728 Apr 2 08:03 crypto
drwxr-xr-x 1 root root 1086 Apr 2 08:04 drivers
drwxr-xr-x 1 root root 1770 Apr 2 08:04 fs
drwxr-xr-x 1 root root 222 Apr 2 08:04 include
drwxr-xr-x 1 root root 176 Apr 2 08:04 init
drwxr-xr-x 1 root root 190 Apr 2 08:04 ipc
drwxr-xr-x 1 root root 1964 Apr 2 08:04 kernel
drwxr-xr-x 1 root root 2838 Apr 2 08:04 lib
drwxr-xr-x 1 root root 110 Apr 2 08:04 linux-obj
drwxr-xr-x 1 root root 1926 Apr 2 08:04 mm
drwxr-xr-x 1 root root 582 Apr 2 08:04 net
drwxr-xr-x 1 root root 226 Apr 2 08:04 security
drwxr-xr-x 1 root root 134 Apr 2 08:04 sound
drwxr-xr-x 1 root root 34 Apr 2 08:04 tools
drwxr-xr-x 1 root root 12 Apr 2 08:04 virt
三、使用crash分析崩溃文件
可以用crash分析vmcore了:
yg-net-static:~ # cd /var/crash/2021-03-31-11\:23/
yg-net-static:/var/crash/2021-03-31-11:23 # ls
README.txt System.map-5.3.18-22-default dmesg.txt vmcore vmlinux-5.3.18-22-default.gz
yg-net-static:/var/crash/2021-03-31-11:23 # crash vmlinux-5.3.18-22-default.gz vmcore
crash 7.2.8
Copyright (C) 2002-2020 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
WARNING: kernel relocated [954MB]: patching 101934 gdb minimal_symbol values
KERNEL: vmlinux-5.3.18-22-default.gz
DEBUGINFO: /usr/lib/debug/boot/vmlinux-5.3.18-22-default.debug
DUMPFILE: vmcore [PARTIAL DUMP]
CPUS: 2
DATE: Wed Mar 31 11:23:06 2021
UPTIME: 3 days, 00:02:13
LOAD AVERAGE: 0.12, 0.03, 0.01
TASKS: 596
NODENAME: yg-net-static
RELEASE: 5.3.18-22-default
VERSION: #1 SMP Wed Jun 3 12:16:43 UTC 2020 (720aeba)
MACHINE: x86_64 (3912 Mhz)
MEMORY: 2 GB
PANIC: "general protection fault: 0000 [#1] SMP PTI"
PID: 32113
COMMAND: "insmod"
TASK: ffff8963044ece00 [THREAD_INFO: ffff8963044ece00]
CPU: 1
STATE: TASK_RUNNING (PANIC)
crash>
具体如何使用crash分析内核崩溃转储文件vmcore,可以看crash分析linux内核崩溃转储文件vmcore。
四、kvm中sles使用本地源安装软件包配置方法
15.2. Attaching and updating a device with virsh
Attaching a disk image to a guest's CD-ROM drive with virsh
:
-
Attach a disk image to a guest's CD-ROM drive:
# virsh attach-disk <GuestName>
sample.iso
hdc --type cdrom --mode readonly Disk attached successfully -
Create an XML file to update a specific device. To detach, remove a line for the source device:
<disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
-
Detach a disk image by updating the device:
virsh update-device <GuestName>
guest-device.xml
Device updated successfully -
挂载ISO文件
mount -t iso9660 /run/media/root/SLE-15-SP2-Full-x86_64209.21.001 /dev/sr0
localhost:~ # mount | grep SLE
/dev/sr0 on /run/media/root/SLE-15-SP2-Full-x86_64209.21.001 type iso9660 (ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=0,gid=0,dmode=500,fmode=400,uhelper=udisks2)
配置本地repo(源): sudo zypper ar -f /dev/sr0 iso
查看系统中的源:
# zypper lr
# zypper refresh
清缓存
# zypper clean
刷新安装源
# zypper ref
列出所有可用的模式
# zypper pt
删除源
# zypper rr iso
# zypper rs
本文完。
最后,感兴趣的可以关注我的微信公众号 大胖聊编程 , 有更多分享文章,一起交流学习,共同进步。