Openvswitch(ovs) build issues on aarch64

hi,
for a specific need, I try to install ovs_2.13.0 on openwrt.21-stable, however this version of ovs is not placed on packages. so I try to buil it from source, but dependcies need to be installed first ans I even stuck at building dependcies due to they are not in the package list also.
anyway my question is, is there any other way to achieve installing ovs.2.13.0 without building every packet from scratch. Im not an software-eng/coder/scripter..
thanks.

Is there a reason why you want an earlier version?

I just built it on aarch64 on OpenWrt master. What dependencies are you missing on OpenWrt 21?

hello VA1DER,
there will be a SDN controller that support specific ovs release as 2.13.0.
unfourtanetly, I need to built it on openwrt machine. I dont try to build an image with ovs2.13.0, but I want to try. but this is not my case.

by the way, Im getting following lines inluding errors.
thanks.

root@OpenWrt-21:/openvswitch-2.13.0# make
sed -f ./build-aux/extract-odp-netlink-h < datapath/linux/compat/include/linux/openvswitch.h > include/odp-netlink.h
sh -f ./build-aux/extract-odp-netlink-macros-h include/odp-netlink.h > include/odp-netlink-macros.h
tail: write error: Broken pipe
tail: write error: Broken pipe
tail: write error: Broken pipe
tail: write error: Broken pipe
tail: write error: Broken pipe
tail: write error: Broken pipe
PYTHONPATH=./python":"$PYTHONPATH PYTHONDONTWRITEBYTECODE=yes /usr/bin/python3 ./ovsdb/ovsdb-idlc.in annotate ./vswitchd/vswitch.ovsschema ./lib/vswitch-idl.ann > lib/vswitch-idl.ovsidl.tmp && mv lib/vswitch-idl.ovsidl.tmp lib/vswitch-idl.ovsidl
.
.
.
make  all-recursive
make[1]: Entering directory '/openvswitch-2.13.0'
Making all in datapath
make[2]: Entering directory '/openvswitch-2.13.0/datapath'
/bin/sh: rev: not found
/bin/sh: rev: not found
cut: standard output: Broken pipe
make[3]: Entering directory '/openvswitch-2.13.0/datapath'
/bin/sh: rev: not found
/bin/sh: rev: not found
cut: standard output: Broken pipe
make[3]: Leaving directory '/openvswitch-2.13.0/datapath'
make[2]: Leaving directory '/openvswitch-2.13.0/datapath'
make[2]: Entering directory '/openvswitch-2.13.0'

EDIT: The following only addresses the later issue. The earlier write error, I don't know. I suspect it's likely another missing tool. I would suggest you look at the link in option three below to the wiki page I wrote, and follow its instructions for setting up your device to build OpenWrt on - specifically on installing all the coreutils and other build tools.

Oh, yes, rev is a util-linux tool that OpenWrt is missing. You can do one of three things:

  1. Use a pre-built rev binary:
    https://va1der.ca/~public/openwrt/bin/aarch64/rev

  2. Build the rev tool, which is one of the tools in util-linux, inside OpenWrt - inside your devel folder do the following (you might need xz and full version of tar for this)
    The patch is just a quick and dirty one to allow you to disable all the other utils and enable only rev (the configure for util-linux doesn't otherwise let you enable rev by itself)

wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.tar.xz
tar -xaf util-linux-2.39.tar.xz
cd util-linux-2.39
wget -O - -o /dev/null https://va1der.ca/~public/openwrt/patches/util-linux/util_linux_enable_rev.patch | patch -p0
./configure --prefix=/usr --without-systemd --without-btrfs --without-econf --without-util --without-tinfo --disable-all-programs
make rev
  1. Follow these instructions for building OpenWrt ON OpenWrt, which builds rev as part of that procedure.

Thanks Mr Fitzner,
Your response was very informative, and I was able to successfully build and install "rev" by the steps you provided. Thank you very much for your assistance. You've been incredibly helpful.
rev is now a commad on my OpenWRT machine. :partying_face:
to install rev, I follow your instructions, these are my commands that I applied:

opkg update
opkg install pkg-config make gcc diffutils autoconf automake check git git-http patch libtool-bin
opkg install grep rsync tar python3 getopt procps-ng-ps gawk sed xz unzip gzip bzip2 flock wget-ssl
opkg install perl perlbase-findbin perlbase-pod perlbase-storable perlbase-feature perlbase-b perlbase-ipc perlbase-module perlbase-extutils python3 
opkg install coreutils-nohup coreutils-install coreutils-sort coreutils-ls coreutils-realpath coreutils-stat coreutils-nproc coreutils-od coreutils-mkdir coreutils-date coreutils-comm coreutils-printf coreutils-ln coreutils-cp coreutils-split coreutils-csplit coreutils-cksum coreutils-expr coreutils-tr coreutils-test coreutils-uniq coreutils-join
opkg install libncurses-dev zlib-dev musl-fts libzstd 
ln -s libncursesw.a /usr/lib/libncurses.a
opkg install joe joe-extras bash htop whereis less file findutils findutils-locate chattr lsattr xxd
chmod +x /usr/share/automake-1.16;chmod -x /usr/share/automake-1.16/COPYING /usr/share/automake-1.16/INSTALL 
chmod +x /usr/share/autoconf/Autom4te/* 
chmod +x /usr/share/libtool/build-aux/* 
wget https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.39/util-linux-2.39.tar.xz
unxz util-linux-2.39.tar.xz
tar -xaf util-linux-2.39.tar
cd util-linux-2.39
wget -O - -o /dev/null https://va1der.ca/~public/openwrt/patches/util-linux/util_linux_enable_rev.patch | patch -p0
./configure --prefix=/usr --without-systemd --without-btrfs --without-econf --without-util --without-tinfo --disable-all-programs
make rev
make install

Additionally, I attempted to configure/make/make-install once more and carefully inspected the outputs of these commands. As a beginner, I didn't observe any errors, but unfortunately, I'm still unable to access the ovs commands, :disappointed:.

So you compiled ovs and it seemed to install, but you can't access it?

When you ran the configure script for ovs, did you tell it to use /usr as the prefix? Most GNU configure scripts will pick /usr/local as the default installation directory, and I don't think /usr/local/bin is in the search path on OpenWrt normally.

Try going back to the openvswitch-2.13.0 directory and performing:
make uninstall
configure --prefix=/usr
make clean
make -j $(nproc)
make install

The first make uninstall is to remove the earlier installation, assuming it was installed to /usr/local/. Then the rest is just reconfiguring it for /usr, rebuilding, and reinstalling. After that, all the ovs commands should be available.

Great!
Mr. Fitzner, thank you so much. I really appreciate your help! :partying_face:
I applied the solution you provided, and it worked!!!
Now I have access to all the ovs commands:

root@qemuOpnWRT:/# ovs
ovs-appctl
ovs-bugtool
ovs-bugtool-daemons-ver
ovs-bugtool-fdb-show
ovs-bugtool-get-dpdk-nic-numa
ovs-bugtool-get-port-stats
ovs-bugtool-ovs-appctl-dpif
ovs-bugtool-ovs-bridge-datapath-type
ovs-bugtool-ovs-ofctl-loop-over-bridges
ovs-bugtool-ovs-vswitchd-threads-affinity
ovs-bugtool-qos-configs
ovs-bugtool-tc-class-show
ovs-check-dead-ifs
ovs-ctl
ovs-docker
ovs-dpctl
ovs-dpctl-top
ovs-kmod-ctl
ovs-l3ping
ovs-lib
ovs-monitor-ipsec
ovs-ofctl
ovs-parse-backtrace
ovs-pcap
ovs-pki
ovs-save
ovs-tcpdump
ovs-tcpundump
ovs-test
ovs-testcontroller
ovs-vlan-test
ovs-vsctl
ovs-vswitchd
ovs-vtep
ovsdb-client
ovsdb-server
ovsdb-tool

Now, I'm going to locate the openvswitch module as requested to start it. :slight_smile:

root@qemuOpnWRT:/# ovs-ctl start
/usr/etc/openvswitch/conf.db does not exist ... (warning).
Creating empty database /usr/etc/openvswitch/conf.db.
Starting ovsdb-server.
system ID not configured, please use --system-id ... failed!
Configuring Open vSwitch system IDs.
failed to find a module named openvswitch
Inserting openvswitch module ... failed!

First of all, I see I made a little mistake with your configure, though that's not likely causing your problem. I didn't notice that the configure script is a little dated and that it uses the prefix for etc. Right now it's looking for your configuration in /usr/etc. So let's fix that - you'll have to reinstall again, sorry. Switch to the devel folder and:

make uninstall
./configure --prefix=/usr --sysconfdir=/etc --sharedstatedir=/var
make clean
make -j $(nproc)
make install

As for your problem, it looks like you don't have the kernel module installed. I'd suggest trying to use the one included with OpenWrt first:
opkg install kmod-openvswitch

If that doesn't work for you, then you'll have to build the kernel module too, which will be more complicated.

Dear Mr. Fitzner,

I would like to express my sincere gratitude to you for your assistance. I am truly grateful for your help. I have made progress and was able to run version OVS 2.13.0 on openwrt 21. All of this was made possible with the support you provided.

Here is the specification of my system for reference, in case anyone else requires any information:

root@qemuOpnWRT:/# uname -a
Linux qemuOpnWRT 5.4.238 #0 SMP Mon Apr 17 13:15:36 2023 aarch64 GNU/Linux
root@qemuOpnWRT:/# 

root@qemuOpnWRT:/# cat /etc/os-release 
NAME="OpenWrt"
VERSION="21.02.7"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 21.02.7"
VERSION_ID="21.02.7"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r16847-f8282da11e"
OPENWRT_BOARD="armvirt/64"
OPENWRT_ARCH="aarch64_cortex-a53"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 21.02.7 r16847-f8282da11e"
root@qemuOpnWRT:/#

root@qemuOpnWRT:/# ovs-ctl --version
/usr/share/openvswitch/scripts/ovs-ctl (Open vSwitch) 2.13.0
root@qemuOpnWRT:/# 
root@qemuOpnWRT:/# ovs-vsctl --version
ovs-vsctl (Open vSwitch) 2.13.0
DB Schema 8.2.0
root@qemuOpnWRT:/#

Thank you very much.

You’re very welcome! :slight_smile:

If your issue is resolved, you might want to consider marking this topic solved.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.