canonical / lxd-demo-server

The LXD demo server
https://linuxcontainers.org/lxd/try-it
Apache License 2.0
74 stars 24 forks source link

Installed LXD and lxd-demo-server via Snap, but not working #16

Closed condector closed 5 years ago

condector commented 5 years ago

Ubuntu: 18.04 LXD: 3.7

The log from lxd-demo-server:


goroutine 274 [running]:
net/http.(*conn).serve.func1(0xc420506000)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4203361c0, 0xc420276900)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4203361c0, 0xc420276900)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4203361c0, 0xc420276900)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4203361c0, 0xc420459600)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc420506000, 0xaad060, 0xc42028c080)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44978: runtime error: invalid memory address or nil pointer dereference
goroutine 236 [running]:
net/http.(*conn).serve.func1(0xc4204f4000)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc420562000, 0xc42044e300)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc420562000, 0xc42044e300)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc420562000, 0xc42044e300)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc420562000, 0xc42033e900)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4204f4000, 0xaad060, 0xc42002f600)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44984: runtime error: invalid memory address or nil pointer dereference
goroutine 217 [running]:
net/http.(*conn).serve.func1(0xc4201de0a0)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4205620e0, 0xc42033e100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4205620e0, 0xc42033e100)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4205620e0, 0xc42033e100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4205620e0, 0xc420458a00)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4201de0a0, 0xaad060, 0xc42019c100)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44990: runtime error: invalid memory address or nil pointer dereference
goroutine 175 [running]:
net/http.(*conn).serve.func1(0xc42019a140)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4204b6000, 0xc4201ca400)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4204b6000, 0xc4201ca400)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4204b6000, 0xc4201ca400)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4204b6000, 0xc420458900)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc42019a140, 0xaad060, 0xc4202bc240)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44980: runtime error: invalid memory address or nil pointer dereference
goroutine 239 [running]:
net/http.(*conn).serve.func1(0xc4204f4140)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4203ac000, 0xc42033e100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4203ac000, 0xc42033e100)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4203ac000, 0xc42033e100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4203ac000, 0xc420458400)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4204f4140, 0xaad060, 0xc4202bc000)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44982: runtime error: invalid memory address or nil pointer dereference
goroutine 216 [running]:
net/http.(*conn).serve.func1(0xc4201de000)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4204b6000, 0xc4201f0100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4204b6000, 0xc4201f0100)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4204b6000, 0xc4201f0100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4204b6000, 0xc42033e400)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4201de000, 0xaad060, 0xc4201e00c0)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44986: runtime error: invalid memory address or nil pointer dereference
goroutine 218 [running]:
net/http.(*conn).serve.func1(0xc4201de280)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4204b60e0, 0xc4201f0700)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4204b60e0, 0xc4201f0700)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4204b60e0, 0xc4201f0700)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4204b60e0, 0xc4201f0400)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4201de280, 0xaad060, 0xc4205740c0)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44992: runtime error: invalid memory address or nil pointer dereference
goroutine 176 [running]:
net/http.(*conn).serve.func1(0xc42019a280)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4203ac000, 0xc42033e100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4203ac000, 0xc42033e100)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4203ac000, 0xc42033e100)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4203ac000, 0xc42033e500)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc42019a280, 0xaad060, 0xc4201e04c0)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44996: runtime error: invalid memory address or nil pointer dereference
goroutine 320 [running]:
net/http.(*conn).serve.func1(0xc4205063c0)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc4201361c0, 0xc4201f0300)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc4201361c0, 0xc4201f0300)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc4201361c0, 0xc4201f0300)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc4201361c0, 0xc4201f0100)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc4205063c0, 0xaad060, 0xc42002f840)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b
2018/12/14 09:48:17 http: panic serving 10.87.0.42:44998: runtime error: invalid memory address or nil pointer dereference
goroutine 390 [running]:
net/http.(*conn).serve.func1(0xc42019a000)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1726 +0xd0
panic(0x9a3800, 0xefe040)
    /build/lxd-demo-server/parts/go/build/src/runtime/panic.go:502 +0x229
main.restStartHandler(0xaac820, 0xc420136380, 0xc4201f0400)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/lxc/lxd-demo-server/rest.go:436 +0x746
net/http.HandlerFunc.ServeHTTP(0xa68540, 0xaac820, 0xc420136380, 0xc4201f0400)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1947 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc4201fe460, 0xaac820, 0xc420136380, 0xc4201f0400)
    /build/lxd-demo-server/parts/lxd-demo-server/go/src/github.com/gorilla/mux/mux.go:162 +0xed
net/http.serverHandler.ServeHTTP(0xc420220ea0, 0xaac820, 0xc420136380, 0xc4201f0200)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2694 +0xbc
net/http.(*conn).serve(0xc42019a000, 0xaad060, 0xc42028c4c0)
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /build/lxd-demo-server/parts/go/build/src/net/http/server.go:2795 +0x27b```

So, the container was not started. But, if I try to start manually one container using:

`lxc launch ubuntu c0`

Works normally
stgraber commented 5 years ago
Warning: Permanently added 'vm02.maas.mtl' (ECDSA) to the list of known hosts.
root@vm02:~# snap install lxd ; lxd.migrate -yes ; snap install lxd-demo-server ; snap connect lxd-demo-server:lxd lxd:lxd
2018-12-14T21:11:06Z INFO Waiting for restart...
lxd 3.7 from 'canonical' installed
=> Connecting to source server
=> Connecting to destination server
=> Running sanity checks
The source server is empty, no migration needed.

The migration is now complete and your containers should be back online.

All done. You may need to close your current shell and open a new one to have the "lxc" command work.
To migrate your existing client configuration, move ~/.config/lxc to ~/snap/lxd/current/.config/lxc
lxd-demo-server 0+git.f3532e3 from Stéphane Graber (stgraber) installed

root@vm02:~# lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]:
Name of the storage backend to use (btrfs, ceph, dir, lvm, zfs) [default=zfs]: 
Create a new ZFS pool? (yes/no) [default=yes]: 
Would you like to use an existing block device? (yes/no) [default=no]: 
Size in GB of the new loop device (1GB minimum) [default=15GB]: 
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=lxdbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like LXD to be available over the network? (yes/no) [default=no]: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes] 
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: 
root@vm02:~# lxd-demo-server.configure 
root@vm02:~# 
root@vm02:~# journalctl -u snap.lxd-demo-server.daemon -n 30
-- Logs begin at Fri 2018-12-14 21:02:32 UTC, end at Fri 2018-12-14 21:14:26 UTC. --
Dec 14 21:11:56 vm02 systemd[1]: Started Service for snap application lxd-demo-server.daemon.
root@vm02:~# lxc list
To start your first container, try: lxc launch ubuntu:18.04

+-------------+---------+---------------------+-----------------------------------------------+------------+-----------+
|    NAME     |  STATE  |        IPV4         |                     IPV6                      |    TYPE    | SNAPSHOTS |
+-------------+---------+---------------------+-----------------------------------------------+------------+-----------+
| tryit-known | RUNNING | 10.203.248.4 (eth0) | fd42:f2ae:2d14:5b2b:216:3eff:fe90:b8a9 (eth0) | PERSISTENT |           |
+-------------+---------+---------------------+-----------------------------------------------+------------+-----------+
root@vm02:~# 

So seems to be all working out of the box here. Anything special with your setup which would differ from this?

condector commented 5 years ago

Yes,

I installed using the steps on the readme. Worked. But I need to translate index.html, so I removed the snap lxd-demo-server and run the go commands to install the dependencies and build lxd-demo-server.

When I do that, the compiled allow me to translate, but not create containers.

I delete the GitHub lxd-demo-server directory and try to install again from snap. And the presented error continue to appear. Maybe a Go library inconsistency because I run that command to install dependencies from the Internet?

A pointer exception on http.

panic serving 10.87.0.42:44978: runtime error: invalid memory address or nil pointer dereference

And the page works, but not start any container.

condector commented 5 years ago

Any way to clean up hardly to try again? I´m searching how to remove the libraries installed by this command:

go get github.com/lxc/lxd-demo-server

condector commented 5 years ago

I tried this command:

go clean -i -n github.com/lxc/lxd-demo-server

Not solved yet. If nothing works I will reinstall all server. Probably something goes wrong. My concern was about this nil pointer dereference.

stgraber commented 5 years ago

It's unclear what gets you into this situation. I've just manually built lxd-demo-server here and it's working properly when built from Go.

What's the lxd-demo.yaml that you're using? And are you running lxd-demo-server from within the source directory where the config is located?

condector commented 5 years ago

Hum, weird situation for sure. Here is my lxd-demo.yaml:

lxd-demo.yaml.zip

I create an alias for Debian container:

` $ lxc image ls

| ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | +--------+--------------+--------+---------------------------------------+--------+----------+-------------------------------+ | debian | 7b19f99f5fd8 | no | Debian stretch amd64 (20181213_11:35) | x86_64 | 110.29MB | Dec 14, 2018 at 12:19pm (UTC) | `

stgraber commented 5 years ago

That reproduced the issue here, will look into it