docs
docs copied to clipboard
Create a folder with common mistakes for beginners
In this folder we will include common mistakes and missconceptions about the way we use Unikraft/kraft and try to also offer some solutions to them.
Signed-off-by: Andrei Mutu [email protected]
I'm adding here draft items to add to the PR:
-
The
socat
issue appearing on Ubuntu 20.04. The solution is to install a newer version, either as a Debian package or from source. Instructions that we tested to work for source-based installation:$ wget http://www.dest-unreach.org/socat/download/socat-1.7.4.4.tar.gz $ tar xzf socat-1.7.4.4.tar.gz $ cd socat-1.7.4.4/ $ ./configure $ make $ sudo make install
-
ARM64 compilation fails for GCC >= 10. It errors on the absence of
__getauxval
:/usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: warning: -z relro ignored OBJCOPY helloworld_kvm-arm64.o LD helloworld_kvm-arm64.dbg /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: warning: -z relro ignored /usr/lib/gcc-cross/aarch64-linux-gnu/11/../../../../aarch64-linux-gnu/bin/ld: /home/mohamed/Desktop/Code/OS/apps/helloworld/build/helloworld_kvm-arm64.o: in function init_have_lse_atomics': lse-init.o:(.text.startup+0xbc): undefined reference to __getauxval' lse-init.o:(.text.startup+0xbc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol __getauxval' collect2: error: ld returned 1 exit status make[3]: [/home/mohamed/.unikraft/unikraft/plat/kvm/Linker.uk:24: /home/mohamed/Desktop/Code/OS/apps/helloworld/build/helloworld_kvm-arm64.dbg] Error 1 make[2]: [Makefile:984: sub-make] Error 2 make[1]: [Makefile:32: _all] Error 2 make[1]: Leaving directory '/home/mohamed/.unikraft/unikraft' make: [Makefile:6: all] Error 2`
The solution is to use GCC <= 9.
-
If you don't have KVM enable, kraft won't run. There is no option to run
kraft
and disable KVM. If that is the case you need to run manually usingqemu-system-x86_64
(without the-enable-kvm
) option, or usingqemu-guest
.Could not access KVM kernel module: No such file or directory qemu-system-x86_64: failed to initialize kvm: No such file or directory
Check with:
lsmod | grep kvm
Check virtualization availability:
lscpu | grep '\(vmx\|svm\)'
-
build/uk-gdb.py
has to be run inside GDB, not on the shell:root@d81c14b42759:/workdir/apps/helloworld# source build/uk-gdb.py bash: import: command not found bash: import: command not found bash: import: command not found bash: import: command not found bash: scripts_dir: command not found bash: build/uk-gdb.py: line 39: syntax error near unexpected token `scripts_dir' bash: build/uk-gdb.py: line 39: `sys.path.append(scripts_dir)' root@d81c14b42759:/workdir/apps/helloworld#
-
kraft list update
fails. You need to create a personal access token withpublic_repo
only. And useUK_KRAFT_GITHUB_TOKEN=TODO kraft list update
(replaceTODO
with developer token). -
qemu-system-x86_64: -gdb tcp:🔢 Failed to find an available port: Address already in use
- You have another QEMU instance started somewhere. Close it. You could also usesudo pkill -f qemu
(be careful when using it, it will terminate all QEMU processes). -
You need a large enough screen for
make menuconfig
orkraft menuconfig
. Make your terminal screen larger if you get the error below:make[1]: Entering directory '/home/mohamed/.unikraft/unikraft' Your display is too small to run Menuconfig! It must be at least 19 lines by 80 columns. make[3]: *** [/home/mohamed/Desktop/Code/OS/apps/helloworld/build/Makefile:834: menuconfig] Error 1 make[2]: *** [Makefile:984: sub-make] Error 2 make[1]: *** [Makefile:32: _all] Error 2 make[1]: Leaving directory '/home/mohamed/.unikraft/unikraft' make: *** [Makefile:9: menuconfig] Error 2
-
Do a
make clean
orkraft clean
before building Unikraft on a different architecture. Otherwise, you get the error:TODO
-
Run
./.._kvm-x86_kvm
- you can't run a KVM / QEMU image like an executable. -
Run
qemu-system-x86_64 ...kvm-aarch64
- you can't runqemu-system-x86_64
on anaarch64
image. You need to runqemu-system-aarch64
. -
Run GDB on another image.
-
Start for debugging but use the basic image, not the
.dbg
image. -
Run
qemu-system-aarch64
but omitting-machine
and-cpu
. -
Use
-cpu host
to remove warning. -
qemu: could not open kernel file
./build/app-helloworld_kvm-x86_64: Make sure the built image is indeed named
app-helloworld_kvm-x86-64by running
ls build/in your terminal. It may be named only
helloworld_kvm-x86_64`. Or you may have omitted to build it. -
Omitting to use
UK_WORK_DIR
for a customkraft
environment. -
Omitting the update of the
LIBS
variable in theMakefile
. -
Omitting the clone of a library file in
libs/
in a customkraft environment
. -
Unikraft core repository or library repository is on
staging
(or the proper branch). Dogit status path/to/repository
. -
Building for ARM64 fails:
make[1]: Entering directory '/home/parallels/kraft_workdir/unikraft' /bin/bash: line 1: aarch64-linux-gnu-gcc: command not found /bin/bash: line 1: [: -gt: unary operator expected /bin/bash: line 1: [: -eq: unary operator expected /home/parallels/kraft_workdir/unikraft/arch/arm/arm64/Makefile.uk:77: *** Require GCC version >= 4.9 found .. Stop. make[2]: *** [Makefile:1016: sub-make] Error 2 make[1]: *** [Makefile:32: _all] Error 2 make[1]: Leaving directory '/home/parallels/kraft_workdir/unikraft' make: *** [Makefile:6: all] Error 2
You have to install the cross-compile toolchain for
aarch64
. TODO: instructions. -
kraft
is installed for the current user and~/.local/bin
is not part ofPATH
. -
Issues with library ordering in
Makefile
.
Superseded by #391