Virtualbox VDE Network - virtualbox

i am programming a GUI-Tool to test some Meshnetworkingthings.
To do so i use Virtualbox, VDE2 and Wirefilter. My attempt is to generate n openwrt instances with Virtualbox, connect them with vde_switch in tap mode and simulate pocketloss etc. with wirefilter.
Here's what im trying to this point:
sudo ip tuntap add tap<i> mode tap
sudo ifconfig tap<i> <some ip> up
vde_switch -d -x -s /tmp/tap<i>/ -m 666
VBoxManage clonevm openwrt --name tap<i> --register
VBoxManage modifyvm tap<i> --nic1 generic --nicgenericdrv1 VDE --nicproperty1 network=/tmp/tap<i>/ --macaddress1 <mac>
VBoxManage startvm tap<i>
But i get the following error when i try to run a openwork instance:
Failed to open a session for the virtual machine tap.
VDEplug library: not found (VERR_PDM_HIF_OPEN_FAILED).
Failed to attach the network LUN (VERR_PDM_HIF_OPEN_FAILED).
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: Console
Interface: IConsole {8ab7c520-2442-4b66-8d74-4ff1e195d2b6}
Development Environment:
I am using a MacBook Pro, where Ubuntu 14.04 runs in Virtualbox. In this Ubuntu i am developing my tool. That means i am running Virtualbox in Virtualbox.

I Solved it. First what to do:
copy libvdeplug.so.2 to libvdeplug.so
cp /usr/lib/libvdeplug.so.2 /usr/lib/libvdeplug.so
Then i forgot something in the vde_switch call:
vde_switch -d -x -s /tmp/tap<i>/ -m 666
has to be
vde_switch -d -x -s /tmp/tap<i>/ -m 666 --tap tap<i>

Related

Can't get CloudWatchAgent to start on Ubuntu18.04 in Docker build for AWS Batch job

I'm trying build an image for use on EC2 instances in an AWS Batch job. I need to use Ubuntu 18.04 because the goal is to run some Fortran software that I can only get to compile on Ubuntu 18.04. I have the Fortran software and some python scripts running well on a manually started Ubuntu 18.04 EC2 instance.
Now, I'm trying to build an image with Docker (that I'll eventually apply to 100s or 1000s of EC2 instances)... but I have to get CloudWatchAgent (CWA) installed and started, and I can't get CWA to start in the Docker build. CWA starts and runs fine in my manual EC2 development instance (Ubuntu 18.04). I initially had problems with CWA in my manual instance because CWA uses systemctl, and so I had to manually install systemd, and that worked after a reboot. But, I'm not able to replicate this in my Docker build, but always get the error:
System has not been booted with systemd as init system (PID 1). Can't operate.
unknown init system
The command '/bin/sh -c sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:amazon-cloudwatch-agent.json' returned a non-zero code: 1
I tried starting with an ubuntu 18.04 image that is supposed to have systemd already installed, and tried rebooting my EC2 instance, same error. Here's the source: https://hub.docker.com/r/jrei/systemd-ubuntu
I looked for other ideas, e.g.: Docker System has not been booted with systemd as init system
... but couldn't figure out how to make it work in a Docker build.
So,
am I using the Ubuntu 18.04 image (that has systemd) in my build wrong- how to use in a Docker build?
is there another way to start CloudWatchAgent in Ubuntu 18.04 that gets around the systemd problem?
would it work/is there a way to restart the operating system inside the Docker container, during the docker build stage?
am I stuck and will have to try recompile everything on a different Ubuntu or AMI like Amazon Linux?
Or is there something else I'm missing?
Here's my Docker file:
#version with systemd already installed
FROM jrei/systemd-ubuntu#sha256:1b65424e0ec4f6772576b55c49e1470ba506504d1033e9da5795785b1d6a4d88 as ubuntu-base
RUN apt-get update && apt-get install -y \
sudo \
wget \
python3-pip
RUN sudo apt-get -y install libgfortran3
RUN sudo pip3 install boto3
RUN wget https://s3.us-east-2.amazonaws.com/amazoncloudwatch-agent-us-east-2/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
RUN sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
COPY . .
RUN cp amazon-cloudwatch-agent.json /opt/aws/amazon-cloudwatch-agent/etc/
ENV ECS_AVAILABLE_LOGGING_DRIVERS = awslogs
RUN sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -s -c file:amazon-cloudwatch-agent.json
RUN mkdir -p cpseqlogs
CMD python3 cpsequence.py
Thanks for any suggestions, ideas, or tips (I'm fairly new to Docker, but not totally green on linux).

How to configure SAM CLI to use remote docker

My host operating system is windows 10 and I have installed ubuntu 20.04 focal with the help of WSL2.
My goal is to debug sam application without using Docker Desktop
I have installed docker daemon on the Ubuntu Linux distro with the help of the link below.
How to run docker on windows without using docker desktop
Now I want to debug the sam application that I have developed on my local machine and I want to use dockerd installed on ubuntu.
To launch docked on ubuntu, I use the following command.
sudo dockerd -H `ifconfig eth0 | grep -E "([0-9]{1,3}.){3}[0-9]{1,3}" | grep -v 127.0.0.1 | awk '{ print $2 }' | cut -f2 -d:`
As result, I will get the IP address to interact with dockerd
INFO[2021-12-31T10:31:12.959579412+05:30] API listen on 172.17.52.120:2375
For CLI, I am using Docker CLI
To test whether dockerd is working or not, I use the following command
docker -H 172.20.5.64 run --rm hello-world
How can I tell sam cli to use the dockerd running inside ubuntu while invoking sam local invoke command?

Install Label Studio in Google Cloud and make it available with the public IP

I have a VM instance in Google Cloud with Ubuntu 20.04 LTS, I set it to allow HTTP traffic.
I need to setup Label Studio (https://github.com/heartexlabs/label-studio) in this VM so anyone can access it by just typing the VM public IP.
I already tried building it with docker:
sudo docker build -t heartexlabs/label-studio:latest .
But when i run it with:
sudo docker run -d -p 80:80 heartexlabs/label-studio:latest
It doesn't work, wheres the output of the container list
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e728edbe6d5 heartexlabs/label-studio:latest "./tools/run.sh" About a minute ago Up About a minute 0.0.0.0:80->80/tcp, 8080/tcp gracious_shamir
I also tried to install it with pip and run it with:
label-studio start --host 34.66.116.52 --port 80 testproject
If anyone has experience with Google Cloud VM and can help set this up with docker or with a WSGI server I'd appreciate it
Try this:
sudo docker run --rm -d -p 80:8080 -v `pwd`/my_project:/label-studio/my_project --name label-studio heartexlabs/label-studio:latest label-studio start my_project --init
I was able to access it from External IP with this.

Unable to start VM - Minikube

I am trying to start the minikube using the minikube start command and this is the error i am getting. Even installed the latest version of virtual box but still it gives me this error.
Can someone please tell me why this is happening?
Follow the advice of the error message. Did you try installing virtualbox-dkms and the linux headers?
$ sudo apt update
$ sudo apt install virtualbox-dkms linux-headers-generic
Follow the instructions in the docs, if you aren't already: https://kubernetes.io/docs/tasks/tools/install-minikube/
First of all I would recomend you to install newest version of Minikbue (currently it is 1.5.2) and Kubectl.
Second thing check if your machine is supporting virtualization. It can bo done via command egrep -q 'vmx|svm' /proc/cpuinfo && echo yes || echo no.
If it is no you have to:
If you are running within a VM, your hypervisor does not allow nested virtualization. You will need to use the None (bare-metal) driver.
If you are running on a physical machine, ensure that your BIOS has hardware virtualization enabled.
Minikube set VirtualBox as default driver, but you can use other. Here under Hypervisor Setup you might find that you can also use KVM or None as driver for Linux OS.
Solutions:
1. As Minikube output advised, try to install
- $ sudo apt-get install virtualbox-dkms linux-headers-generic
- run $ sudo modprobe vboxdrv
- reinstall VirtualBox
2. If there is no virtualization option on your Laptop you can use Minikube with --vm-driver=none flag.
$ sudo minikube start --vm-driver=none
If you would use this option, you might need to specify --cpus=X and --memory=XXXX as default is requesting less resources.
Another think is that none driver provides limited isolation and may reduce system security and reliability. More info can be found here.
$ minikube start
๐Ÿ˜„ minikube v1.5.2 on Ubuntu 18.04
๐Ÿ”ฅ Creating virtualbox VM (CPUs=2, Memory=2000MB, Disk=20000MB)
...
$ sudo minikube start --vm-driver=none
๐Ÿ˜„ minikube v1.5.2 on Ubuntu 18.04
๐Ÿคน Running on localhost (CPUs=2, Memory=7470MB, Disk=9749MB) ...
After successfull installation, don't forget to execute mentioned commands.
โ–ช sudo mv /home/<your_user>/.kube /home/<your_user>/.minikube $HOME
โ–ช sudo chown -R $USER $HOME/.kube $HOME/.minikube

Creating Selenium network run via docker for firefox node in AWS

I am trying to run a docker image (E.g: webwhatsapi) over Selenium network.
I followed below commands:
docker network create selenium
docker run -d -p 4444:4444 -p 5900:5900 --name firefox --network selenium -v /dev/shm:/dev/shm selenium/standalone-firefox-debug
docker build -t webwhatsapi .
docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py"
On AWS, I have following configuration in security group.
I am trying to open the http://{public ip}:4444 in firefox browser. It shows error. (This site can't be reached). I think, I should change my last command in a way which makes it work in browser url.
Last command:
docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py"
Please let me know, where am I going wrong ?