All of lore.kernel.org
 help / color / mirror / Atom feed
* Applying Patch to /etc/passwd file in Yocto
@ 2013-10-18  9:51 Amit Tomer
  2013-10-18 10:16 ` Paul Eggleton
  0 siblings, 1 reply; 3+ messages in thread
From: Amit Tomer @ 2013-10-18  9:51 UTC (permalink / raw)
  To: yocto@yoctoproject.org, yocto-request@yoctoproject.org

I wanted to apply a patch file /etc/passwd but after many attemps
din't get any success

Below is the file

poky/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb

which is responsible for copying  the modified passwd file to
/etc/passwd in my final image

install -p -m 644
${STAGING_DIR_TARGET}${datadir}/base-passwd/passwd.master
${STAGING_DIR_TARGET}${sysconfdir}/passwd

I believe above line copying the passwd file to /etc/passwd in my final image.

Now I need to modify this passwd furthur, so write a patch for it
belwo is my patch.

--- rootfs/etc/passwd   2013-10-18 02:03:50.119529158 -0500
+++ rootfs/etc/passwd   2013-10-18 02:05:01.703249079 -0500
@@ -18,7 +18,7 @@
 nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
 ftp:x:999:999::/var/lib/ftp:/bin/false
 fuwmshey:x:0:0::/user/fuwmshey:/bin/sh
-frfhsjk:x:998:998::/home/frfhsjk:/bin/sh
+frfhsjk:x:998:998::/home/frfhsjk:/bin/false
 quagga:x:997:997::/var/run/quagga:/bin/sh
 messagebus:x:996:995::/var/lib/dbus:/bin/false
 sshd:x:995:992::/var/run/sshd:/bin/false

Above is my patch

Exact patch of file to be patched is

/tmp/work/k2-poky-linux-gnueabi/image-k2/1.0-r0/rootfs/etc/passwd

Now below error we are getting while applying patch


ERROR: Command Error: exit status: 1  Output:
Applying patch passwd_fix.patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|
|---    rootfs/etc/passwd  2013-10-18 02:03:50.119529158 -0500
|+++ rootfs/etc/passwd 2013-10-18 02:05:01.703249079 -0500
--------------------------
No file to patch.  Skipping patch.
1 out of 1 hunk ignored
Patch passwd_fix.patch does not apply (enforce with -f)
ERROR: Function failed: patch_do_patch
ERROR: Logfile of failure stored in:   /
tmp/work/cortexa15hf-vfp-neon-poky-linux-gnueabi/base-passwd/3.5.26-r2/temp/log.do_patch.671
ERROR: Task 2059
(../poky/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb,
do_patch) failed with exit code '1'

Thanks
Amit


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

* Re: Applying Patch to /etc/passwd file in Yocto
  2013-10-18  9:51 Applying Patch to /etc/passwd file in Yocto Amit Tomer
@ 2013-10-18 10:16 ` Paul Eggleton
  2013-10-18 10:25   ` Amit Tomer
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggleton @ 2013-10-18 10:16 UTC (permalink / raw)
  To: Amit Tomer; +Cc: yocto

Hi Amit,

On Friday 18 October 2013 15:21:37 Amit Tomer wrote:
> I wanted to apply a patch file /etc/passwd but after many attemps
> din't get any success
> 
> Below is the file
> 
> poky/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb
> 
> which is responsible for copying  the modified passwd file to
> /etc/passwd in my final image
> 
> install -p -m 644
> ${STAGING_DIR_TARGET}${datadir}/base-passwd/passwd.master
> ${STAGING_DIR_TARGET}${sysconfdir}/passwd
> 
> I believe above line copying the passwd file to /etc/passwd in my final
> image.
> 
> Now I need to modify this passwd furthur, so write a patch for it
> belwo is my patch.
> 
> --- rootfs/etc/passwd   2013-10-18 02:03:50.119529158 -0500
> +++ rootfs/etc/passwd   2013-10-18 02:05:01.703249079 -0500
> @@ -18,7 +18,7 @@
>  nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
>  ftp:x:999:999::/var/lib/ftp:/bin/false
>  fuwmshey:x:0:0::/user/fuwmshey:/bin/sh
> -frfhsjk:x:998:998::/home/frfhsjk:/bin/sh
> +frfhsjk:x:998:998::/home/frfhsjk:/bin/false
>  quagga:x:997:997::/var/run/quagga:/bin/sh
>  messagebus:x:996:995::/var/lib/dbus:/bin/false
>  sshd:x:995:992::/var/run/sshd:/bin/false
> 
> Above is my patch
> 
> Exact patch of file to be patched is
> 
> /tmp/work/k2-poky-linux-gnueabi/image-k2/1.0-r0/rootfs/etc/passwd

How is this "frfhsjk" user getting into the passwd file in the first place? The 
reason you're getting the error is this line you are modifying is not even in 
the default passwd file you are attempting to patch; it presumably is added 
later on. Patching this file is not the correct way to modify it in the final 
root filesystem - you need to change it in the place where the user is actually 
being added.

Cheers,
Paul

PS: you should not send your mailing list postings also to yocto-request@, 
just yocto@.

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: Applying Patch to /etc/passwd file in Yocto
  2013-10-18 10:16 ` Paul Eggleton
@ 2013-10-18 10:25   ` Amit Tomer
  0 siblings, 0 replies; 3+ messages in thread
From: Amit Tomer @ 2013-10-18 10:25 UTC (permalink / raw)
  To: Paul Eggleton, yocto@yoctoproject.org

Thanks Paul for your reply

Yes frfhsjk is added inside the
poky/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb using sed
command

Now how do I achieve you need to change it in the place where the user
is actually
being added.

Though I am able to get desired changes using below

SRC_URI += "file://passwd"

do_install_append() {
install -d ${D}${sysconfdir}/base-passwd ${D}${sysconfdir}
passwd/passwd${STAGING_DIR_TARGET}${sysconfdir}/passwd

                    install -m 0644 ${WORKDIR}/passwd ${D}${sysconfdir}/passwd
}

But still wanted to do it from patch file.

Thanks

On Fri, Oct 18, 2013 at 3:46 PM, Paul Eggleton
<paul.eggleton@linux.intel.com> wrote:
> Hi Amit,
>
> On Friday 18 October 2013 15:21:37 Amit Tomer wrote:
>> I wanted to apply a patch file /etc/passwd but after many attemps
>> din't get any success
>>
>> Below is the file
>>
>> poky/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb
>>
>> which is responsible for copying  the modified passwd file to
>> /etc/passwd in my final image
>>
>> install -p -m 644
>> ${STAGING_DIR_TARGET}${datadir}/base-passwd/passwd.master
>> ${STAGING_DIR_TARGET}${sysconfdir}/passwd
>>
>> I believe above line copying the passwd file to /etc/passwd in my final
>> image.
>>
>> Now I need to modify this passwd furthur, so write a patch for it
>> belwo is my patch.
>>
>> --- rootfs/etc/passwd   2013-10-18 02:03:50.119529158 -0500
>> +++ rootfs/etc/passwd   2013-10-18 02:05:01.703249079 -0500
>> @@ -18,7 +18,7 @@
>>  nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
>>  ftp:x:999:999::/var/lib/ftp:/bin/false
>>  fuwmshey:x:0:0::/user/fuwmshey:/bin/sh
>> -frfhsjk:x:998:998::/home/frfhsjk:/bin/sh
>> +frfhsjk:x:998:998::/home/frfhsjk:/bin/false
>>  quagga:x:997:997::/var/run/quagga:/bin/sh
>>  messagebus:x:996:995::/var/lib/dbus:/bin/false
>>  sshd:x:995:992::/var/run/sshd:/bin/false
>>
>> Above is my patch
>>
>> Exact patch of file to be patched is
>>
>> /tmp/work/k2-poky-linux-gnueabi/image-k2/1.0-r0/rootfs/etc/passwd
>
> How is this "frfhsjk" user getting into the passwd file in the first place? The
> reason you're getting the error is this line you are modifying is not even in
> the default passwd file you are attempting to patch; it presumably is added
> later on. Patching this file is not the correct way to modify it in the final
> root filesystem - you need to change it in the place where the user is actually
> being added.
>
> Cheers,
> Paul
>
> PS: you should not send your mailing list postings also to yocto-request@,
> just yocto@.
>
> --
>
> Paul Eggleton
> Intel Open Source Technology Centre


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

end of thread, other threads:[~2013-10-18 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18  9:51 Applying Patch to /etc/passwd file in Yocto Amit Tomer
2013-10-18 10:16 ` Paul Eggleton
2013-10-18 10:25   ` Amit Tomer

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.