openstack-snaps / snap-openvswitch

Snap of Open vSwitch
3 stars 1 forks source link

Error Installing the Snap #1

Open vahid-dan opened 5 years ago

vahid-dan commented 5 years ago

Hi;

I'm trying to build and install the snap but I encounter the following error:

$ sudo snap install openvswitch_2.10.0_amd64.snap --devmode 
error: cannot perform the following tasks:
- Start snap "openvswitch" (unset) services ([start snap.openvswitch.ovs-vswitchd.service] failed with exit status 1: Job for snap.openvswitch.ovs-vswitchd.service failed because a timeout was exceeded. See "systemctl status snap.openvswitch.ovs-vswitchd.service" and "journalctl -xe" for details.
)

Here are the logs:

$ systemctl status snap.openvswitch.ovs-vswitchd.service
● snap.openvswitch.ovs-vswitchd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

Dec 10 13:44:01 bonobo systemd[1]: Starting Service for snap application openvswitch.ovs-vswitchd...
Dec 10 13:45:31 bonobo systemd[1]: snap.openvswitch.ovs-vswitchd.service: Start operation timed out. Terminating.
Dec 10 13:45:31 bonobo systemd[1]: Failed to start Service for snap application openvswitch.ovs-vswitchd.
Dec 10 13:45:31 bonobo systemd[1]: snap.openvswitch.ovs-vswitchd.service: Unit entered failed state.
Dec 10 13:45:31 bonobo systemd[1]: snap.openvswitch.ovs-vswitchd.service: Failed with result 'timeout'.
Dec 10 13:45:32 bonobo systemd[1]: snap.openvswitch.ovs-vswitchd.service: Service hold-off time over, scheduling restart.
Dec 10 13:45:32 bonobo systemd[1]: Stopped Service for snap application openvswitch.ovs-vswitchd.
Dec 10 13:45:32 bonobo systemd[1]: Starting Service for snap application openvswitch.ovs-vswitchd...
Dec 10 13:45:32 bonobo systemd[1]: Stopped Service for snap application openvswitch.ovs-vswitchd.
$ journalctl -xe
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit snap-openvswitch-x1.mount has finished shutting down.
Dec 10 13:45:33 bonobo systemd[1]: Reloading.
Dec 10 13:45:33 bonobo systemd[1]: Started CUPS Scheduler.
-- Subject: Unit cups.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit cups.service has finished starting up.
-- 
-- The start-up result is done.
Dec 10 13:45:33 bonobo systemd[1]: Started ACPI event daemon.
-- Subject: Unit acpid.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit acpid.service has finished starting up.
-- 
-- The start-up result is done.
Dec 10 13:45:33 bonobo systemd[1]: Reloading.
Dec 10 13:45:34 bonobo systemd[1]: Started CUPS Scheduler.
-- Subject: Unit cups.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit cups.service has finished starting up.
-- 
-- The start-up result is done.
Dec 10 13:45:34 bonobo systemd[1]: Started ACPI event daemon.
-- Subject: Unit acpid.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit acpid.service has finished starting up.
-- 
-- The start-up result is done.
Dec 10 13:45:51 bonobo snapd[13040]: handlers.go:394: Reported install problem for "openvswitch" as d03eca98-fcab-11e8-99a6-fa163ee63de6 OOPSID
Dec 10 13:45:51 bonobo sudo[28329]: pam_unix(sudo:session): session closed for user root
Dec 10 13:47:02 bonobo systemd[1]: dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device: Job dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device/start timed 
Dec 10 13:47:02 bonobo systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device.
-- Subject: Unit dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device has failed.
-- 
-- The result is timeout.
Dec 10 13:47:02 bonobo systemd[1]: Dependency failed for /dev/disk/by-uuid/d7596959-0f14-4527-a3f5-ff1758805a6c.
-- Subject: Unit dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.swap has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.swap has failed.
-- 
-- The result is dependency.
Dec 10 13:47:02 bonobo systemd[1]: dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.swap: Job dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.swap/start failed wit
Dec 10 13:47:02 bonobo systemd[1]: dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device: Job dev-disk-by\x2duuid-d7596959\x2d0f14\x2d4527\x2da3f5\x2dff1758805a6c.device/start failed
lines 1391-1449/1449 (END)

Thanks, Vahid

pengale commented 5 years ago

Thank you for the thorough bug report!

I patched in a fix for this over in microstack, but hadn't ported the fix back in to the original snap.

Here's a PR w/ the fix: https://github.com/openstack-snaps/snap-openvswitch/pull/2

vahid-dan commented 5 years ago

Hi @petevg;

Thanks for the quick response. I applied the patch you suggested but there is another error:

$ sudo snap install openvswitch_2.10.0_armhf.snap --devmode 
error: cannot perform the following tasks:
- Start snap "openvswitch" (unset) services ([start snap.openvswitch.ovsdb-server.service] failed with exit status 1: Job for snap.openvswitch.ovsdb-server.service failed because the control process exited with error code.
See "systemctl status snap.openvswitch.ovsdb-server.service" and "journalctl -xe" for details.
)

The logs:

$ systemctl status snap.openvswitch.ovsdb-server.service
Unit snap.openvswitch.ovsdb-server.service could not be found.
$ journalctl -xe
Dec 11 06:04:34 ubuntu audit[4261]: AVC apparmor="ALLOWED" operation="open" profile="snap.openvswitch.ovsdb-server//null-/bin/systemctl" name="/proc/4261/stat" pid=4261 comm="systemctl" requested_mask="r"
Dec 11 06:04:34 ubuntu audit[4261]: AVC apparmor="ALLOWED" operation="open" profile="snap.openvswitch.ovsdb-server//null-/bin/systemctl" name="/proc/1/environ" pid=4261 comm="systemctl" requested_mask="r"
Dec 11 06:04:34 ubuntu audit[4261]: AVC apparmor="ALLOWED" operation="capable" profile="snap.openvswitch.ovsdb-server//null-/bin/systemctl" pid=4261 comm="systemctl" capability=19  capname="sys_ptrace"
Dec 11 06:04:34 ubuntu audit[4261]: AVC apparmor="ALLOWED" operation="open" profile="snap.openvswitch.ovsdb-server//null-/bin/systemctl" name="/proc/1/sched" pid=4261 comm="systemctl" requested_mask="r" d
Dec 11 06:04:34 ubuntu audit[4261]: AVC apparmor="ALLOWED" operation="open" profile="snap.openvswitch.ovsdb-server//null-/bin/systemctl" name="/proc/cmdline" pid=4261 comm="systemctl" requested_mask="r" d
Dec 11 06:04:34 ubuntu openvswitch.ovsdb-server[4235]: ovsdb-tool: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by ovsdb-tool)
Dec 11 06:04:34 ubuntu openvswitch.ovsdb-server[4235]:  * /var/snap/openvswitch/common/etc/openvswitch/conf.db does not exist
Dec 11 06:04:34 ubuntu openvswitch.ovsdb-server[4235]: ovsdb-tool: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by ovsdb-tool)
Dec 11 06:04:34 ubuntu openvswitch.ovsdb-server[4235]:  * Creating empty database /var/snap/openvswitch/common/etc/openvswitch/conf.db
Dec 11 06:04:34 ubuntu systemd[1]: snap.openvswitch.ovsdb-server.service: Control process exited, code=exited status=1
Dec 11 06:04:34 ubuntu systemd[1]: snap.openvswitch.ovsdb-server.service: Failed with result 'exit-code'.
Dec 11 06:04:34 ubuntu systemd[1]: Failed to start Service for snap application openvswitch.ovsdb-server.
-- Subject: Unit snap.openvswitch.ovsdb-server.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snap.openvswitch.ovsdb-server.service has failed.
-- 
-- The result is RESULT.
Dec 11 06:04:34 ubuntu systemd[1]: snap.openvswitch.ovsdb-server.service: Service hold-off time over, scheduling restart.
Dec 11 06:04:34 ubuntu systemd[1]: snap.openvswitch.ovsdb-server.service: Scheduled restart job, restart counter is at 1.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Automatic restarting of the unit snap.openvswitch.ovsdb-server.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Dec 11 06:04:34 ubuntu systemd[1]: Stopped Service for snap application openvswitch.ovsdb-server.
-- Subject: Unit snap.openvswitch.ovsdb-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snap.openvswitch.ovsdb-server.service has finished shutting down.
Dec 11 06:04:34 ubuntu systemd[1]: Starting Service for snap application openvswitch.ovsdb-server...
-- Subject: Unit snap.openvswitch.ovsdb-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snap.openvswitch.ovsdb-server.service has begun starting up.
Dec 11 06:04:35 ubuntu systemd[1]: Stopped Service for snap application openvswitch.ovsdb-server.
-- Subject: Unit snap.openvswitch.ovsdb-server.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- Unit snap.openvswitch.ovsdb-server.service has finished shutting down.
Dec 11 06:04:41 ubuntu systemd[1]: Reloading.
Dec 11 06:04:44 ubuntu audit[4332]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/core/6035/usr/lib/snapd/snap-confine" pid=43
Dec 11 06:04:44 ubuntu audit[4332]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/core/6035/usr/lib/snapd/snap-confine//mount-
Dec 11 06:04:44 ubuntu kernel: kauditd_printk_skb: 51 callbacks suppressed
Dec 11 06:04:44 ubuntu kernel: audit: type=1400 audit(1544508284.082:224): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/core/6035
Dec 11 06:04:44 ubuntu kernel: audit: type=1400 audit(1544508284.082:225): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="/snap/core/6035
Dec 11 06:04:44 ubuntu audit[4334]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.core" pid=4334 comm="apparmor_parse
Dec 11 06:04:44 ubuntu kernel: audit: type=1400 audit(1544508284.110:226): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap-update-ns.
Dec 11 06:04:44 ubuntu audit[4335]: AVC apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.core.hook.configure" pid=4335 comm="apparmor_
Dec 11 06:04:44 ubuntu kernel: audit: type=1400 audit(1544508284.114:227): apparmor="STATUS" operation="profile_replace" info="same as current profile, skipping" profile="unconfined" name="snap.core.hook.
Dec 11 06:04:44 ubuntu systemd-udevd[669]: Network interface NamePolicy= disabled on kernel command line, ignoring.
Dec 11 06:04:44 ubuntu systemd[1]: Reloading.
Dec 11 06:04:47 ubuntu snapd[1213]: handlers.go:394: Reported install problem for "openvswitch" as a94577f2-fd0a-11e8-9734-fa163e102db1 OOPSID
Dec 11 06:04:48 ubuntu sudo[3925]: pam_unix(sudo:session): session closed for user root

Thanks in advance.

Bests, Vahid

vahid-dan commented 5 years ago

I found out the error is caused by base: core18 added to prevent the linker errors on Ubuntu 18.04 Server on Raspberry Pi. I'll try with LXD and cleanbuild and update you. :-)

pengale commented 5 years ago

@vahid-dan We were just having a discussion about bases and cleanbuild, and I came here to suggest exactly that :-)

Let me know if that doesn't fix things, and I'll see what else I can do.

(Also, a raspberrypi based project sounds like a lot of fun -- I hope that things go well, and good luck!)

vahid-dan commented 5 years ago

@petevg,

I tried hard to install openvswitch snap on Ubuntu 16.04 and 18.04 on RPi with and without LXD and cleanbuild and none of them was successful. I can create the snap package on Ubuntu 16.04 on RPi but I get errors installing it.

With cleanbuild, I cannot build the package:

dropping privs did not work

With and without base: core18, I can build the package but cannot install it:

openvswitch.ovsdb-server[18569]: ovsdb-tool: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.28' not found (required by ovsdb-tool)

My system ldd --version is 2.28 but for core is 2.23 and for core18 is 2.27. I don't know how to update them. Even ldd --version on edge release for core is not 2.28.

If I try to install libc6 as a stage package, I get:

Segmentation fault (core dumped)
Failed to run 'override-pull': Exit code was 139.

Thanks in advance. Vahid

pengale commented 5 years ago

Hi @vahid-dan,

It looks like there's an issue w/ cleanbuild in 16.04, with the deb version of lxd:

https://github.com/snapcore/snapcraft/pull/1912

You should be able to fix it either by grabbing an lxd update from the xenial-backports repo, or by installing lxd from the snap.

If that doesn't unblock you, I'd suggest raising a topic on snapcraft.io forums, as we're moving out of my area of expertise (and also, I'll be on vacation for the next few days).

hth, ~ Pete

vahid-dan commented 5 years ago

Hi;

Using cleanbuild on snapcraft 3.0.1 and lxd 3.0.3 I got this error:

Could not find a required package in 'build-packages': libnuma-dev
Error: not found
Stopping local:snapcraft-nonfatally-isobaric-kira
An error occurred when trying to copy files using 'lxd': returned exit code 1.

How can I make sure the prerequisite packages will be installed inside the LXD?

Thanks in advance. :-)

Bests, Vahid

pengale commented 5 years ago

@vahid-dan I'm able to do a cleanbuild on a fresh machine running bionic (I also tested with xenial).

I'd say that it's likely one of two things have happened: 1) The lxd machine is having trouble talking to the Internet, and can't fetch packages. 2) You're running on a fresh machine, and didn't run apt update on the host machine.

If you're still having trouble after checking those two things, let me know. That should unblock you, though.

vahid-dan commented 5 years ago

Hi @petevg;

Thanks for your response. I guess I've found the source of the issue: There is no libnuma-dev for Ubuntu 16.04 and 18.04 on RPi (armhf). So it won't automatically be installed inside the LXD. https://packages.ubuntu.com/search?keywords=libnuma-dev&searchon=names&suite=all&section=all Is there an easy way to install it inside the LXD?

Thanks, Vahid

pengale commented 5 years ago

@vahid-dan Aha! That would explain why the package is missing.

I'm not sure what the absolute best practices are for adding a build time dependency via source. I'd try fetching the debian package via wget, and installing it with dpkg. To do so, edit snapcraft.yaml, and add an override-build section to the openvswitch part:

...
parts:
  ...
  openvswitch:
    ...
    override-build: |
      wget https://<url of libnuma-dev package> .
      sudo dpkg --install ./<libnuma-dev>.dpkg
  snapcraftctl build

Basically, you doing what you need to do in order to install the package, then running the normal snapcraft build step.

If nobody has built a debian package, you could technically install the dependency from source in the same way.