unikraft / pykraft

Python library for configuring and building unikernels
Other
177 stars 42 forks source link

Cannot run hello world #74

Closed WysokiStudent closed 3 years ago

WysokiStudent commented 3 years ago

Describe the bug I wanted to try out unikraft but I can't run the hello world example. kraft up -t helloworld@staging ./my-first-unikernel results in an error

[ unikraft ] kraft up -t helloworld@staging ./my-first-unikernel                                     
 100.00% :::::::::::::::::::::::::::::::::::::::: |       21 /       21 |:  app/helloworld@fb343bf                                                                               
[INFO    ] Initialized new unikraft application: /home/zannzetsu/unikraft/./my-first-unikernel
[CRITICAL] 'ascii' codec can't decode byte 0xc5 in position 9: ordinal not in range(128)
[ unikraft ] make: *** [Makefile:977: /home/zannzetsu/unikraft/my-first-unikernel/build/Makefile] Przerwany potok

To Reproduce Steps to reproduce the behavior:

  1. pip3 install --user git+https://github.com/unikraft/kraft.git@staging
  2. mkdir unikraft
  3. cd unikraft
  4. UK_KRAFT_GITHUB_TOKEN= kraft list update
  5. kraft up -t helloworld@staging ./my-first-unikernel
  6. See the error message in the description

Expected behavior A unikraft hello world image is built

Desktop (please complete the following information):

WysokiStudent commented 3 years ago

Since my locale is polish in line 66 of op.py the variable line is b"make: Wej\xc5\x9bcie do katalogu '/home/zannzetsu/.unikraft/unikraft'\n" That seems to fail in the next line where decode('ascii') is run. If i replace 'ascii' with 'utf-8' hello world builds but kraft errors out with

Successfully built unikernels:

To instantiate, use: kraft run

[CRITICAL] Could not find unikernel: /home/zannzetsu/unikraft/./my-first-unikernel/build/helloworld_kvm-x86_64

Indeed there is no such file, the file is named my-first-unikernel_kvm-x86_64.

Here is the ascii -> utf-8 patch.

diff --git a/plat/network/driver/brctl.py b/plat/network/driver/brctl.py
index 8bb87e1..21f2e89 100644
--- a/plat/network/driver/brctl.py
+++ b/plat/network/driver/brctl.py
@@ -98,7 +98,7 @@ class BRCTLDriver(NetworkDriver):

         if err == b"can't get info No such device\n":
             return False
-        elif "does not exist!" in err.decode('ascii'):
+        elif "does not exist!" in err.decode('utf-8'):
             return False

         return True
diff --git a/util/op.py b/util/op.py
index 145b296..0bf5a8b 100644
--- a/util/op.py
+++ b/util/op.py
@@ -64,7 +64,7 @@ def execute(cmd="", env={}, dry_run=False, use_logger=False):
         )

         for line in popen.stdout:
-            line = line.strip().decode('ascii')
+            line = line.strip().decode('utf-8')
             if use_logger:
                 logger.info(line)
             else:
@@ -140,7 +140,7 @@ def make_progressbar(make=""):

             for line in popen.stdout:
                 t.update()
-                line = line.strip().decode('ascii')
+                line = line.strip().decode('utf-8')
                 if line.startswith("make: Leaving directory") is False and \
                         line.startswith("make: Entering directory") is False:
                     print(line)
WysokiStudent commented 3 years ago

If I run the kraft like kraft up -t helloworld@staging ./helloworld then hello world works :) Please update the docs or kraft.