syuu1228 / capstan-mruby-simplehttpserver

Other
2 stars 1 forks source link

Capstan run failed #1

Closed matsumotory closed 10 years ago

matsumotory commented 10 years ago

Hi @syuu1228 ,

I try to run osv with simplehttpserver by capstan. But, run failed.

$ go get github.com/cloudius-systems/capstan
$ git clone https://github.com/syuu1228/capstan-mruby-simplehttpserver.git
$ cd cpastan-mruby-simplehttpserver
$ capstan run
Building capstan-mruby-simplehttpserver...
Fetching cloudius/osv-base/index.yaml...134 bytes downloaded.
Fetching cloudius/osv-base/osv-base.qemu.gz...16384000 bytes downloaded.
dial tcp 127.0.0.1:10000: connection refused

Do I misunderstood the way of install using capstan?

syuu1228 commented 10 years ago

The way of usage seems correct for me. First of all, you should make sure it's occuring on build stage, by executing "capstan build". But it seems on filesystem building stage, file uploadeder failed to connect qemu/kvm(OSv is running on top of it). Do you see any output on "ps ax|grep qemu" at that time? Or didn't you already running another instance of OSv on qemu? That may causes error. And what's the your environment? (cpu, memory, virtualized/baremetal, distribution, etc)

monaka commented 10 years ago

I also got same situation. It might be just in my case, but I passed this issue by executing VirtualBox.app.

matsumotory commented 10 years ago

@syuu1228 Thanks for your response. I check your command ps ax|grep qemu at that time, but no output. My environment is the following: Ubuntu 14.0.4_64 on VMWare

[matsumotory@ubuntu14.04_64:~/DEV/osv]$ uname -a
Linux ubuntu14.04_64 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[matsumotory@ubuntu14.04_64:~/DEV/osv]$ cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
stepping        : 3
microcode       : 0x9
cpu MHz         : 3498.029
cache size      : 8192 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm fsgsbase smep
bogomips        : 6996.05
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

[matsumotory@ubuntu14.04_64:~/DEV/osv]$ free -m
             total       used       free     shared    buffers     cached
Mem:          3946       2737       1209         11        179       2231
-/+ buffers/cache:        325       3620
Swap:         1021          0       1021
matsumotory commented 10 years ago

Oh, I also can run capstan-mruby-simplehttpserver on Mac OSX with VirtualBOX. But, Ubuntu can't run yet. @syuu1228 @monaka

monaka commented 10 years ago

Hmm, I tried on OSX with VBOX again. And in this time failed to work continuously. It said just dial tcp 127.0.0.1:10000: connection refused.

Guess it is a timing issue? For example, the argument of time.sleep between LaunchVM and net.Dial ...?

I checked running qemu by ps ax ps -ef to make sure. But not found.

asias commented 10 years ago

Hello guys,

Does this:

https://github.com/asias/capstan/tree/fix.qemu.dial

fix the issue?

monaka commented 10 years ago

Hi @asias, I checked your fix. It is fine to me (except an issue reported on #2).

$ capstan run
Building capstan-mruby-simplehttpserver...
Created instance: capstan-mruby-simplehttpserver

dial unix /Users/monaka/.capstan/instances/vbox/capstan-mruby-simplehttpserver/capstan-mruby-simplehttpserver.sock: invalid argument
asias commented 10 years ago

Thanks for testing. I will check the sock issue. A quick test: can you rename capstan-mruby-simplehttpserver to simplehttpserver and run capstan again. My wild guess is that the name is too long.

matsumotory commented 10 years ago

Hi, @asias I pull latest capstan on Ubuntu 14.04 64bit, and built again, but same error occurred yet.

$ cd $GOPATH/src/github.com/cloudius-systems/capstan
$ git pull
$ ./install
$ cd -
$ capstan build
Building capstan-mruby-simplehttpserver...
dial tcp 127.0.0.1:10000: connection refused

My process is wrong?

asias commented 10 years ago

Hello @matsumoto-r ,

I suspect that you are running Ubuntu under VMware and your Ubuntu has no KVM enabled. So it will be slow to start the osv guest. What does $ sudo lsmod | grep kvm say?

Can you try this:

util/util.go func ConnectAndWait(network, path string) (net.Conn, error) { var conn net.Conn var err error for i := 0; i < 20; i++ { ---> increase the number to wait for more time conn, err = Connect(network, path) if err == nil { break } time.Sleep(500 * time.Millisecond) } return conn, err }

matsumotory commented 10 years ago
$ sudo lsmod | grep kvm
kvm                   451511  0 

and changed 20 to 200 in util.go, then

$ ./install
$ cd -
$ capstan build
Building capstan-mruby-simplehttpserver...     << very long sleep
dial tcp 127.0.0.1:10000: connection refused

oh...

asias commented 10 years ago

On Thu, May 22, 2014 at 3:59 PM, MATSUMOTO, Ryosuke < notifications@github.com> wrote:

$ sudo lsmod | grep kvm kvm 451511 0

This means qemu is not accelerated by kvm, so qemu is expected to be slow. I recommend you run it on a physical Ubuntu box or enable vt-x in the vmware. E.g. On VMware Fusion: Setting -> Processor & Memory -> Advanced options -> Enable hypervisor application in this virtual machine.

and changed 20 to 200 in util.go, then

$ ./install $ cd - $ capstan build Building capstan-mruby-simplehttpserver... << very long sleep dial tcp 127.0.0.1:10000: connection refused

oh...

does

$ capstan run cloudius/osv

work for you?

Asias

matsumotory commented 10 years ago

In my environment, OSv works well without capstan. So, I will check your points. Thanks.

syuu1228 commented 10 years ago

Then maybe you don't have an permission to access to /dev/kvm, and when you're running OSv without capstan you're using sudo?

matsumotory commented 10 years ago

when you're running OSv without capstan you're using sudo?

@syuu1228 yes, I read your blog entry about OSv + mruby.

syuu1228 commented 10 years ago

That's the reason why kvm was not enabled on capstan(you don't have enough permission to do that). On Debian, it solvable by adding your account to kvm group. Not sure it works on Ubuntu or not. Or you can run capstan on root account. Not a cool way though.

matsumotory commented 10 years ago

Ah, I shutdown my ubuntu, and enabled vt-x in the vmware. capstan build works well after boot. OSv without capstan works well even if vt-x was disabled.

Thanks a lot @asias @syuu1228

syuu1228 commented 10 years ago

I'm glad to hear that :-)

asias commented 10 years ago

Cool! Thanks for trying. If you have further issue, you could submit issues here: https://github.com/cloudius-systems/capstan