udev bridge fails to get events from kernel (missing FHANDLE)

Bug #1412543 reported by Ricardo Salveti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Unassigned
linux (Ubuntu)
Fix Released
High
Andy Whitcroft
linux-flo (Ubuntu)
Fix Released
High
Andy Whitcroft
linux-mako (Ubuntu)
Fix Released
High
Andy Whitcroft
linux-manta (Ubuntu)
Fix Released
High
Andy Whitcroft

Bug Description

current build number: 70
device name: mako
channel: ubuntu-touch/vivid-proposed
last update: 2015-01-19 14:11:13
version version: 70
version ubuntu: 20150119
version device: 20150116
version custom: 20150119

Noticed that sometimes upstart is not receiving kernel events, which caused bad side effects at the usb event logic we have in ubuntu touch.

Basically I noticed that /etc/init/android-usb-state.conf fails to send the connected/disconnected events during some reboots when testing MTP. Looking a bit further, I saw that not only these events are missing, but every udev related ones.

Revision history for this message
Ricardo Salveti (rsalveti) wrote :

There is indeed a race in the upstart job, which makes it unable to receive the kernel events. It works every time now after changing the upstart job to start on 'started' instead of 'starting' udev.

Looking at the libudev code, this is what is currently happening:
"""
struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd)
{
        struct udev_monitor *udev_monitor;
        unsigned int group;

        if (udev == NULL)
                return NULL;

        if (name == NULL)
                group = UDEV_MONITOR_NONE;
        else if (streq(name, "udev")) {
                /*
                 * We do not support subscribing to uevents if no instance of
                 * udev is running. Uevents would otherwise broadcast the
                 * processing data of the host into containers, which is not
                 * desired.
                 *
                 * Containers will currently not get any udev uevents, until
                 * a supporting infrastructure is available.
                 *
                 * We do not set a netlink multicast group here, so the socket
                 * will not receive any messages.
                 */
                if (access("/run/udev/control", F_OK) < 0 && !udev_has_devtmpfs(udev)) {
                        log_debug("the udev service seems not to be active, disable the monitor");
                        group = UDEV_MONITOR_NONE;
                } else
                        group = UDEV_MONITOR_UDEV;
        } else if (streq(name, "kernel"))
                group = UDEV_MONITOR_KERNEL;
        else
                return NULL;
....
"""

Added some debug lines in the upstart-udev-bridge job and /run/udev/control is not necessarily available when this job starts (I'd guess it only happens on ubuntu-touch, since we start udev a bit later than the desktop).

Changed in canonical-devices-system-image:
importance: Undecided → High
milestone: none → ww05-2015
status: New → Confirmed
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

After spending a bit more time looking at why this happens with the touch devices, I found out that the root cause of this issue is the lack of CONFIG_FHANDLE in the kernel, which is needed systemd >= 209 (http://lists.freedesktop.org/archives/systemd-devel/2014-February/017362.html), and we're not enabling that option for any of our kernel packages.

summary: - udev bridge fails to get events from kernel
+ udev bridge fails to get events from kernel (missing FHANDLE)
affects: upstart (Ubuntu) → linux-manta (Ubuntu)
affects: upstart (Ubuntu RTM) → linux-manta (Ubuntu RTM)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

We should probably enforce this option at our kernel scripts, since we're officially moving to systemd quite soon.

no longer affects: linux-flo (Ubuntu RTM)
no longer affects: linux-mako (Ubuntu RTM)
no longer affects: linux-manta (Ubuntu RTM)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Removing the RTM bug tasks as we're still using systemd 208 there, so this bug doesn't happen on RTM.

Andy Whitcroft (apw)
Changed in linux-flo (Ubuntu):
milestone: none → ubuntu-15.01
Changed in linux-mako (Ubuntu):
milestone: none → ubuntu-15.01
Changed in linux-manta (Ubuntu):
milestone: none → ubuntu-15.01
Changed in linux-flo (Ubuntu):
assignee: nobody → Andy Whitcroft (apw)
Changed in linux-mako (Ubuntu):
assignee: nobody → Andy Whitcroft (apw)
Changed in linux-manta (Ubuntu):
assignee: nobody → Andy Whitcroft (apw)
Revision history for this message
Andy Whitcroft (apw) wrote :

Adding linux task to add this to the enforcement rules.

Changed in linux-flo (Ubuntu):
importance: Undecided → Medium
Changed in linux-mako (Ubuntu):
importance: Undecided → Medium
Changed in linux-manta (Ubuntu):
importance: Undecided → Medium
Changed in linux-mako (Ubuntu):
status: New → In Progress
Changed in linux (Ubuntu):
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Andy Whitcroft (apw)
milestone: none → ubuntu-15.01
Changed in linux-flo (Ubuntu):
milestone: ubuntu-15.01 → none
Changed in linux-mako (Ubuntu):
milestone: ubuntu-15.01 → none
Changed in linux-manta (Ubuntu):
milestone: ubuntu-15.01 → none
Andy Whitcroft (apw)
Changed in linux-mako (Ubuntu):
status: In Progress → Fix Committed
Changed in linux-manta (Ubuntu):
status: New → In Progress
Andy Whitcroft (apw)
Changed in linux-flo (Ubuntu):
status: New → In Progress
Andy Whitcroft (apw)
Changed in linux-flo (Ubuntu):
status: In Progress → Fix Committed
Changed in linux-manta (Ubuntu):
status: In Progress → Fix Committed
Andy Whitcroft (apw)
Changed in linux-flo (Ubuntu):
importance: Medium → High
Changed in linux-mako (Ubuntu):
importance: Medium → High
Changed in linux-manta (Ubuntu):
importance: Medium → High
Changed in linux (Ubuntu):
importance: Medium → High
tags: added: kernel-da-key
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-mako - 3.4.0-6.35

---------------
linux-mako (3.4.0-6.35) vivid; urgency=low

  [ Andy Whitcroft ]

  * [Config] CONFIG_FHANDLE=y
    - LP: #1412543

  [ Tim Gardner ]

  * [Debian] getabis: Commit new ABI directory, remove the old
 -- Andy Whitcroft <email address hidden> Tue, 20 Jan 2015 10:17:37 +0000

Changed in linux-mako (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-flo - 3.4.0-4.16

---------------
linux-flo (3.4.0-4.16) vivid; urgency=low

  [ Andy Whitcroft ]

  * [Config] CONFIG_FHANDLE=y
    - LP: #1412543

  [ Tim Gardner ]

  * [Debian] getabis: Commit new ABI directory, remove the old
 -- Andy Whitcroft <email address hidden> Tue, 20 Jan 2015 12:15:35 +0000

Changed in linux-flo (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux-manta - 3.4.0-7.30

---------------
linux-manta (3.4.0-7.30) vivid; urgency=low

  [ Andy Whitcroft ]

  * [Config] CONFIG_FHANDLE=y
    - LP: #1412543

  [ Tim Gardner ]

  * [Debian] getabis: Commit new ABI directory, remove the old
 -- Andy Whitcroft <email address hidden> Tue, 20 Jan 2015 12:07:58 +0000

Changed in linux-manta (Ubuntu):
status: Fix Committed → Fix Released
Andy Whitcroft (apw)
Changed in linux (Ubuntu):
status: Confirmed → Fix Released
Changed in canonical-devices-system-image:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.