Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyper-V VM fails with grub rescue shell + kernel panic #180

Closed
fredrik-nti-johanneberg opened this issue Mar 26, 2024 · 3 comments
Closed

Comments

@fredrik-nti-johanneberg

GNS3 Version: GNS3 v3.0.0b1
GNS3 VM: Hyper-V v3.0.0b1
Operating System: Windows 10 Education 22H2

After working with a topology using MikroTik CHR (chr-6.49.11.img) QEMU appliances my Hyper-V VM failed to boot up at the next session.

The VM will halt for a while during the initial boot sequence displaying an error message "error: attempt to read or write outside of disk 'hd0'". The boot sequence will then continue but fails with a kernel panic "not syncing: VFS: Unable to mount root fs on unknown-block(0,0)".

I have been able to recover my project files and configuration by mounting GNS3 VM-disk001.vhd and GNS3 VM-disk002.vhd in another virtual machine.

This seems to be related to gns3-gui #2314 but I cannot figure out if it's possible to restore the affected VM to a working state again.

I started a GNS3 forum thread on the same topic.

@fredrik-nti-johanneberg
Copy link
Author

I managed to solve this by repairing grub. Here's what you need to do in order to repair grub and get your GNS3 Hyper-V VM booting normally again:

Download Debian Live standard iso Add a new DVD-device to your VM, link it to the Debian Live iso and change the boot-order to CD first. Make sure that your VM has internet connectivity (via Default switch).

Command sequence:

sudo -i
apt update && apt install grub
mount /dev/sda1 /mnt
mount /dev/sda15 /mnt/boot/efi
mount --rbind /dev /mnt/dev
mount --rbind /proc /mnt/proc
mount --rbind /sys /mnt/sys
chroot /mnt
grub-install /dev/sda

It is necessary to re-mount /dev, /proc and /sys from the readonly live system to /mnt. Grub will otherwise fail with "cannot find a device for /boot (is /dev mounted?)" error.

Stop the VM after this, remove the CD/DVD or change the boot order to IDE first. Then restart the VM.

@fredrik-nti-johanneberg
Copy link
Author

fredrik-nti-johanneberg commented Mar 27, 2024

In the end, repairing grub did not work out for me (boot issue remains). Here's what I did instead:

Overwrite 'GNS3 VM-disk001.vhd' (GNS3 system partition) with an untouched copy from the GNS3 VM zip-file. Start an administrative Powershell, change working directory to your VM path and issue the following command:

$VMId = get-vm 'GNS3 VM' | Select-Object VMID -ExpandProperty VMId
icacls '.\GNS3 VM-disk001.vhd' /grant "$($VMId.Guid):F"

The icacls command will grant the replaced vhd read/write access and register it with the VM.

Your projects reside in the 'GNS3 VM-disk002.vhd' and will be mounted to /opt/gns3 upon boot. You may now restart your GNS3 VM and reconfigure networking if necessary.

@grossmj
Copy link
Member

grossmj commented Apr 2, 2024

Thanks for the detailed fix. I am not sure why you got into that situation and how we could prevent this to happen for other users. Please let us know if you have an idea. I am closing this for now.

@grossmj grossmj closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants