Forum Stats

  • 3,722,431 Users
  • 2,244,307 Discussions
  • 7,849,830 Comments

Discussions

Howdy, Stranger!

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

Oracle's Virtual Box crashes with bridged network adapter on Oracle Linux 7.9

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!!!

Tagged:

Best Answers

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon
    Accepted Answer

    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.

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon
    Accepted Answer

    I believe a simpler solution might be:

    Install and recompile the kernel module. Followed by a system reboot to get the kernel loaded.

    sudo /sbin/vboxconfig
    systemctl reboot 
    


Answers

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon
    edited March 19

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

    https://www.dedoimedo.com/computers/virtualbox-bridged-networking-problem.html

    This solution is not ideal. Inviting more troubles.

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon
    Accepted Answer

    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.

  • Vijaya Ambati
    Vijaya Ambati Member Posts: 9 Green Ribbon
    Accepted Answer

    I believe a simpler solution might be:

    Install and recompile the kernel module. Followed by a system reboot to get the kernel loaded.

    sudo /sbin/vboxconfig
    systemctl reboot 
    


Sign In or Register to comment.