Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build from code and run is not working in a VM with kernel version 5.xxx-generic IF hypervisor (host) has a bigger kernel version like 6.xxx-generic #656

Open
denerkr opened this issue Apr 28, 2024 · 16 comments
Labels
bug Something isn't working

Comments

@denerkr
Copy link

denerkr commented Apr 28, 2024

I'm following the tutorial here https://loxilb-io.github.io/loxilbdocs/run/, but I had no success to install the loxilb returning the error bellow:
Screenshot from 2024-04-28 20-49-46

@denerkr denerkr added the bug Something isn't working label Apr 28, 2024
UltraInstinct14 added a commit that referenced this issue Apr 29, 2024
gh-656 - Build and parser fixes with clang-14
@TrekkieCoder
Copy link
Collaborator

TrekkieCoder commented Apr 29, 2024

The issue is fixed. Please try the following -

cd loxilb-ebpf/
git pull origin main
cd ..
git pull
make

Further if you want to run loxilb in the same build system, you would need to install loxilb loader tools as follows -

curl -sfL https://github.com/loxilb-io/tools/raw/main/loader/install.sh | sh -

@TrekkieCoder
Copy link
Collaborator

Meanwhile, we also added support for Ubuntu 24.04 build environment as well. Feel free to have a look.

@vincentmli
Copy link

Meanwhile, we also added support for Ubuntu 24.04 build environment as well. Feel free to have a look.

@TrekkieCoder
does Ubuntu 24.04 ships libbpf > 1 version? looks loxilb-ebpf still depends on libbpf 0.8, I could build loxilb but it fails to run because my OS has libbpf > 1

[root@bpfire-3 lib]# /tmp/loxilb 
loxilb start
/tmp/loxilb: symbol lookup error: /tmp/loxilb: undefined symbol: bpf_get_link_xdp_id, version LIBBPF_0.0.2

I think bpf_get_link_xdp_id is deprecated in libbpf > 1 if I recall correct.

@TrekkieCoder
Copy link
Collaborator

Yes currently loxilb depends on libbpf 0.8. But currently you can -

cd loxilb-ebpf/libbpf/src
sudo make install

It will install libbpf 0.8 but it might overwrite other libbpf versions already installed. We will statically link libbpf dependency in future. bpf_get_link_xdp_id is deprecated even in 0.8 but porting to newer versions of libbpf is a work in progress.

@vincentmli
Copy link

Thanks! I can't install libbpf 0.8 because my other bpf program depending on libbpf > 1. look forward to have static link or porting to newer libbpf version

UltraInstinct14 added a commit that referenced this issue May 1, 2024
gh-656 - Build tweaked to include static libbpf
@UltraInstinct14
Copy link
Contributor

#660 enables static linking. Closing this as completed.

@denerkr
Copy link
Author

denerkr commented May 1, 2024

Hi @TrekkieCoder, The first part of the installation passed but still with some erros and It's not working the "sudo cp api/certification/server.* /opt/loxilb/cert/" saying "No such file or directory" and "sudo ./loxilb" part on tutorial for next steps:

What I did:

  1. Created a new VM with ubuntu server from scratch and update/upgrade it;
  2. Install latest go version on it;
  3. Followed again the tutorial here: https://loxilb-io.github.io/loxilbdocs/run/ from the part "Install standard packages";
  4. See bellow all the commands I did and the OUTPUT:

OUTPUT_loxilb_instalation.log

@TrekkieCoder TrekkieCoder reopened this May 1, 2024
@TrekkieCoder
Copy link
Collaborator

I think this step got missed -

curl -sfL https://github.com/loxilb-io/tools/raw/main/loader/install.sh | sh -

@denerkr
Copy link
Author

denerkr commented May 1, 2024

@TrekkieCoder, It still didn't solve the problem. Bellow are the steps I did:

  1. Executed the command "curl -sfL https://github.com/loxilb-io/tools/raw/main/loader/install.sh | sh -" and it seems that worked, but please check bellow the output because it contain some erros:
    OUTPUT_curl_loxilb-io.log

  2. performed the commands:

  3. cd loxilb

  4. ./loxilb-ebpf/utils/mkllb_bpffs.sh

  5. make

  6. cd loxilb-ebpf/libbpf/src

  7. sudo make install

  8. cd -

  9. sudo mkdir -p /opt/loxilb/cert/

  10. sudo cp api/certification/server.* /opt/loxilb/cert/ (Returning errors)

  11. sudo ./loxilb (Returning errors)

See bellow output for the commands from step 2:
OUTPUT_loxilb_instalation_after_curl.log

@TrekkieCoder
Copy link
Collaborator

TrekkieCoder commented May 1, 2024

Thanks for the logs. I too spawned a new host (x86-64), installed Ubuntu 22.04.4 Kernel 6.5.0-28. Roughly followed the steps as per this link which is almost same as you did. It ran just fine.

sudo apt-get update && sudo apt-get install git 
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz && sudo tar -xzf go1.22.0.linux-amd64.tar.gz --directory /usr/local/
export PATH="${PATH}:/usr/local/go/bin"
sudo apt install -y clang llvm libelf-dev gcc-multilib libpcap-dev vim net-tools linux-tools-$(uname -r) elfutils dwarves git libbsd-dev bridge-utils wget unzip build-essential bison flex iproute2
sudo apt-get install -y curl
curl -sfL https://github.com/loxilb-io/tools/raw/main/loader/install.sh | sh -
git clone --recurse-submodules https://github.com/loxilb-io/loxilb.git
cd loxilb
./loxilb-ebpf/utils/mkllb_bpffs.sh
make
sudo ./loxilb

Attaching logs -
loxilb-new-u22.log

Finally, I ran latest loxilb docker in the same box. That also went fine.

$ sudo docker run -u root --cap-add SYS_ADMIN   --restart unless-stopped --privileged -dit -v /dev/log:/dev/log --name loxilb ghcr.io/loxilb-io/loxilb:latest
$ sudo docker ps
CONTAINER ID   IMAGE                             COMMAND                  CREATED              STATUS              PORTS                            NAMES
faddd7c80632   ghcr.io/loxilb-io/loxilb:latest   "/root/loxilb-io/lox…"   About a minute ago   Up About a minute   3784/tcp, 11111/tcp, 22222/tcp   loxilb

Further, loxilb build/run is validated in ubuntu22.04 among others as well. Please check logs here

Kind of perplexed why it is not working for you.

@denerkr
Copy link
Author

denerkr commented May 1, 2024

Hi @TrekkieCoder, I don't know but I tried here again and the command "sudo ./loxilb" fails. Can you provide more information about the VM setup you did? because I'm using here the VirtualBox (Version 7.0.10 r158379 (Qt5.15.3)) and my VM has 4 processors, 6gb of memory... bellow screenshot has full details about my VM:
Screenshot from 2024-05-01 13-45-34

I'm supposing it's an inconpatibility with virtualbox, what do you think?

@TrekkieCoder
Copy link
Collaborator

I have tried in VirtualBox 6.1.50_Ubuntu r161033 (Qt5.12.8) and resources assigned seem good enough. My hypervisor (base system) is however Ubuntu 20.04.

image

Can you please double confirm your system's kernel version (uname -a) and clang version (clang -v) ?

@denerkr
Copy link
Author

denerkr commented May 2, 2024

Hi @TrekkieCoder, my hypervisor (base system) is Ubuntu 22.04, and kernel version 6.5.0-28-generic without clang:

Screenshot from 2024-05-02 08-07-31

My VM on virtual box has kernel version 5.15.0-105-generic and clang version 14.0.0-1ubuntu1.1:

Screenshot from 2024-05-02 08-16-04

@TrekkieCoder
Copy link
Collaborator

TrekkieCoder commented May 2, 2024

I tried the exact same configuration as yours but could not replicate your error:
Screenshot 2024-05-02 at 10 29 28 PM

It would be great if we are able to solve your issue. If it is fine with you, please join loxilb slack channel. We can discuss this further.

@denerkr
Copy link
Author

denerkr commented May 3, 2024

Hi @TrekkieCoder, I find out that my issue is related the kernel version. So, IF the hypervisor (base system) has a kernel version 6.5.0-28-generic and the VM a lower kernel version like it was 5.15.0-105-generic the loxilb won't work.

What I did here to make it working now was that I first tried directly on my computer with kernel version 6.5.0-28-generic and worked/is working perfectly.
Screenshot from 2024-05-02 22-47-26

After that I created a new VM with ubuntu 24.04 that has the kernel version 6.8.0-31-generic and boom it worked as well:
Screenshot from 2024-05-02 22-52-37

For me it seems that the bug here is "loxilb do not work in a VM with lower kernel version then the hypervisor".

@denerkr denerkr changed the title Build from code and run is not working on Ubuntu Server 22.04 Build from code and run is not working in a VM with kernel version 5.xxx-generic IF hypervisor (host) has a bigger kernel version like 6.xxx-generic May 3, 2024
@TrekkieCoder
Copy link
Collaborator

Thanks for digging into this. Will try to check how interaction between hypervisor host and VM is affecting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants