unikraft / pykraft

Python library for configuring and building unikernels
Other
176 stars 41 forks source link

libvfscore: Unable to mount / #67

Open ghost opened 2 years ago

ghost commented 2 years ago

Describe the bug

When running nginx, libvfscore cannot mount /, hence cannot boot.

Steps to reproduce

I simply followed the standard (according to current documentations) steps:

$ pip3 install git+https://github.com/unikraft/kraft.git@staging
$ kraft up -t nginx@staging my-nginx-unikernel
$ # (Optional) Execute `kraft run` in my-nginx-unikernel.

Expected behavior

I expected the root file system mount successfully and be able to run nginx.

Which architectures were you using or does this bug affect?

x86_64

Which platforms were you using or does this bug affect?

kvm

Relevant log output

**************************************************************************
 QEMU:
   Name:                  08fae8ad-5b21-457d-b77d-0d286a86323f
   PID:                   10771
   Monitor socket:        /run/qemu-guest-10755_monitor.socket
   VNC listen:            5900

   SMP configuration:     sockets=1,cores=1,threads=1
   Memory:                64 MB
   Kernel:                /home/user/my-nginx-unikernel/build/my-nginx-unikernel_kvm-x86_64
   Parameters:            console=ttyS0

   Warning: No networking for guest!
   Warning: Guest will be terminated with CTRL+C!
**************************************************************************
Starting VM...
Connecting to serial output...

Google, Inc.
Serial Graphics Adapter 03/05/17
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (generic@generic) Sun, 05 Mar 2017 16:09:17 +0100
Term: 116x58
4 0

SeaBIOS (version 1.10.2-1ubuntu1)
Booting from ROM...
[    0.100376] CRIT: [libvfscore] <rootfs.c @   85> Failed to mount /: 0
[    0.101693] ERR:  [libukboot] <boot.c @  101> Init function at 0x120940 returned error -1
gingiskan222 commented 2 years ago

Hello, I'm experiencing the same behavior and can't run the nginx-app nor the python3-app example.

Command I've tried too:

qemu-system-x86_64 -vga none -nographic -device sga -kernel build/app_kvm-x86_64 -enable-kvm -fsdev local,security_model=passthrough,id=hvirtio0,path=/home/***/nginx-vlltlinux/app/fs0,security_model=none -device virtio-9p-pci,id=fs0,fsdev=hvirtio0,mount_tag=fs0 -machine q35,accel=kvm -cpu host -m 64 -append "root=/dev/vda console=ttyS0" -smp 1

Gives me the same error as above.

Worth noting Parameters: console=ttyS0 should be something like Parameters: vfs.rootdev=fs0 vfs.rootfs=9pfs -- .....

gingiskan222 commented 2 years ago

I was able to run nginx and get the rootfs mounted, looking at eurosys21 with the command

sudo qemu-system-x86_64 -cpu host -enable-kvm -m 256M -nodefaults -no-acpi -display none -serial stdio -device isa-debug-exit -kernel build/my-nginx-unikernel_kvm-x86_64 -fsdev local,id=myid,path=fs0/,security_model=none -device virtio-9p-pci,fsdev=myid,mount_tag=rootfs,disable-modern=on,disable-legacy=off

But it get an other error and nginx is not starting

en0: Added
en0: Interface is up
Powered by
(pic of unikraft)
                   Tethys 0.5.0~b8be82b
nginx: [emerg] pread() returned only 0 bytes instead of 572 in /nginx/conf/nginx.conf:1

I edited my .conf file to:

worker_processes  1;
daemon off;
master_process off;

error_log logs/error.log debug;
#error_log off;
events {
  worker_connections 32;
}

http {
  include  mime.types;
  default_type application/octet-stream;
  open_file_cache max=200000 inactive=20s;
  open_file_cache_valid 30s;
  open_file_cache_min_uses 2;
  open_file_cache_errors off;
  open_log_file_cache      max=20000 inactive=30s min_uses=2;

  keepalive_timeout 65;
  server {
    listen 80;
    server_name localhost;

    location / {
      root /nginx/html;
      index index.html index.htm;
    }
  }
}
razvand commented 2 years ago

@42kernel , could you please check if the fix I proposed in #71 fixes your problem with nginx? I'm wondering if the issue is the same.

junyang-zh commented 1 year ago

I suppose that KVM PCI support is not enabled by kraft. I made it work using Makefile.

See this tutorial.