• # Compilation du noyau sous root ?

    Posté par . En réponse à la dépêche Crux 3.1: une distribution KISS à la saveur BSD. Évalué à 5. Dernière modification le 25 juillet 2014 à 13:49.

    L’installation du noyau passe donc par un procédé standard :

    $ cd /usr/src/linux-3.12.24
    $ make menuconfig
    $ make all
    $ make modules_install
    $ cp arch/x86/boot/bzImage /boot/vmlinuz
    $ cp System.map /boot

    Tout ceci est supposé être fait en tant que root ? Alors ce n’est pas le procédé standard. Il n’y a aucune raison de configurer et compiler le noyau sous l’identité du superutilisateur, et les développeurs du noyau le déconseillent formellement.

    Extrait du README à la racine des sources du noyau :

    To do the actual install, you have to be root, but none of the normal build should require that. Don’t take the name of root in vain.

    Greg Kroah-Hartman en particulier insiste lourdement là-dessus, dans une page de « Linux Kernel in a Nutshell » que je me permets de citer largement (vu que la page en question est dans un PDF et que je ne peux donc pas y faire de lien direct) :

    Do not configure or build your kernel with superuser permissions enabled!
    [...]
    Only the two or three commands it takes to install a new kernel should be done as the superuser.
    There have been bugs in the kernel build process in the past, causing some special files in the /dev directory to be deleted if the user had superuser permissions while building the Linux kernel.1
    [...]
    Do not do any kernel development under the /usr/src directory tree at all, but only in a local user directory where nothing bad can happen to the system.

    1 This took quite a while to fix, as none of the primary kernel developers build kernels as root, so they did not suffer from the bug. A number of weeks went by before it was finally determined that the act of building the kernel was the problem. A number of kernel developers half-jokingly suggested that the bug remain in, to help prevent anyone from building the kernel as root, but calmer heads prevailed and the bug in the build system was fixed.