All of lore.kernel.org
 help / color / mirror / Atom feed
* Compressing btrfs image
@ 2020-03-28 15:30 Edson Seabra
  2020-03-28 15:38 ` Edson Seabra
  0 siblings, 1 reply; 3+ messages in thread
From: Edson Seabra @ 2020-03-28 15:30 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 1531 bytes --]

Hi all.

I'm trying to compress a btrfs rootfs

I added  in "image_types.bbclass:IMAGE_CMD_btrfs ()"  two commands:

1) mount the btrfs image after mkfs.btrfs
2) btrfs filesystem defrag + compress option

But the command mount fails:

mount: /home/edson/ng-trunk/nodegrid/tmp/work/genericx86_64-poky-linux/nodegrid/1.0-r0/deploy-nodegrid-image-complete/temp_btrfs: failed to setup loop device for /home/edson/ng-trunk/nodegrid/tmp/work/genericx86_64-poky-linux/nodegrid/1.0-r0/deploy-nodegrid-image-complete/nodegrid-genericx86-64-20200328134151.rootfs.btrfs.

I saw in image.bbclass the creation of do_image_btrfs task with flag 'fakeroot'.

====== image.bbclass ====
        task = "do_image_%s" % t.replace("-", "_").replace(".", "_")

        d.setVar(task, '\n'.join(cmds))
        d.setVarFlag(task, 'func', '1')
        d.setVarFlag(task, 'fakeroot', '1')
=======================

would the fakeroot flag allow do_image_btrfs execute commands that requires root privilege ?

If not what would be the way to execute the mount command ?

I tried "pseudo mount" but it failed same way...

Thanks in advance.

Edson.


Edson Seabra

Principal Engineer

M +1 510 579 0843

E   edson.seabra@zpesystems.com<mailto:alvin.chan@zpesystems.com>

[1506169147061_OutlookEmoji-1505330244060_ZPELogo_Email.png1e6c5898-d340-4c90-8c28-e559c26bc7d1.png]
46757 Fremont Blvd., Fremont, CA 94538
zpesystems.com<https://www.zpesystems.com/> | Request a Nodegrid Demo<https://www.zpesystems.com/demo/>

[-- Attachment #1.2: Type: text/html, Size: 8272 bytes --]

[-- Attachment #2: Outlook-1506169147.png --]
[-- Type: image/png, Size: 2497 bytes --]

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

* Re: Compressing btrfs image
  2020-03-28 15:30 Compressing btrfs image Edson Seabra
@ 2020-03-28 15:38 ` Edson Seabra
  0 siblings, 0 replies; 3+ messages in thread
From: Edson Seabra @ 2020-03-28 15:38 UTC (permalink / raw)
  To: yocto


[-- Attachment #1.1: Type: text/plain, Size: 1764 bytes --]

I forget to say I'm using zeus...

________________________________
From: Edson Seabra
Sent: Saturday, March 28, 2020 12:30 PM
To: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org>
Subject: Compressing btrfs image

Hi all.

I'm trying to compress a btrfs rootfs

I added  in "image_types.bbclass:IMAGE_CMD_btrfs ()"  two commands:

1) mount the btrfs image after mkfs.btrfs
2) btrfs filesystem defrag + compress option

But the command mount fails:

mount: /home/edson/ng-trunk/nodegrid/tmp/work/genericx86_64-poky-linux/nodegrid/1.0-r0/deploy-nodegrid-image-complete/temp_btrfs: failed to setup loop device for /home/edson/ng-trunk/nodegrid/tmp/work/genericx86_64-poky-linux/nodegrid/1.0-r0/deploy-nodegrid-image-complete/nodegrid-genericx86-64-20200328134151.rootfs.btrfs.

I saw in image.bbclass the creation of do_image_btrfs task with flag 'fakeroot'.

====== image.bbclass ====
        task = "do_image_%s" % t.replace("-", "_").replace(".", "_")

        d.setVar(task, '\n'.join(cmds))
        d.setVarFlag(task, 'func', '1')
        d.setVarFlag(task, 'fakeroot', '1')
=======================

would the fakeroot flag allow do_image_btrfs execute commands that requires root privilege ?

If not what would be the way to execute the mount command ?

I tried "pseudo mount" but it failed same way...

Thanks in advance.

Edson.


Edson Seabra

Principal Engineer

M +1 510 579 0843

E   edson.seabra@zpesystems.com<mailto:alvin.chan@zpesystems.com>

[1506169147061_OutlookEmoji-1505330244060_ZPELogo_Email.png1e6c5898-d340-4c90-8c28-e559c26bc7d1.png]
46757 Fremont Blvd., Fremont, CA 94538
zpesystems.com<https://www.zpesystems.com/> | Request a Nodegrid Demo<https://www.zpesystems.com/demo/>

[-- Attachment #1.2: Type: text/html, Size: 9014 bytes --]

[-- Attachment #2: Outlook-1506169147.png --]
[-- Type: image/png, Size: 2497 bytes --]

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

* Re: Compressing btrfs image
  2020-03-28 20:06 ` [yocto] " Konrad Weihmann
@ 2020-04-04 16:18   ` Gmane Admin
  0 siblings, 0 replies; 3+ messages in thread
From: Gmane Admin @ 2020-04-04 16:18 UTC (permalink / raw)
  To: yocto

Op 28-03-2020 om 21:06 schreef Konrad Weihmann:
> AFAIK there is no way to mount something without root credentials.

You can loop mount the image file using udisksctl as an ordinary user, 
which mounts the image under /media/<user name>.

> fakeroot/pseudo is intercepting some calls before they will reach the 
> kernel, but mounting isn't a supported option - it just makes all child 
> processes think they running under uid 0.
> 
> What you could do is try to find an option 
> (https://btrfs.wiki.kernel.org/index.php/Manpage/mkfs.btrfs) which does 
> what you want directly while creating the image.
> 
> These options should go then to a variable called EXTRA_IMAGECMD.
> 
> 
> On 28.03.20 16:30, Edson Seabra wrote:
>> Hi all.
>>
>> I'm trying to compress a btrfs rootfs

I wanted to take a snap shot, see this thread:
"How to create a btrfs snapshot in the rootfs image (during build)?"

I found you need to be owner of the root directory of the image, but 
there is no option to mkfs that with btrfs.
The only route for that I found was create and ext4 image with
'-E root_owner'  then btrfs-convert.

But then I found there is no way to 'btrfs send' without becoming root...

See also "Howto take a snapshot from an image as ordinary user?" on lkml.

>> I added  in "image_types.bbclass:IMAGE_CMD_btrfs ()" two commands:
>>
>> 1) mount the btrfs image after mkfs.btrfs
>> 2) btrfs filesystem defrag + compress option
>>
>> But the command mount fails:
>>
>> mount: 
>> /home/edson/ng-trunk/nodegrid/tmp/work/genericx86_64-poky-linux/nodegrid/1.0-r0/deploy-nodegrid-image-complete/temp_btrfs: 
>> failed to setup loop device for 
>> /home/edson/ng-trunk/nodegrid/tmp/work/genericx86_64-poky-linux/nodegrid/1.0-r0/deploy-nodegrid-image-complete/nodegrid-genericx86-64-20200328134151.rootfs.btrfs.
>>
>> I saw in image.bbclass the creation of do_image_btrfs task with flag 
>> 'fakeroot'.
>>
>> ====== image.bbclass ====
>>         task = "do_image_%s" % t.replace("-", "_").replace(".", "_")
>>
>>         d.setVar(task, '\n'.join(cmds))
>>         d.setVarFlag(task, 'func', '1')
>>         d.setVarFlag(task, 'fakeroot', '1')
>> =======================
>>
>> would the fakeroot flag allow do_image_btrfs execute commands that 
>> requires root privilege ?
>>
>> If not what would be the way to execute the mount command ?
>>
>> I tried "pseudo mount" but it failed same way...
>>
>> Thanks in advance.
>>
>> Edson.
>>
>> *Edson Seabra*
>>
>> Principal Engineer
>>
>> M +1 510 579 0843
>>
>> *E *edson.seabra@zpesystems.com 
>> <mailto:alvin.chan@zpesystems.com>
>>
>> 1506169147061_OutlookEmoji-1505330244060_ZPELogo_Email.png1e6c5898-d340-4c90-8c28-e559c26bc7d1.png
>> 46757 Fremont Blvd., Fremont, CA 94538
>> *zpesystems.com* <https://www.zpesystems.com/>* | **Request a Nodegrid 
>> Demo <https://www.zpesystems.com/demo/>*
>>
>>
> 
> 
> 



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

end of thread, other threads:[~2020-04-04 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28 15:30 Compressing btrfs image Edson Seabra
2020-03-28 15:38 ` Edson Seabra
     [not found] <f3c697f3-7689-eb9a-93e0-c3941ac24142@outlook.com>
2020-03-28 20:06 ` [yocto] " Konrad Weihmann
2020-04-04 16:18   ` Gmane Admin

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.