Difference between revisions of "Virt-rescue"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<code>virt-rescue</code> - Run a rescue shell on a virtual machine
 
<code>virt-rescue</code> - Run a rescue shell on a virtual machine
  
  virt-rescue -> fdisk -l -> mount /dev/sdXXX /sysroot
+
  virt-rescue -> [[fdisk -l]] -> [[mount]] /dev/sdXXX [[/sysroot]]
  
 
  virt-rescue -a /path/to/image/debian_your_name.[[qcow2]]
 
  virt-rescue -a /path/to/image/debian_your_name.[[qcow2]]
  
 
+
== Examples ==
 
<pre>
 
<pre>
 
virt-rescue -a /srv/libvirt/rcu-test-root.qcow2
 
virt-rescue -a /srv/libvirt/rcu-test-root.qcow2
Line 44: Line 44:
 
><rescue>
 
><rescue>
 
</pre>
 
</pre>
 +
 +
 +
<pre>
 +
virt-rescue -a ./disk.qcow2
 +
Could not access KVM kernel module: No such file or directory
 +
qemu-system-x86_64: failed to initialize KVM: No such file or directory
 +
qemu-system-x86_64: Back to tcg accelerator
 +
supermin: mounting /proc
 +
supermin: ext2 mini initrd starting up: 5.1.20
 +
insmod: init_module: crc32-pclmul.ko: No such device
 +
insmod: init_module: crct10dif-pclmul.ko: No such device
 +
Starting /init script ...
 +
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:12] Unknown group 'audio'.
 +
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:13] Unknown group 'audio'.
 +
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:14] Unknown group 'disk'.
 +
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:17] Unknown group 'kvm'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:11] Unknown group 'utmp'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:19] Unknown user 'systemd-network'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:20] Unknown user 'systemd-network'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:21] Unknown user 'systemd-network'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:22] Unknown user 'systemd-network'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:26] Unknown group 'systemd-journal'.
 +
[/usr/lib/tmpfiles.d/systemd.conf:27] Unknown group 'systemd-journal'.
 +
Failed to parse ACL "d:group::r-x,d:group:adm:r-x,group::r-x,group:adm:r-x": No such file or directory. Ignoring
 +
Failed to parse ACL "d:group:adm:r-x,group:adm:r-x": No such file or directory. Ignoring
 +
Failed to parse ACL "group:adm:r--": No such file or directory. Ignoring
 +
Failed to parse ACL "d:group::r-x,d:group:adm:r-x,group::r-x,group:adm:r-x": No such file or directory. Ignoring
 +
Failed to parse ACL "d:group:adm:r-x,group:adm:r-x": No such file or directory. Ignoring
 +
Failed to parse ACL "group:adm:r--": No such file or directory. Ignoring
 +
Starting version 245.4-4ubuntu3.4
 +
/init: line 116: echo: write error: Invalid argument
 +
/init: line 116: echo: write error: Invalid argument
 +
mdadm: No arrays found in config file or automatically
 +
/init: line 144: lvmetad: command not found
 +
mdadm: No arrays found in config file or automatically
 +
[
 +
]
 +
lvm_system_dir = /tmp/lvm
 +
 +
The virt-rescue escape key is ‘^]’.  Type ‘^] h’ for help.
 +
 +
------------------------------------------------------------
 +
 +
Welcome to virt-rescue, the libguestfs rescue shell.
 +
 +
Note: The contents of / (root) are the rescue appliance.
 +
You have to mount the guest’s partitions under /sysroot
 +
before you can examine them.
 +
 +
groups: cannot find name for group ID 0
 +
><rescue>
 +
</pre>
 +
 +
 +
 +
 +
 +
== fdisk ==
 +
[[fdisk -l]]
 +
Disk /dev/sda: 25 GiB, 26843545600 bytes, 52428800 sectors
 +
Disk model: QEMU HARDDISK
 +
Units: sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
Disklabel type: gpt
 +
Disk identifier: BE15153C-637B-4D56-BE22-0EF6E5F72AE5
 +
 +
Device    Start      End  Sectors Size Type
 +
/dev/sda1  2048 52426751 52424704  25G Linux filesystem
 +
 +
 +
Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors
 +
Disk model: QEMU HARDDISK
 +
Units: sectors of 1 * 512 = 512 bytes
 +
Sector size (logical/physical): 512 bytes / 512 bytes
 +
I/O size (minimum/optimal): 512 bytes / 512 bytes
  
  

Latest revision as of 07:51, 4 April 2021

virt-rescue - Run a rescue shell on a virtual machine

virt-rescue -> fdisk -l -> mount /dev/sdXXX /sysroot
virt-rescue -a /path/to/image/debian_your_name.qcow2

Examples[edit]

virt-rescue -a /srv/libvirt/rcu-test-root.qcow2
supermin: mounting /proc
supermin: ext2 mini initrd starting up: 5.1.19
Starting /init script ...
[/usr/lib/tmpfiles.d/systemd.conf:11] Unknown group 'utmp'.
[/usr/lib/tmpfiles.d/systemd.conf:19] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:20] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:21] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:25] Unknown group 'systemd-journal'.
[/usr/lib/tmpfiles.d/systemd.conf:26] Unknown group 'systemd-journal'.
Failed to parse ACL "d:group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group:adm:r--": No such file or directory. Ignoring
Failed to parse ACL "d:group::r-x,d:group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group::r-x,group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "d:group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group:adm:r--": No such file or directory. Ignoring
starting version 237
/init: line 116: echo: write error: Invalid argument
/init: line 116: echo: write error: Invalid argument
mdadm: No arrays found in config file or automatically
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
[
]

------------------------------------------------------------

Welcome to virt-rescue, the libguestfs rescue shell.

Note: The contents of / are the rescue appliance.
You have to mount the guest's partitions under /sysroot
before you can examine them.

groups: cannot find name for group ID 0
><rescue>


virt-rescue -a ./disk.qcow2
Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator
supermin: mounting /proc
supermin: ext2 mini initrd starting up: 5.1.20
insmod: init_module: crc32-pclmul.ko: No such device
insmod: init_module: crct10dif-pclmul.ko: No such device
Starting /init script ...
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:12] Unknown group 'audio'.
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:13] Unknown group 'audio'.
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:14] Unknown group 'disk'.
[/usr/lib/tmpfiles.d/static-nodes-permissions.conf:17] Unknown group 'kvm'.
[/usr/lib/tmpfiles.d/systemd.conf:11] Unknown group 'utmp'.
[/usr/lib/tmpfiles.d/systemd.conf:19] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:20] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:21] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:22] Unknown user 'systemd-network'.
[/usr/lib/tmpfiles.d/systemd.conf:26] Unknown group 'systemd-journal'.
[/usr/lib/tmpfiles.d/systemd.conf:27] Unknown group 'systemd-journal'.
Failed to parse ACL "d:group::r-x,d:group:adm:r-x,group::r-x,group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "d:group:adm:r-x,group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group:adm:r--": No such file or directory. Ignoring
Failed to parse ACL "d:group::r-x,d:group:adm:r-x,group::r-x,group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "d:group:adm:r-x,group:adm:r-x": No such file or directory. Ignoring
Failed to parse ACL "group:adm:r--": No such file or directory. Ignoring
Starting version 245.4-4ubuntu3.4
/init: line 116: echo: write error: Invalid argument
/init: line 116: echo: write error: Invalid argument
mdadm: No arrays found in config file or automatically
/init: line 144: lvmetad: command not found
mdadm: No arrays found in config file or automatically
[
]
lvm_system_dir = /tmp/lvm

The virt-rescue escape key is ‘^]’.  Type ‘^] h’ for help.

------------------------------------------------------------

Welcome to virt-rescue, the libguestfs rescue shell.

Note: The contents of / (root) are the rescue appliance.
You have to mount the guest’s partitions under /sysroot
before you can examine them.

groups: cannot find name for group ID 0
><rescue>



fdisk[edit]

fdisk -l
Disk /dev/sda: 25 GiB, 26843545600 bytes, 52428800 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BE15153C-637B-4D56-BE22-0EF6E5F72AE5

Device     Start      End  Sectors Size Type
/dev/sda1   2048 52426751 52424704  25G Linux filesystem


Disk /dev/sdb: 4 GiB, 4294967296 bytes, 8388608 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Related commands[edit]

Activities[edit]

See also[edit]

Advertising: