All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] post image blues (fakeroot and chown)
@ 2018-01-26 15:52 Marc Murphy
  2018-01-27 20:55 ` Baruch Siach
  2018-01-28  9:10 ` Arnout Vandecappelle
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Murphy @ 2018-01-26 15:52 UTC (permalink / raw)
  To: buildroot

Hello All

I am in the final stages of getting the buildroot image output configured and having an issue.

I have a couple of folders that I am using as partitions on the target. The images are created using genimage in the post-image.sh script before being included in the final complete image. But I have an issue with the folder permissions and trying to correct them before the image is built.

On a normal linux system I would of course perform a:
# sudo chown -R 0:0 some_folder

That would put the permissions in to the correct root user and group.

This can't be done in the post-image script as cannot use sudo as it requires intervention of entering password.

I have then been trying to use fakeroot and it simply refuses to persistently change the owner and group, ll will show creator when not logged in as fakeroot but root when logged in as fakeroot.

Is there any "standard" way to do this ?

I have been trying with all kinds of ways even resorted to trying to use fakeroot and makedevs:
fakeroot /home/Devel/buildroot-2017.02/output/host/usr/bin/makedevs -d $PWD/permissions $PWD/image_staging/


Kind Regards

Marc

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] post image blues (fakeroot and chown)
  2018-01-26 15:52 [Buildroot] post image blues (fakeroot and chown) Marc Murphy
@ 2018-01-27 20:55 ` Baruch Siach
  2018-01-28  9:10 ` Arnout Vandecappelle
  1 sibling, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2018-01-27 20:55 UTC (permalink / raw)
  To: buildroot

Hi Marc,

On Fri, Jan 26, 2018 at 03:52:23PM +0000, Marc Murphy wrote:
> I am in the final stages of getting the buildroot image output configured 
> and having an issue.
> 
> I have a couple of folders that I am using as partitions on the target. The 
> images are created using genimage in the post-image.sh script before being 
> included in the final complete image. But I have an issue with the folder 
> permissions and trying to correct them before the image is built.
> 
> On a normal linux system I would of course perform a:
> # sudo chown -R 0:0 some_folder
> 
> That would put the permissions in to the correct root user and group.
> 
> This can't be done in the post-image script as cannot use sudo as it 
> requires intervention of entering password.
> 
> I have then been trying to use fakeroot and it simply refuses to 
> persistently change the owner and group, ll will show creator when not 
> logged in as fakeroot but root when logged in as fakeroot.
> 
> Is there any "standard" way to do this ?

The standard way is to use BR2_ROOTFS_DEVICE_TABLE. See ?9.5.1 (Setting file 
permissions and ownership and adding custom devices nodes) in the Buildroot 
manual:

  https://buildroot.org/downloads/manual/manual.html#rootfs-custom

For more complicated changes that require root permissions, you can use 
BR2_ROOTFS_POST_FAKEROOT_SCRIPT (see the link above).

Hope this helps,
baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] post image blues (fakeroot and chown)
  2018-01-26 15:52 [Buildroot] post image blues (fakeroot and chown) Marc Murphy
  2018-01-27 20:55 ` Baruch Siach
@ 2018-01-28  9:10 ` Arnout Vandecappelle
  1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2018-01-28  9:10 UTC (permalink / raw)
  To: buildroot



On 26-01-18 16:52, Marc Murphy wrote:
> Hello All
> 
> I am in the final stages of getting the buildroot image output configured and having an issue.
> 
> I have a couple of folders that I am using as partitions on the target. The images are created using genimage in the post-image.sh script

 Do you use genimage to create a filesystem, or only to create a raw partition?
If you want genimage to create a filesystem, you'll need to run it under
fakeroot (i.e. in the BR2_ROOTFS_POST_FAKEROOT_SCRIPT) to get ownership and
permissions correct.

> before being included in the final complete image. But I have an issue with the folder permissions and trying to correct them before the image is built.
> 
> On a normal linux system I would of course perform a:
> # sudo chown -R 0:0 some_folder

 When the script runs under fakeroot, you can in fact use these commands
(without sudo). However, the result is "forgotten" as soon as fakeroot exits, so
you have to run the _entire_ script up to the generation of the filesystem under
a single fakeroot call. That's what BR2_ROOTFS_POST_FAKEROOT_SCRIPT does: the
scripts are run under the same fakeroot invocation that also generates the
filesystem.

 Alternatively, you can use fakeroot's -i and -s options to make the results
"persistent". But since Buildroot's invocation doesn't use them, it means you'll
have to create the filesystem yourself then.

> That would put the permissions in to the correct root user and group.
> 
> This can't be done in the post-image script as cannot use sudo as it requires intervention of entering password.
> 
> I have then been trying to use fakeroot and it simply refuses to persistently change the owner and group, ll will show creator when not logged in as fakeroot but root when logged in as fakeroot.
> 
> Is there any "standard" way to do this ?

 As Baruch mentioned, the standard way is BR2_ROOTFS_DEVICE_TABLE, but that only
works for files and directories that will end up in the Buildroot-generated rootfs.


 Hope this helps.

 Regards,
 Arnout

> 
> I have been trying with all kinds of ways even resorted to trying to use fakeroot and makedevs:
> fakeroot /home/Devel/buildroot-2017.02/output/host/usr/bin/makedevs -d $PWD/permissions $PWD/image_staging/
> 
> 
> Kind Regards
> 
> Marc
> 
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-28  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-26 15:52 [Buildroot] post image blues (fakeroot and chown) Marc Murphy
2018-01-27 20:55 ` Baruch Siach
2018-01-28  9:10 ` Arnout Vandecappelle

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.