riebl / artery

OMNeT++ V2X simulation framework for ETSI ITS-G5
GNU General Public License v2.0
203 stars 131 forks source link

run into problems while trying `vagrant up` on my Ubuntu 22.04 machine #319

Closed razr closed 8 months ago

razr commented 8 months ago

I run into problems while trying vagrant up on my Ubuntu 22.04 machine.

sudo apt install libvirt-daemon-system vagrant
sudo usermod -aG libvirt

# virtualbox-dkms fails to compile against the latest kernel
sudo apt-get install virtualbox

I need to install virtualbox-7 and then vagrant as

wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update
sudo apt install virtualbox-7.0

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant

After that vagrant up works properly.

razr commented 8 months ago

@riebl I'm wondering why do you always build OMNet++ inside the virtualbox

TASK [omnetpp : download OMNeT++ archive] **************************************
changed: [default]
TASK [omnetpp : create OMNeT++ directory] **************************************
changed: [default]
TASK [omnetpp : extract OMNeT++ archive] ***************************************
changed: [default]
TASK [omnetpp : configure OMNeT++] *********************************************
changed: [default]
TASK [omnetpp : build OMNeT++] *************************************************

Is it not possible to install OMNeT++] binaries instead?

razr commented 8 months ago

It fails on my side with this message

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'debian/contrib-buster64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'debian/contrib-buster64'
    default: URL: https://vagrantcloud.com/api/v2/vagrant/debian/contrib-buster64
==> default: Adding box 'debian/contrib-buster64' (v10.20211018.1) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/debian/boxes/contrib-buster64/versions/10.20211018.1/providers/virtualbox/unknown/vagrant.box
==> default: Successfully added box 'debian/contrib-buster64' (v10.20211018.1) for 'virtualbox'!
==> default: Importing base box 'debian/contrib-buster64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'debian/contrib-buster64' version '10.20211018.1' is up to date...
==> default: Setting the name of the VM: Artery Vagrant VM 11b416c
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 6.1.26
    default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
    default: /vagrant => ~/github/riebl/artery
==> default: Running provisioner: ansible_local...
    default: Installing Ansible...
Vagrant gathered an unknown Ansible version:

and falls back on the compatibility mode '1.8'.

Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode

    default: Running ansible-playbook...

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [default]

TASK [omnetpp : install OMNeT++ dependencies] **********************************

changed: [default]

TASK [omnetpp : check state of /opt/omnetpp] ***********************************
ok: [default]

TASK [omnetpp : delete deprecated /opt/omnetpp directory] **********************
skipping: [default]

TASK [omnetpp : download OMNeT++ archive] **************************************
changed: [default]

TASK [omnetpp : create OMNeT++ directory] **************************************
changed: [default]

TASK [omnetpp : extract OMNeT++ archive] ***************************************
changed: [default]

TASK [omnetpp : configure OMNeT++] *********************************************
changed: [default]

TASK [omnetpp : build OMNeT++] *************************************************

changed: [default]

TASK [omnetpp : create symlink to current OMNeT++ installation] ****************
changed: [default]

TASK [omnetpp : add OMNeT++ binary path to PATH] *******************************
changed: [default]

TASK [artery-workspace : install Artery dependencies] **************************
changed: [default]

TASK [artery-workspace : clone Artery repository] ******************************
changed: [default]

TASK [artery-workspace : add 'origin' remote to upstream repository] ***********
changed: [default]

TASK [artery-workspace : configure refs to fetch for 'origin'] *****************
changed: [default]

TASK [artery-workspace : create Artery build directory] ************************
changed: [default]

TASK [artery-workspace : configure Artery build directory] *********************
fatal: [default]: FAILED! => {"changed": true, "cmd": ["cmake", "/home/vagrant/artery"], "delta": "0:00:02.893767", "end": "2024-02-07 17:21:16.289503", "msg": "non-zero return code", "rc": 1, "start": "2024-02-07 17:21:13.395736", "stderr": "CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):\n  Could NOT find OmnetPP (missing: OMNETPP_INCLUDE_DIR OMNETPP_MSGC\n  OMNETPP_ROOT) (Required is at least version \"5.5.1\")\nCall Stack (most recent call first):\n  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)\n  cmake/FindOmnetPP.cmake:50 (find_package_handle_standard_args)\n  CMakeLists.txt:20 (find_package)", "stderr_lines": ["CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):", "  Could NOT find OmnetPP (missing: OMNETPP_INCLUDE_DIR OMNETPP_MSGC", "  OMNETPP_ROOT) (Required is at least version \"5.5.1\")", "Call Stack (most recent call first):", "  /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)", "  cmake/FindOmnetPP.cmake:50 (find_package_handle_standard_args)", "  CMakeLists.txt:20 (find_package)"], "stdout": "-- The C compiler identification is GNU 8.3.0\n-- The CXX compiler identification is GNU 8.3.0\n-- Check for working C compiler: /usr/bin/cc\n-- Check for working C compiler: /usr/bin/cc -- works\n-- Detecting C compiler ABI info\n-- Detecting C compiler ABI info - done\n-- Detecting C compile features\n-- Detecting C compile features - done\n-- Check for working CXX compiler: /usr/bin/c++\n-- Check for working CXX compiler: /usr/bin/c++ -- works\n-- Detecting CXX compiler ABI info\n-- Detecting CXX compiler ABI info - done\n-- Detecting CXX compile features\n-- Detecting CXX compile features - done\n-- Configuring incomplete, errors occurred!\nSee also \"/home/vagrant/artery-build/CMakeFiles/CMakeOutput.log\".", "stdout_lines": ["-- The C compiler identification is GNU 8.3.0", "-- The CXX compiler identification is GNU 8.3.0", "-- Check for working C compiler: /usr/bin/cc", "-- Check for working C compiler: /usr/bin/cc -- works", "-- Detecting C compiler ABI info", "-- Detecting C compiler ABI info - done", "-- Detecting C compile features", "-- Detecting C compile features - done", "-- Check for working CXX compiler: /usr/bin/c++", "-- Check for working CXX compiler: /usr/bin/c++ -- works", "-- Detecting CXX compiler ABI info", "-- Detecting CXX compiler ABI info - done", "-- Detecting CXX compile features", "-- Detecting CXX compile features - done", "-- Configuring incomplete, errors occurred!", "See also \"/home/vagrant/artery-build/CMakeFiles/CMakeOutput.log\"."]}
    to retry, use: --limit @/vagrant/ansible/vagrant.retry

PLAY RECAP *********************************************************************
default                    : ok=15   changed=13   unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
riebl commented 8 months ago

Is it not possible to install OMNeT++] binaries instead?

I am not aware of any packaged OMNeT++ binaries.

It fails on my side with this message

Confirmed. I suppose an Ansible update changed the propagation of PATH which has worked before. I have just pushed a fix to master.

razr commented 8 months ago

Thanks for looking into it.

I am not aware of any packaged OMNeT++ binaries.

I thought maybe it is possible to compile the OMNeT++ release once e.g. with GH actions, save it as an artifact, and then just install it with Ansible.

riebl commented 8 months ago

This approach would be feasible. I am not sure if Artery should be in charge of providing OMNeT++ binaries, though. Also, I don't have the time at the moment to dig deeper into this topic.

razr commented 8 months ago

thanks @riebl, I can confirm that the Artery build works properly now. make run_example starts OMNet++ GUI. However the VM was still in the 800x600 mode and even though I have installed Guest Additions, the service didn't not start properly.

udo systemctl status virtualbox-guest-utils.service 
● virtualbox-guest-utils.service - Virtualbox guest utils
   Loaded: loaded (/lib/systemd/system/virtualbox-guest-utils.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2024-02-08 11:13:56 UTC; 12min ago
  Process: 1429 ExecStart=/etc/init.d/virtualbox-guest-utils start (code=exited, status=1/FAILURE)

Feb 08 11:13:56 buster systemd[1]: Starting Virtualbox guest utils...
Feb 08 11:13:56 buster virtualbox-guest-utils[1429]: Starting VirtualBox AdditionsNo suitable module for running kernel found ... failed!
Feb 08 11:13:56 buster virtualbox-guest-utils[1429]:  failed!
Feb 08 11:13:56 buster systemd[1]: virtualbox-guest-utils.service: Control process exited, code=exited, status=1/FAILURE
Feb 08 11:13:56 buster systemd[1]: virtualbox-guest-utils.service: Failed with result 'exit-code'.
Feb 08 11:13:56 buster systemd[1]: Failed to start Virtualbox guest utils.

I need to update Linux headers and rerun the Guest install script

sudo apt-get install linux-headers-$(uname -r)
cd /media/vagrant/VBox_GAs_7.0.14/
sudo ./VBoxLinuxAdditions.run

My working setup is:

vagrant@buster:~$ uname -a Linux buster 4.19.0-26-amd64 #1 SMP Debian 4.19.304-1 (2024-01-09) x86_64 GNU/Linux

VBox_GAs_7.0.14


- Host

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy

virtualbox --help Oracle VM VirtualBox VM Selector v7.0.14

vagrant --version Vagrant 2.4.1