[Sugar-devel] "Another osbuild instance is running" error

James Cameron quozl at laptop.org
Wed Dec 30 17:21:52 EST 2015

On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> >>I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> >>and cd into sugar-build I get this error-Another osbuild instance is
> >>running on executing ./osbuild pull
> >>I searched the internet and found 2 such threads but the issue wasn't
> >>resolved.
> >
> >There's more than two such threads on sugar-devel at .
> >
> >>Is this a bug that needs fixing?
> >
> >Yes, it's a bug in osbuild, please fix it.
> Yes I will else I won't be able to get started at all.

It is a bug that needs fixing.  But it does not block you getting
started.  There is a way to avoid the bug.

> >You'll find the get_lock_file_path() returns a file path Add a print
> >to find out what the file path is.
> >
> I added a print statement and the file path is
> .../git/sugar-build/.lock-host

That tells you that to avoid the bug you may delete that file
using your shell.

However, don't delete the lock file if there is an osbuild process on
the system.

If you have recently rebooted the system, and you have not asked for
osbuild to be scheduled automatically somehow, there won't be an
osbuild process.

Look at the date it was created or modified.  It should correlate to
when you ran osbuild before the bug appeared.

> >You'll find the get_lock_file() returns a file.
> >
> >You'll see that clean() removes the file.  clean() may not be executed
> >if the builder is forced to stop.
> >
> >Therefore the file may remain even though there is no instance
> >running.
> >
> >The error is a lie.
> The OSError is incorrect?

When the error says "Another osbuild instance is running", yet you
know there is not, for example because you just rebooted the system,
the error text is untrue.

A more correct error is "Another osbuild instance is either running or
is not running but has left behind a lock file and I'm too lazy to
differentiate between the two possibilities."  ;-)

> >To fix the bug, you should store the pid in the file, from
> >os.getpid(), and check that the pid exists on the system using
> >os.kill(pid, 0)
> >
> >If the pid does not exist on the system, it is safe to os.unlink() the
> >file and continue to acquire the lock.
> >
> Should I make changes in clean() by adding a check for os.kill or in
> check_lock() ?

When the bug occurs, check_lock() is executed, but clean() is not.

James Cameron

More information about the Sugar-devel mailing list