dbus exception when running under schroot

Bug #705571 reported by Paul Larson
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Linaro Image Tools
Fix Released
High
Guilherme Salgado

Bug Description

I would like to run l-m-c to create images under schroot so that sudo/root permission is not needed. This is so that we can extract boot/rootfs filesystems from the image for use in the validation farm. However, it seems that there are problems trying to run it under schroot:

Setting up linux-image-2.6.37-1001-linaro-omap (2.6.37-1001.4) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.37-1001-linaro-omap
/bin/df: Warning: cannot read table of mounted file systems: No such file or directory
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.37-1001-linaro-omap /boot/vmlinuz-2.6.37-1001-linaro-omap
Setting up devio (1.2-1build1) ...
Setting up flash-kernel (2.28ubuntu12) ...
Setting up linux-firmware (1.45) ...
Setting up linux-image-linaro-omap (2.6.37.1001.2) ...
Setting up u-boot-linaro-omap3-beagle (2010.12-0ubuntu1) ...
Setting up u-boot-tools (2010.12-1ubuntu2) ...
Setting up uboot-mkimage (2010.12-1ubuntu2) ...
Setting up x-loader-omap (1.4.4git20100713-1ubuntu5) ...
Done
Cleaning up ...Done
------------------------------------------------------------
proc umounted
Warning: beagle-from-chroot.img is not a block device
Disk beagle-from-chroot.img: cannot get geometry

sfdisk: ERROR: sector 0 does not have an msdos signature
 beagle-from-chroot.img: unrecognized partition table type
No partitions found
BLKRRPART: Inappropriate ioctl for device
If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

Formating boot partition

Traceback (most recent call last):
  File "./linaro-image-tools/linaro-media-create", line 99, in <module>
    args.should_format_bootfs, args.should_format_rootfs)
  File "/home/mirror/linaro/latest/linaro-image-tools/linaro_media_create/partitions.py", line 64, in setup_partitions
    ensure_partition_is_not_mounted(bootfs)
  File "/home/mirror/linaro/latest/linaro-image-tools/linaro_media_create/partitions.py", line 84, in ensure_partition_is_not_mounted
    if is_partition_mounted(partition):
  File "/home/mirror/linaro/latest/linaro-image-tools/linaro_media_create/partitions.py", line 90, in is_partition_mounted
    device_path = _get_udisks_device_path(partition)
  File "/home/mirror/linaro/latest/linaro-image-tools/linaro_media_create/partitions.py", line 219, in _get_udisks_device_path
    bus = dbus.SystemBus()
  File "/usr/lib/pymodules/python2.7/dbus/_dbus.py", line 202, in __new__
    private=private)
  File "/usr/lib/pymodules/python2.7/dbus/_dbus.py", line 108, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/pymodules/python2.7/dbus/bus.py", line 125, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.FileNotFound: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory

Related branches

Paul Larson (pwlars)
Changed in linaro-image-tools:
importance: Undecided → High
assignee: nobody → Guilherme Salgado (salgado)
Revision history for this message
Guilherme Salgado (salgado) wrote :

Paul, can you try bind mounting the system's /var/run/dbus into <chroot>/var/run/dbus and running l-m-c again? That should workaround this issue. (got this idea from http://lists.freedesktop.org/archives/hal/2008-October/012380.html)

A proper fix might involve switching from UDisks to running fdisk and/or other commands directly and parsing their output, which is far from optimal so it'd be great if we could find an acceptable way to workaround this on chroots.

Revision history for this message
Loïc Minier (lool) wrote :

We could avoid using Udisks when writing to files

Changed in linaro-image-tools:
status: New → Triaged
Revision history for this message
Loïc Minier (lool) wrote :

Tentatively targetting at 0.4.2 as it's important for automated testing.

Lowering importance to medium as there's a workaround

Changed in linaro-image-tools:
importance: High → Medium
milestone: none → 0.4.2
Revision history for this message
Peter Maydell (pmaydell) wrote :

I tried the bind mount approach and it fails with a different backtrace instead:
Formating boot partition

Traceback (most recent call last):
  File "/usr/bin/linaro-media-create", line 99, in <module>
    args.should_format_bootfs, args.should_format_rootfs)
  File "/usr/lib/pymodules/python2.6/linaro_media_create/partitions.py", line 64, in setup_partitions
    ensure_partition_is_not_mounted(bootfs)
  File "/usr/lib/pymodules/python2.6/linaro_media_create/partitions.py", line 84, in ensure_partition_is_not_mounted
    if is_partition_mounted(partition):
  File "/usr/lib/pymodules/python2.6/linaro_media_create/partitions.py", line 90, in is_partition_mounted
    device_path = _get_udisks_device_path(partition)
  File "/usr/lib/pymodules/python2.6/linaro_media_create/partitions.py", line 221, in _get_udisks_device_path
    bus.get_object(UDISKS, "/org/freedesktop/UDisks"), UDISKS)
  File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 244, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 241, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 183, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 281, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UDisks was not provided by any .service files

...because the l-m-c dependencies install udisks in the chroot but dbus is running in the outside machine (and there doesn't seem to be a udisks package for karmic).

Loïc Minier (lool)
Changed in linaro-image-tools:
importance: Medium → High
Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 705571] Re: dbus exception when running under schroot

On Mon, Jan 24, 2011 at 03:46:06PM -0000, Peter Maydell wrote:
> ...because the l-m-c dependencies install udisks in the chroot but dbus
> is running in the outside machine (and there doesn't seem to be a udisks
> package for karmic).

Mind you, the Ubuntu karmic release has been unsupported now for 9 months;
it's advisable for you to upgrade to lucid, whether or not that helps with
this particular bug.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>

Revision history for this message
Steve Langasek (vorlon) wrote :

Er, ignore that, I'm apparently living in the future today (that's a good excuse for bad math, right?) karmic is still supported for another 3 months. It just seems like it shouldn't be supported any more because it's ancient. ;)

Revision history for this message
Guilherme Salgado (salgado) wrote :

Even if we didn't use UDisks, one is likely to encounter other problems if trying to run l-m-c on Karmic (bug 627607)

Revision history for this message
Paul Larson (pwlars) wrote :

Tried this on my laptop (natty) with natty schroot and it works.

Revision history for this message
Peter Maydell (pmaydell) wrote :

> Even if we didn't use UDisks, one is likely to encounter other problems if trying to run l-m-c on Karmic (bug 627607)

Sure, that's why I run it in a natty chroot. I just don't want l-m-c to depend on things it can't get in a chroot (like dbus) and was pointing out that lool's proposed workaround unfortunately didn't work if the system hosting the chroot is karmic.

Steve: unfortunately the lucid upgrade breaks the local kerberos related changes our IT department has (the effect being that the upgrade hangs and you're completely locked out of the system, IIRC), so we're stuck on karmic until IT have found a workaround for that.

Revision history for this message
Guilherme Salgado (salgado) wrote :

I've been thinking about this some more and although it should be straightforward to make it possible to run lmc to generate an image file inside a chroot without udisks it'd be very tricky to do so reliably for SD cards. That's because if you happen to have an eager automounter that automounts stuff when you change the partition table (like some people have reported) lmc won't be able to unmount that in order to run mkfs. For that reason, I think we should make sure it is possible to run lmc to generate an image file inside a chroot but I think we need a really compelling use case to try and make sure it can burn SD cards inside chroots as well.

Revision history for this message
Peter Maydell (pmaydell) wrote :

Fine by me, IME burning sd cards inside the chroot has never worked because you don't have access to the device. It's easy enough to write to file and then dd to the card if you have to.

Changed in linaro-image-tools:
status: Triaged → Fix Committed
Loïc Minier (lool)
Changed in linaro-image-tools:
status: Fix Committed → 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.