iPXE discussion forum

Full Version: iPXE with multiple initrd permissions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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...
kernel http://web/boot/vmlinuz
initrd http://web/boot/core.gz
initrd http://web/boot/bootlocal.sh /opt/bootlocal.sh
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.
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:

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

That should avoid the execute bit problem.
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.
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
Reference URL's