iPXE discussion forum
iPXE with multiple initrd permissions - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: iPXE with multiple initrd permissions (/showthread.php?tid=3730)



iPXE with multiple initrd permissions - brycez - 2012-07-31 22:15

I've been messing around with iPXE for a little while now, trying to get various aspects figured out, and one thing I'm having trouble with is booting with multiple initrd commands...
Code:
#!ipxe
kernel http://web/boot/vmlinuz
initrd http://web/boot/core.gz
initrd http://web/boot/bootlocal.sh /opt/bootlocal.sh
boot
This works just fine. I boot up and can see /opt/bootlocal.sh, the contents haven't change a bit... except that no matter how many times I change the file permissions on http://web/boot/bootlocal.sh, when I boot up and check /opt/bootlocal.sh it has the wrong permissions. I need that script to have execute permission so it can run on boot. The original bootlocal.sh in core.gz has execute, and the server copy of bootlocal.sh has execute, but after booting it doesn't and I'm having a hard time finding the magic words that google wants to lead me to understanding why.

If anyone could point me in the right direction on permissions with extra files loaded with initrd I'd appreciate it.


RE: iPXE with multiple initrd permissions - robinsmidsrod - 2012-08-01 15:18

As far as I know, setting ownership and/or permissions on the file loaded this way is not supported.

Most likely the most correct way to implement this is to make chown and chmod equivalent commands in iPXE, but I'm unsure how complicated that would be. I think this is a question more suited for the developer mailing-list.

A workaround is to create a script on the initrd that changes the permissions of /opt/bootlocal.sh before it tries to execute it, or invokes it explicitly with the shell, like this:

Code:
$ /bin/sh /opt/bootlocal.sh
$ /opt/bootlocal.sh # NOT THIS WAY

That should avoid the execute bit problem.


RE: iPXE with multiple initrd permissions - brycez - 2012-08-01 17:27

It looks like I'll have to use that sort of workaround for the time being. After some digging it appears that when you pull down a file with initrd it does not preserve the meta-data, so everything is just being reset by the umask of the system that boots. I'll write something up in the dev mailing list just to see if this is something that might make its way into production.


RE: iPXE with multiple initrd permissions - brycez - 2012-08-03 15:12

The dev mailing list did an amazing job of exceeding my expectations and Michael Brown resolved the issue by adding the mode=755 feature to the initrd command. http://git.ipxe.org/ipxe.git/commitdiff/d97c6a3