Forum Stats

  • 3,722,382 Users
  • 2,244,297 Discussions
  • 7,849,820 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Oracle Linux 7.9: Virtual Box crashes with bridged network adapter.

Vijaya Ambati
Vijaya Ambati Member Posts: 9 Green Ribbon

Details:

Host Operating System: Oracle Linux 7.9 with Virtual Box 6.1 installed from oracle yum repositories.

Guest Operating System: Oracle Linux 7.7 or any other version installed on Virtual Box 6.1 with bridged network adaptor.

Symptom:

Try to establish an ssh connection to the guest from any other system apart from the host. SSH connection to both the guest and host hangs. Guest OS on the Virtual Box crashes or shuts down.

Steps to reproduce:

  1. Install the Oracle Linux 7.9 as the host operating system.
  2. Install Virtual Box 6.1 from the oracle repositories
  3. Install any Oracle Linux version as the guest operating system on the Virtual Box
  4. Configure the network adapter in the Virtual Box as the bridged adapter.
  5. Find the assigned IP address of the guest operating system
  6. Try to establish an ssh connection to the guest from any other system apart from the host.

Any solution or workaround is welcome!!!

Answers

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon

    I found a similar problem and a partial solution to it posted on the internet.

    This solution does not fit for my purpose.

  • EdStevens
    EdStevens Member Posts: 27,977 Gold Crown

    I have no idea what is causing the crash, but I do have a couple of side observations/questions.

    1) Why are you using oracle linux as a host? It is strictly a server-class OS, lacking a lot of things one would expect for a 'desktop' machine. And VBox is intended as a desktop VM app.

    2) When you say "Find the assigned IP address of the guest operating system", you seem to be using the DHCP-assigned address. Again, since oracle linux (now referring to your guest vm) is intended as a server, I'd be modifying the configuration to use a manually assigned IP address, just like you would for any server in the data center.

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon

    1) Why are you using oracle linux as a host? It is strictly a server-class OS, lacking a lot of things one would expect for a 'desktop' machine. And VBox is intended as a desktop VM app.

    My host machine is a server with several cores and processors. I use VBox to maintain different versions of Oracle Linux on this server for testing purposes. It worked perfectly fine on 7.6, 7.7 and 7.8. Since 7.9 the VBox started to have these problems. If you have an alternative please do suggest.


    2) When you say "Find the assigned IP address of the guest operating system", you seem to be using the DHCP-assigned address. Again, since oracle linux (now referring to your guest vm) is intended as a server, I'd be modifying the configuration to use a manually assigned IP address, just like you would for any server in the data center.

    I did that by assigning the static IP to the server and also by reserving the IP address based on MAC address in the DHCP. But the issue still persists.

  • EdStevens
    EdStevens Member Posts: 27,977 Gold Crown
  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon

    Thanks! I will try there.

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon

    Solution to this problem has been found:

    I accidentally found the solution to the above problem while I am trying to setup and configure the auto restart of virtual machines in Oracle Linux. Here are the steps I followed:

    [These steps were described also at https://kifarunix.com/autostart-virtualbox-vms-on-system-boot-on-linux/. Thanks to koromicha for sharing this on the www.]

    Configure VirtualBox Autostart Service

    In order to configure a VirtualBox VM to start on system boot on Linux, you need to activate the autostart service. The autostart service can be activated by setting two variables in /etc/default/virtualbox;

    • VBOXAUTOSTART_DB – which defines the absolute path to the autostart database directory, usually the /etc/vbox.
    • VBOXAUTOSTART_CONFIG – defines the path to the virtual machine autostart configuration.

    These variables can be defined as;

    VBOXAUTOSTART_DB=/etc/vbox
    VBOXAUTOSTART_CONFIG=/etc/vbox/autostartvm.cfg
    

    To place these variables in the /etc/default/virtualbox, run the command below;

    echo -e "VBOXAUTOSTART_DB=/etc/vbox\nVBOXAUTOSTART_CONFIG=/etc/vbox/autostartvm.cfg" | sudo tee /etc/default/virtualbox
    

    Define the virtual machine autostart configuration settings. The autostart configuration file contains options that controls how the virtual machine is auto started.

    vim /etc/vbox/autostartvm.cfg
    default_policy = deny
    
    vmuser = {
        allow = true
        startup_delay = 10
    }
    
    • default_policy – defines whether to allow or deny the virtual machine autostart by default. In our example above, we denied any one from auto-starting the VM and explicitly allow one user, amos.
    • username (vmuser) – with the default deny policy, you can define the specific users that are allowed to autostart the virtual machine (allow = true). You can also define how long to delay the VM startup. 10 seconds is used in this demo.

    Set Ownership of Database directory

    The database directory, /etc/vbox, should be writable by the user to be used to start VMs automatically. To make it easy, you can simply add your user to vboxusers group and set the group ownership of the database directory to vboxusers group. After that, set the write permissions for the group. In this case, amos user is to be used to automatically start the virtual machine.

    sudo usermod -aG vboxusers vmuser
    sudo chgrp vboxusers /etc/vbox
    

    Assign the group write permissions on the autostart database directory.

    sudo chmod g+w /etc/vbox
    

    To shield the directory from being modified or deleted by other users except the owner or the root user, set sticky bit.

    sudo chmod +t /etc/vbox
    

    Enable Virtual Machine Autostart

    As a user, you can enable autostart for individual machines. This requires that you define the path to the database directory first.

    VBoxManage setproperty autostartdbpath /etc/vbox/
    

    This step gave the following error:

    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
             available for the current kernel (5.4.17-2102.200.13.el7uek.x86_64) or it failed to
             load. Please recompile the kernel module and install it by
    
             sudo /sbin/vboxconfig
    
             You will not be able to start VMs until this problem is fixed
    

    To fix this error: I simple ran the above command and restarted the OS becuase there is a recompilation of kernel module.

    sudo /sbin/vboxconfig
    systemctl reboot 
    

    Once that is done, you can now setup the virtual machine to automatically start on system boot. At the same time, it has also fixed the problem that I reported.

    vboxmanage modifyvm OracleLinux77 --autostart-enabled on
    

    Where OracleLinux77 is the UUID or the name of your virtual machine.

    Restart vboxautostart-service

    The configuration is now done. To effect the settings, you need to restart the vboxautostart-service.

    sudo systemctl restart vboxautostart-service
    

    Testing the Virtual Machine autostart

    To test that your virtual machine can actually autostart on system boot, reboot you system and check. When system boots, your VM should now be running.

    If you which to disable the virtual machine autostart;

    vboxmanage modifyvm OracleLinux77 --autostart-enabled off
    

    That is all on how to autostart VirtualBox VMs on system boot on Linux and also to fix the crash with Virtual Box. Feel free to drop any comment. Enjoy.

Sign In or Register to comment.