setcap using recipe
Hello All,
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
Thanks and Regards
Shrawan
Hi,
Quoted 19 lines · Shrawan
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld
Quoted 7 lines
}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set CAP_SETFCAP effective capability: Operation not permitted.”
But when I use # sudo setcap cap_net_raw+ep helloworld on command line I am able to set the cap.
To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipe
Hi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
What version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
Quoted 92 lines · Shrawan
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set
CAP_SETFCAPeffective capability: Operation not permitted.”But when I use # *sudo* setcap cap_net_raw+ep helloworld on
command line I am able to set the cap.To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
*From:* Burton, Ross [mailto:[email protected]] *Sent:* Friday, June 24, 2016 5:09 PM
*To:* Kumar, Shrawan
*Cc:* [email protected]
*Subject:* Re: [yocto] setcap using recipeHi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:56 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipe
What version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set CAP_SETFCAP effective capability: Operation not permitted.”
But when I use # sudo setcap cap_net_raw+ep helloworld on command line I am able to set the cap.
To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
Hi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Looks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
Quoted 124 lines · Shrawan
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
*From:* Burton, Ross [mailto:[email protected]] *Sent:* Friday, June 24, 2016 5:56 PM
*To:* Kumar, Shrawan
*Cc:* [email protected]
*Subject:* Re: [yocto] setcap using recipeWhat version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set
CAP_SETFCAPeffective capability: Operation not permitted.”But when I use # *sudo* setcap cap_net_raw+ep helloworld on
command line I am able to set the cap.To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
*From:* Burton, Ross [mailto:[email protected]] *Sent:* Friday, June 24, 2016 5:09 PM
*To:* Kumar, Shrawan
*Cc:* [email protected]
*Subject:* Re: [yocto] setcap using recipeHi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Hello Ross,
Against which version this patch is applicable . I am using pseudo-1.7.4 and could not find capset.c file under “ports/linux/guts/ directory .
Can you please help here ?
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipe
Looks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:56 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
What version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set CAP_SETFCAP effective capability: Operation not permitted.”
But when I use # sudo setcap cap_net_raw+ep helloworld on command line I am able to set the cap.
To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
Hi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Hello Ross,
Could your update on my issues ?
Regards
Shrawan
From: [email protected] [mailto:[email protected]] On Behalf Of Kumar, Shrawan
Sent: Monday, June 27, 2016 12:04 PM
To: Burton, Ross
Cc: [email protected]
Subject: Re: [yocto] setcap using recipe
Hello Ross,
Against which version this patch is applicable . I am using pseudo-1.7.4 and could not find capset.c file under “ports/linux/guts/ directory .
Can you please help here ?
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
Looks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:56 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
What version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set CAP_SETFCAP effective capability: Operation not permitted.”
But when I use # sudo setcap cap_net_raw+ep helloworld on command line I am able to set the cap.
To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
Hi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Quoted 3 lines · Shrawan
Could your update on my issues ?
The patch is probably against a newer version. If you're unable to switch to the latest version of pseudo to debug this then you can run setcap in a postinst.
Ross
Hello Ross,
None of the approach is working . I have attached the recipe where I am trying to execute postinst . It builds successfully , But when I run getcap on the target , does not return the set capabilities.
Help will be highly appreciated .
Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipe
Looks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:56 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
What version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set CAP_SETFCAP effective capability: Operation not permitted.”
But when I use # sudo setcap cap_net_raw+ep helloworld on command line I am able to set the cap.
To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]<mailto:[email protected]>]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [yocto] setcap using recipe
Hi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
install -d ${D}/lib/systemd/system
install -m 0755 hello.service ${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Does your target filesystem support it? ubifs doesn't :(
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_xattr
2016-07-01 9:53 GMT-03:00 Kumar, Shrawan <[email protected]>:
Quoted 180 lines
Hello Ross,
None of the approach is working . I have attached the recipe where I am trying to execute postinst . It builds successfully , But when I run getcap on the target , does not return the set capabilities.
Help will be highly appreciated .
Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeLooks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:56 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeWhat version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set
CAP_SETFCAPeffective capability: Operation not permitted.”But when I use # sudo setcap cap_net_raw+ep helloworld on command
line I am able to set the cap.To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeHi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Signature · 2 lines
"Do or do not. There is no try" Yoda Master
Hello,
I think that the main issue here is that the pkg_postinst function runs its action at the rootfs creation time, and not on the target as advised by Ross.
The chapter 5.3.16, "post-installation scripts" in the mega-manual offers some detailed explanations on how to make it run after the first boot.
Regards,
Mathieu
----- Original Message -----
From: "Daniel." <[email protected]>
To: "Kumar, Shrawan" <[email protected]>
Cc: [email protected]
Sent: Friday, July 1, 2016 3:54:15 PM
Subject: Re: [yocto] setcap using recipe
Does your target filesystem support it? ubifs doesn't :(
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_xattr
2016-07-01 9:53 GMT-03:00 Kumar, Shrawan <[email protected]>:
Quoted 180 lines
Hello Ross,
None of the approach is working . I have attached the recipe where I am trying to execute postinst . It builds successfully , But when I run getcap on the target , does not return the set capabilities.
Help will be highly appreciated .
Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeLooks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:56 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeWhat version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set
CAP_SETFCAPeffective capability: Operation not permitted.”But when I use # sudo setcap cap_net_raw+ep helloworld on command
line I am able to set the cap.To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeHi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Signature · 7 lines
"Do or do not. There is no try" Yoda Master -- _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
Hmmm I see,
Well, I didn't note that. And yeah, that command should be ran at first boot, (that feature saved my life a bunch of times :) )
Regards,
2016-07-01 11:03 GMT-03:00 Mathieu Allard <[email protected]>:
Quoted 214 lines
Hello,
I think that the main issue here is that the
pkg_postinstfunction runs its action at the rootfs creation time, and not on the target as advised by Ross.The chapter 5.3.16, "post-installation scripts" in the mega-manual offers some detailed explanations on how to make it run after the first boot.
Regards,
Mathieu
----- Original Message -----
From: "Daniel." <[email protected]>
To: "Kumar, Shrawan" <[email protected]>
Cc: [email protected]
Sent: Friday, July 1, 2016 3:54:15 PM
Subject: Re: [yocto] setcap using recipeDoes your target filesystem support it? ubifs doesn't :(
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_xattr2016-07-01 9:53 GMT-03:00 Kumar, Shrawan <[email protected]>:
Quoted 174 lines
Hello Ross,
None of the approach is working . I have attached the recipe where I am trying to execute postinst . It builds successfully , But when I run getcap on the target , does not return the set capabilities.
Help will be highly appreciated .
Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeLooks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:56 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeWhat version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set
CAP_SETFCAPeffective capability: Operation not permitted.”But when I use # sudo setcap cap_net_raw+ep helloworld on command
line I am able to set the cap.To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeHi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Quoted 6 lines
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto--
"Do or do not. There is no try"
Yoda Master
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Signature · 2 lines
"Do or do not. There is no try" Yoda Master
Dear All,
The aim of my exercise is to apply "setcap " on an executable during rootfs creation.
I should be able to view the set capability using getcap utility when this rootfs is mounted on the target. As I said earlier none of the suggested approach is working here.Currently I am qemux86 is my target.
Can someone review the attached recipe and help solve the problem statement ?
Regards
Shrawan
-----Original Message-----
From: Daniel. [mailto:[email protected]]
Sent: Friday, July 01, 2016 7:54 PM
To: Mathieu Allard
Cc: Kumar, Shrawan; [email protected]
Subject: Re: [yocto] setcap using recipe
Hmmm I see,
Well, I didn't note that. And yeah, that command should be ran at first boot, (that feature saved my life a bunch of times :) )
Regards,
2016-07-01 11:03 GMT-03:00 Mathieu Allard <[email protected]>:
Quoted 207 lines
Hello,
I think that the main issue here is that the
pkg_postinstfunction runs its action at the rootfs creation time, and not on the target as advised by Ross.The chapter 5.3.16, "post-installation scripts" in the mega-manual offers some detailed explanations on how to make it run after the first boot.
Regards,
Mathieu
----- Original Message -----
From: "Daniel." <[email protected]>
To: "Kumar, Shrawan" <[email protected]>
Cc: [email protected]
Sent: Friday, July 1, 2016 3:54:15 PM
Subject: Re: [yocto] setcap using recipeDoes your target filesystem support it? ubifs doesn't :(
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_xattr2016-07-01 9:53 GMT-03:00 Kumar, Shrawan <[email protected]>:
Quoted 175 lines
Hello Ross,
None of the approach is working . I have attached the recipe where I am trying to execute postinst . It builds successfully , But when I run getcap on the target , does not return the set capabilities.
Help will be highly appreciated .
Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 6:40 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeLooks like using setcap directly is broken currently, there are two workarounds:
1) use a postinst to invoke setcap on the target instead
2) test the patch for pseudo that is on this list ([PATCH] Add capset pseudo function that always succeeds) and verify that it fixes the problem for you.
Ross
On 24 June 2016 at 13:31, Kumar, Shrawan <[email protected]> wrote:
I am using Yocto 2.0.2
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:56 PMTo: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeWhat version of OE/Yocto are you using? Old versions of pseudo didn't support xattrs at all.
Ross
On 24 June 2016 at 13:23, Kumar, Shrawan <[email protected]> wrote:
Thanks Ross for your quick turn around , I am getting below error
“Unable le to set
CAP_SETFCAPeffective capability: Operation not permitted.”But when I use # sudo setcap cap_net_raw+ep helloworld on command
line I am able to set the cap.To achieve the sudo realization in recipe , I tried as below , but no luck…… Can you suggest something here ?
fakeroot
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service${D}/lib/systemd/system/
setcap cap_net_raw+ep ${D}${bindir}/helloworld}
Thanks and Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Friday, June 24, 2016 5:09 PM
To: Kumar, Shrawan
Cc: [email protected]
Subject: Re: [yocto] setcap using recipeHi,
On 24 June 2016 at 11:41, Kumar, Shrawan <[email protected]> wrote:
Is there a way to add a capability to a binary (cap_net_raw+ep),into a recipe?
Example :
do_install(){install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} install -d ${D}/lib/systemd/system install -m 0755 hello.service ${D}/lib/systemd/system/ setcap cap_net_raw+ep ${D}${bindir}/helloworld}
If yes is this correct approach to achieve the same from package recipe itself ?
capabilities on files are just extended attributes, so assuming that you have a fairly recent Yocto and your host and target filesystems support extended attributes, yes this should work.
Ross
Quoted 6 lines
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Quoted 8 lines
--
"Do or do not. There is no try"
Yoda Master
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
--
"Do or do not. There is no try"
Yoda Master
Quoted 3 lines · Shrawan
Can someone review the attached recipe and help solve the problem statement ?
As has been said, you need to ensure the postinst is delayed so it runs on the target and not on the build host.
http://www.yoctoproject.org/docs/2.1/dev-manual/dev-manual.html#new-recipe-post-installation-scripts
Ross
Hello Ross,
Post-installation scripts run immediately after installing a package on the target or during image creation when a package is included in an image. Does it not mean that we can set the file attributes(setcap) during image creation ?
I understand the delayed approach of executing it on the target, but my requirement is to do it on the build host. We do not want “setcap” utility to be present on the target.
Regards
Shrawan
From: Burton, Ross [mailto:[email protected]]
Sent: Saturday, July 02, 2016 2:56 PM
To: Kumar, Shrawan
Cc: Daniel.; Mathieu Allard; [email protected]
Subject: Re: [yocto] setcap using recipe
On 2 July 2016 at 10:22, Kumar, Shrawan <[email protected]<mailto:[email protected]>> wrote:
Can someone review the attached recipe and help solve the problem statement ?
As has been said, you need to ensure the postinst is delayed so it runs on the target and not on the build host.
http://www.yoctoproject.org/docs/2.1/dev-manual/dev-manual.html#new-recipe-post-installation-scripts
Ross
Quoted 4 lines · Shrawan
Post-installation scripts run immediately after installing a package on the target *or during image creation when a package is included in an image*.
Quoted 10 lines
Does it not mean that we can set the file attributes(setcap) during
image creation ?I understand the delayed approach of executing it on the target, but my requirement is to do it on the build host. We do not want “setcap” utility to be present on the target.
Then I suggest that you test the setcap patch that I pointed to earlier, you'll likely need the pseudo 1.8 upgrade that Joshua sent last night.
This should ensure that setcap works in the pseudo environment. Then
follow the instructions in image_types.bbclass to ensure that xattrs are preserved when the image is created, and check your kernel configuration to confirm that xattrs are supported. I recommend attempting to use fsetattr on the target directly to verify this. If all the pieces are in place then they should work.
There's a number of bugs in bugzilla for tracking these issues (#9859 is the metabug tracking them). Your help in solving this would be much appreciated!
Ross
Quoted 4 lines · Mathieu Allard
I think that the main issue here is that the
pkg_postinstfunction runs its action at the rootfs creation time, and not on the target as advised by Ross.
Yes, as I said in the first suggestion you'll need to ensure this runs on the target (check $D and exit 1 if its set).
Ross