I am trying to create my own PID 1 init script, to be called from the boot cmdline with init=/myscript. How can I make it work on a real filesystem, with any kernel?
When it runs in an initrd, it works fine and can mount things, etc. - but when I use it on my filesystem without an initrd, it fails to mount things, because:
mount: only root can do that (effective UID is 1000)
When I strace any command that fails, it inevitably issues geteuid32() and that returns 1000. Why? How can I run as euid 0?