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

Create a folder with common mistakes for beginners #105

Closed
wants to merge 1 commit into from

Conversation

mandrei12
Copy link
Contributor

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 andrei.mutu@stud.acs.upb.ro

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 <andrei.mutu@stud.acs.upb.ro>
Copy link
Member

@StefanJum StefanJum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mandrei12, thank you for this.
Few comments:

  • The start of the index.md file should look similar to other session index files.
    Take this example.
    It should have a title and a link name.
  • The index.md file should also include the other small files (USoC.md in this example) by using the readfile shortcode.
    Look here for an example.
    There should be a title inside the index.md file that describes the mistake shortly, then the readfile shortcode just adds the content to the page.
    This is done in order to be able to include the small files in other places, like sessions, docs, etc.
  • The USoC.md file should be placen inside a content/ directory and should be named differently.
    The name should be a 3-4 word description of the problem itself (e.g. Unikraft-branch-layout or something along those lines).

For every comment above, you can check the structure of a hackathon session, this directory should look very similar.

@razvand razvand self-assigned this Sep 2, 2022
@razvand
Copy link
Contributor

razvand commented Sep 3, 2022

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.

@StefanJum
Copy link
Member

Superseded by #391

@StefanJum StefanJum closed this Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants