All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: "Burton, Ross" <ross.burton@intel.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH v2 1/5] wic: copy rootfs directory before changing fstab
Date: Wed, 5 Jul 2017 11:01:38 +0300	[thread overview]
Message-ID: <20170705080138.GA29283@linux.intel.com> (raw)
In-Reply-To: <CAJTo0LZC=Ee+ctXnFCO2WtURObsE=UfuaDqUyrJtgW+1u3_hgw@mail.gmail.com>

On Tue, Jul 04, 2017 at 11:16:23PM +0100, Burton, Ross wrote:
> Bad news: the failure this was meant to fix happened again.
> 
> | tar: ./opt/ltp/testcases/bin/dup01: file changed as we read it
> | ERROR: Function failed: do_image_tar (log file is located at
> /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm/build/build/tmp/work/beaglebone-poky-linux-gnueabi/core-image-sato-sdk-ptest/1.0-r0/temp/log.do_image_tar.5535)
> 
> As before, image_wic was also running.
> 
> Is there any chance this could still be wic, or should we look at the jffs2
> image generator?
> 

There is always a chance. Which commit is this? I'll try to reproduce this.

Regards,
Ed


> Ross
> 
> On 27 June 2017 at 14:28, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:
> >
> > wic updates /etc/fstab on root partition if there are
> > valid mount points in .wks
> >
> > When wic runs from bitbake this can cause incorrect results
> > or even breakage of other tasks working with rootfs directory
> > in parallel with do_image_wic.
> >
> > Implemented copying rootfs directory to a temporary location
> > using copyhardlinktree before updating fstab to avoid conflicts with
> > other tasks working with rootfs.
> >
> > Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
> > ---
> >  scripts/lib/wic/plugins/imager/direct.py | 22 +++++++++++++---------
> >  1 file changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/scripts/lib/wic/plugins/imager/direct.py
> b/scripts/lib/wic/plugins/imager/direct.py
> > index aa9cc9f..f707365 100644
> > --- a/scripts/lib/wic/plugins/imager/direct.py
> > +++ b/scripts/lib/wic/plugins/imager/direct.py
> > @@ -32,6 +32,8 @@ import uuid
> >
> >  from time import strftime
> >
> > +from oe.path import copyhardlinktree
> > +
> >  from wic import WicError
> >  from wic.filemap import sparse_copy
> >  from wic.ksparser import KickStart, KickStartError
> > @@ -115,12 +117,16 @@ class DirectPlugin(ImagerPlugin):
> >              fstab_lines = fstab.readlines()
> >
> >          if self._update_fstab(fstab_lines, self.parts):
> > -            shutil.copyfile(fstab_path, fstab_path + ".orig")
> > +            # copy rootfs dir to workdir to update fstab
> > +            # as rootfs can be used by other tasks and can't be modified
> > +            new_rootfs = os.path.realpath(os.path.join(self.workdir,
> "rootfs_copy"))
> > +            copyhardlinktree(image_rootfs, new_rootfs)
> > +            fstab_path = os.path.join(new_rootfs, 'etc/fstab')
> >
> >              with open(fstab_path, "w") as fstab:
> >                  fstab.writelines(fstab_lines)
> >
> > -            return fstab_path
> > +            return new_rootfs
> >
> >      def _update_fstab(self, fstab_lines, parts):
> >          """Assume partition order same as in wks"""
> > @@ -156,7 +162,10 @@ class DirectPlugin(ImagerPlugin):
> >          filesystems from the artifacts directly and combine them into
> >          a partitioned image.
> >          """
> > -        fstab_path = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
> > +        new_rootfs = self._write_fstab(self.rootfs_dir.get("ROOTFS_DIR"))
> > +        if new_rootfs:
> > +            # rootfs was copied to update fstab
> > +            self.rootfs_dir['ROOTFS_DIR'] = new_rootfs
> >
> >          for part in self.parts:
> >              # get rootfs size from bitbake variable if it's not set in
> .ks file
> > @@ -172,12 +181,7 @@ class DirectPlugin(ImagerPlugin):
> >                      if rsize_bb:
> >                          part.size = int(round(float(rsize_bb)))
> >
> > -        try:
> > -            self._image.prepare(self)
> > -        finally:
> > -            if fstab_path:
> > -                shutil.move(fstab_path + ".orig", fstab_path)
> > -
> > +        self._image.prepare(self)
> >          self._image.layout_partitions()
> >          self._image.create()
> >
> > --
> > 2.1.4
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
--
Regards,
Ed


  reply	other threads:[~2017-07-05  8:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 13:28 [PATCH v2 0/5] #11662 - wic should mount /boot Ed Bartosh
2017-06-27 13:28 ` [PATCH v2 1/5] wic: copy rootfs directory before changing fstab Ed Bartosh
2017-07-04 22:16   ` Burton, Ross
2017-07-05  8:01     ` Ed Bartosh [this message]
2017-07-05 10:38       ` Burton, Ross
2017-06-27 13:28 ` [PATCH v2 2/5] wic: use absolute paths in rootfs plugin Ed Bartosh
2017-06-27 13:28 ` [PATCH v2 3/5] wic: rootfs: fix rootfs path reporting Ed Bartosh
2017-06-27 13:28 ` [PATCH v2 4/5] wic: rootfs: make copied rootfs unique Ed Bartosh
2017-06-27 13:28 ` [PATCH v2 5/5] wic: add /boot mount point to fstab by default Ed Bartosh
2017-06-27 20:35 ` [PATCH v2 0/5] #11662 - wic should mount /boot Otavio Salvador
2017-06-27 20:41   ` Fabio Berton
2017-06-28  7:31     ` Ed Bartosh
2017-06-28 13:32       ` Otavio Salvador
2017-06-29  8:39         ` Ed Bartosh
2017-06-30  8:37           ` Ed Bartosh
2017-06-30  9:02             ` Patrick Ohly
2017-06-30 12:23               ` Ed Bartosh
2017-06-30 13:16                 ` Patrick Ohly
2017-06-30 13:58                   ` Otavio Salvador
2017-06-30 15:37                     ` Ed Bartosh
2017-06-30 15:44                   ` Ed Bartosh
2017-06-30 17:33                     ` Otavio Salvador
2017-06-30 18:34                       ` Patrick Ohly
2017-07-03  7:31                         ` Ed Bartosh
2017-07-03  7:53                           ` Patrick Ohly
2017-07-03  8:59                             ` Ed Bartosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170705080138.GA29283@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=ross.burton@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.