Cloning VirtualBox machine with Rocky Linux 9.2 always result into emergency mode after Linux boot

I have been using VirtualBox for many many years for all kind of testing. My work flow is:

  • create new virtual machine
  • install Linux in it
  • then have this virtual machine untouched
  • clone in previous steps created virtual machine many times for all kind of tests

Above work flow massively spares the time to do the cloning instead of install operating system for every machine. Virtual machine clone only last for few seconds.

I have been using Ubuntu for 15+ years and have never had any problem with VirtualBox cloning. Also did not have any problem cloning virtual machine using Rocky Linux 8. But now with Rocky Linux 9, I have first got into following problem.

When virtual machine cloning is executed, VirtualBox renames disk names or disk IDs (I am not sure what) and after boot Rocky Linux 9 fails into “emergency mode”.

I have asked for help on VirtualBox forum and I have got the answer this is normal VirtualBox operation, when cloning is performed disk naming is changed. Speculation was, when Ubuntu or Rocky Linux 8 is cloned Linux referencing disk is different then in Rocky Linux 9 which probably has some disk names/ids references and so after Linux falls into emergency mode some manual changes are required.

Can you help me out, what changed do I need to do? I use Linux for years, but I have never deepen into Linux internals, because I need it for my applications. Any reference to some documentation or step-by-step instructions are very welcome.

1 Like

RHEL (but this goes back to at least 7 or longer) does on “normal” install create /etc/fstab (and GRUB boot entries) with UUIDs, rather than hda/sda/vda names (because names are not always persistent).
If the clone operation creates new filesystems with unique UUIDs, then those referrals break.

The default to use LVM alleviates/masks this somewhat, as the LVM volume identifiers tend to stay (by whatever magic).

I have solved the problem.

In emergency mode in cloned machine I typed in root password, then opened file
/etc/lvm/lvm.conf set to use_devicesfile=0 and rebooted.

I described the details in VirtualBox forum (see my first post).


Thanks, it works. Is there any downside to it? Is it LVM is disabled or something?

man lvm.conf points to lvmconfig --type default --withcomments which tells:

# Configuration option devices/use_devicesfile.
# Enable or disable the use of a devices file.
# When enabled, lvm will only use devices that
# are lised in the devices file. A devices file will
# be used, regardless of this setting, when the --devicesfile
# option is set to a specific file name.
# This configuration option has an automatic default value.
# use_devicesfile=1

In other words LVM is enabled either way, but with
use_devicesfile=0 it does scan all devices for PV, VG, LV metadata.

Downside? If the system has (LVM) volumes that the host should not scan/detect/enable (e.g. for VM guests), then one has to tune the other options in the devices section in order to not scan all volumes.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.