docs icon indicating copy to clipboard operation
docs copied to clipboard

Create a folder with common mistakes for beginners

Open mandrei12 opened this issue 2 years ago • 1 comments

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]

mandrei12 avatar Aug 29 '22 19:08 mandrei12

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 using qemu-system-x86_64 (without the -enable-kvm) option, or using qemu-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 with public_repo only. And use UK_KRAFT_GITHUB_TOKEN=TODO kraft list update (replace TODO 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 use sudo pkill -f qemu (be careful when using it, it will terminate all QEMU processes).

  • You need a large enough screen for make menuconfig or kraft 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 or kraft 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 run qemu-system-x86_64 on an aarch64 image. You need to run qemu-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 runningls build/in your terminal. It may be named onlyhelloworld_kvm-x86_64`. Or you may have omitted to build it.

  • Omitting to use UK_WORK_DIR for a custom kraft environment.

  • Omitting the update of the LIBS variable in the Makefile.

  • Omitting the clone of a library file in libs/ in a custom kraft environment.

  • Unikraft core repository or library repository is on staging (or the proper branch). Do git 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 of PATH.

  • Issues with library ordering in Makefile.

razvand avatar Sep 03 '22 09:09 razvand

Superseded by #391

StefanJum avatar Jul 20 '24 09:07 StefanJum