Bug 618556

Summary: virt-rescue return none zero value when exit
Product: [Community] Virtualization Tools Reporter: Pengzhen Cao <pcao>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: jzheng, lilu, mbooth, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-26 14:56:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pengzhen Cao 2010-07-27 09:16:09 UTC
Description of problem:
virt-rescue return none zero value when exit

Version-Release number of selected component (if applicable):
libguestfs-1.2.9-2.fc13.x86_64
libguestfs-tools-1.2.9-2.fc13.x86_64


How reproducible:
100%

Steps to Reproduce:
1. run virt-rescue vm.img
2. wait for virt-rescue shell prompt, then run some commands in virt-rescue shell
3. type "exit"
  
Actual results:
virt-rescue quit with none zero stauts 10. saying" child process died unexpectedly at /usr/bin/virt-rescue line 174."

Expected results:
should return zero when exit

Additional info:
guest vm 's kernel panic is expected but I think the return code and error message should be handled more carefully.


logs:

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

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.

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
><rescue> ls 
bin  etc   init  lib64	mnt  proc  sbin     sys      tmp  var
dev  home  lib	 media	opt  root  selinux  sysroot  usr
><rescue> exit
exit

virt-rescue: Syncing the disk now before exiting ...
(Don't worry if you see a 'Kernel panic' message below)

[   16.617326] Kernel panic - not syncing: Attempted to kill init!
[   16.618514] Pid: 1, comm: init Not tainted 2.6.33.5-124.fc13.x86_64 #1
[   16.619980] Call Trace:
[   16.620552]  [<ffffffff81428cbc>] panic+0x75/0x138
[   16.621712]  [<ffffffff8104eca8>] do_exit+0x76/0x71a
[   16.622822]  [<ffffffff811bdff7>] ? security_file_permission+0x11/0x13
[   16.624294]  [<ffffffff8142dc45>] ? do_page_fault+0x2bd/0x2ed
[   16.625590]  [<ffffffff8104f3c8>] do_group_exit+0x7c/0xa6
[   16.626819]  [<ffffffff8104f404>] sys_exit_group+0x12/0x16
[   16.628125]  [<ffffffff81009b02>] system_call_fastpath+0x16/0x1b
[   16.629399] Rebooting in 1 seconds..child process died unexpectedly at /usr/bin/virt-rescue line 174.
[pcao@pcao-laptop libguestfs]$ 
[pcao@pcao-laptop libguestfs]$ echo $?
10

Comment 1 Richard W.M. Jones 2010-07-27 10:15:24 UTC
Yup, this is a bug ...

Comment 2 Richard W.M. Jones 2010-08-26 14:56:17 UTC
This is fixed upstream in this commit:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=c3194e4d370d917db9900a31ea18f10492554da4