Link to home
Start Free TrialLog in
Avatar of Christian Palacios
Christian PalaciosFlag for Canada

asked on

Unable to start up Linux VM because it's looking for a data disk, which I don't need.

Hi there,

I copied the OS drive from the Azure environment as I want to work on a copy of the VM locally instead of in the cloud.  When I turn on the VM, it fails because it is trying to attach a data disk that I didn't download.  The data disk is 1TB so I don't want to download it just to attach it and not use it.  How can I fix this copied VM so that it only tries to boot and not look for this second drive?  I believe I can remove it by putting int he root password so that I can do some maintenance, but with Azure VMs, the root password isn't set and I don't want to change it just in case something happens on the live VM.   Is there another way around it?

I'm getting these errors:

fsck.ext4: Unable to resolve 'UUID=451a8a0d-0c99-4b34-8702-361627fda1a2a' [FAILED]
*** An error occurred during the file system check.  
Give root password for maintenance (or type Control-D to continue):

Thanks!!
Avatar of Michelangelo
Michelangelo
Flag of Italy image

Out of curiosity, did you try the “CTRL+D” option?Also, USUALLY you can set the root pwd before booting into the OS. Did not understand why you do not want to set it
Avatar of Christian Palacios

ASKER

I pressed "CTRL+D" and then is just rebooted and had the same issue.  I don't know if I can set the root password on a VM that is hosted in Azure.  Typically you create a user that is part of the sudo group and that's the user you use when working on an Azure Linux VM.  From there, you can switch to root with sudo su -, but there is never a point where I set the password for root.
I understand you downloaded the vm so it is a copy of the original one - or you just somehow migrated it on a on prem hypervisor? In the former case you should be able to operate on it without caring about the original vm on azure.
In the latter case, you should still be able to create a root password (yes it can be done, it’s unix. It’s just not set) without consequences.
Thank you.  How can I set the root password on my local copy?  I can't even log into it to set it.
Avatar of noci
noci

If during boot you can access the kernel command line (from grub or lilo or whatever boot manager...

add init=/bin/bash to the command line, then the pid 1 process will be bash in place of init (systemv) or systemd mast daemon.
... from there you can either remove the  offending entry from fstab  or you can set a root password ...
(you may need to remount the root filesystem rw before you can update /etc/fstab)

use sync; sync; sync if all updates are done to ensure writing them out to disk.
You may need to remount the root filesystem ro again if continuing.
if you then want to continue normal booting type exec /sbin/init  as a command or reboot the hardware  some other way.
(note shutdown / reboot etc. don't work as the original init is not working... halt may work but just halt the system, requiring a powercycle anyway.
The download was the VM and its configuration files?

A VHD?

Set up a new VM in Hyper-V and attach the existing VHD. Boot.
noci already pointed to the item as well. not sure whether you can edit it at the boot  (have not tried that so not sure of the effectiveness)

the point is that you have a record in /etc/fstab reference to this drive and is set to be mounted on boot.
remove/comment out the entry in /etc/fstab that reference this mount point and it should stop complaining.

This is based on the error and that you have a device that it was mounting but you do not need it anymore, what was done in between to make sure the system is configured not to need this "drive" any more.

Was the disk already deleted from the VM configuration environment?
Haven't worked with your specific setup + normally the way this is done...

1) Go through the root password reset, to make sure you have a working password.

2) Boot into single user mode (runlevel == 1).

This bypasses all setup steps, like disks.

3) When your shell starts, mount the device which contains your /etc, so something like...

mount /dev/sda /mnt

What your device name might be, just look through /dev for sdX or mdX (RAID) devices + mount them one at a time.

3) Check for /mnt/etc/fstab + when it appears, edit + remove the offending disk reference.

4) Hit CNTL-D to end the single user shell + continue multi user boot (default runlevel you have set).
Just follow the below steps:

at the grub prompt, hit a to append options
add init=/bin/bash to the end of the kernel command line and press enter
The system will boot to a prompt enter the following commands at the prompt

mount -o remount,rw /
vim /etc/fstab

edit the fstab file commenting the secondary mounts by adding a # at the begining of each problematic line, save the file

reboot by pressing CTRL+ALT+DEL
Thanks noci.  I can see the Grub menu and then I highlighted the first option and typed 'e' to edit it.  From there I see entries like
"root (0,0)"
"kernel ..."

I put the init=/bin/bash text at the end of the first option "root (0,0)", is that where it should go?  I assumed it was the first option that I needed to edit.  When I did that I'm stuck at a windows that says "Probing EDD (edd=off to disable)....ok".

Thanks,
-Christian
Oops, sorry Ravi, I missed your reply.  I just tried your suggestion but I go the EDD message.  I put edd=off at the end of the edited line, but now the screen is black and I can only see the cursor flashing.  Any suggestions?
Ii am unfamiliar with the Noci grub.conf path,

Letting the system go through the boot process, enter root password at the maintenance prompt.
Then follow through on looking at /etc/fstab to comment out (put # as the first character on the line that referenced the UUID or the "drive" you no longer need)
Exit out the maintenance window at which point the system will resume to boot.

Was the virtual drive (file ) deleted on the host?. As that is the only way I can think of it going missing.
you need to add the init=... to the end of the "kernel line".
So the line  kernel....  is the right one..., the other one is identifying the boot partition root(0,0)
Ok, I added the init=/bin/bash to the end of the "kernel" line.  I then pressed enter and then 'b' so it would boot from there.  I'm still getting the "Probing EDD" message and it just stays there.  Did I make a mistake somewhere?
Could you try the normal boot process, and type in the root password at the maintenance prompt, instead of hitting ctrl-D.
.....

or hit edit, and at the end of the line add single (for single user mode)
Are you sure the disk you didn't copy wan't the one with the root file system?...
Please verify this on the running system.. (and can you show here)

df

Would show mounted filesystems & sizes.
You may obfusciate entries if they show identifiabla info..
And be sure continer it is NOT in the VMWARE profile that fails to boot.
ASKER CERTIFIED SOLUTION
Avatar of Christian Palacios
Christian Palacios
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial