is there way to rename default linux directories (dev, sbin, root, etc.)
Ok, strange question. I want to rename (move and rename, to be more precise) default Linux directories such as dev or sbin (e.g., to /system/devices and /administration/binary). I tried to find some settings in menuconfig of kernel's compilation, but, at the first sight, the kernel does not have options for this. Is it possible without symlinking and other dishonest ways?
Well, yes and no.
The Linux kernel actually doesn't care about most of them, aside from just a few paths (such as direct firmware loading from /lib/modules/*/firmware
, or upcalls such as /sbin/request-key
). Everything else is exclusively used just by userspace tools. The /sbin/init
path is only special to the kernel if you do not have an initramfs – if you do, then it's the initramfs that decides what to execute as init.
So as far as the kernel goes, you can rename almost everything freely, and just patch a few remaining hardcoded paths if necessary.
However, every other package cares about these paths. Various programs will have standard paths compiled in – for example, just like most scripts have a fixed interpreter path like #!/bin/sh
declared at the top, so does every ELF binary executable reference the path /lib/ld-linux.so.2
as the "ELF interpreter" (statically-linked executables being the exception).
At compile time, many programs also look up specific paths via pkg-config and embed them in the program itself or its data files. For example, most daemons expect their configuration files to be specifically in /etc
or /etc/theprogram
, etc.
So while this is technically possible, it's a lot of work – approximately like starting your own distro completely from scratch – and most likely you will still need to keep symlinks like /bin -> /Programs
for compatibility. Actually, some distributions like Gobo Linux have tried exactly this, and they have to keep symlinks anyway.