TIP: Getting rid of permission error when compiling kernel from GIT source
Problem
So recently I was in a situation where I had to use the git-bisect tool to find a bug that was causing my system to hang during early boot. One of the first step to do that is to get kernel git tree on your system where you will compile kernels. So I did the following:
debian:/usr/src/# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
After that I copied by existing .config file and issue a make-kpkg compile command:
debian:/usr/src/# cd linux-2.6
debian:/usr/src/linux-2.6# cp /home/kushalk/.config .
debian:/usr/src/linux-2.6# make-kpkg --append-to-version=-bisect1 kernel_image
Towards the end of the compilation process I got the following error message:
dpkg-deb: building package `linux-image-2.6.31-bisect1' in `../linux-image-2.6.31-bisect1_2.6.31-bisect1-10.00.Custom_i386.deb'.
dpkg-deb: control directory has bad permissions 2755 (must be >=0755 and <=0775)
make[2]: *** [debian/stamp/binary/linux-image-2.6.31-bisect1] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6'
make[1]: *** [debian/stamp/binary/pre-linux-image-2.6.31-bisect1] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6'
make: *** [kernel_image] Error 2
debian:/usr/src/linux-2.6#
Solution
Clearly it looks like a directory permission issue. However, don’t try to find and change the “control” directory permission as the message indicates. The real problem is your entire source directory that was fetch from the Git tree.
debian:/usr/src/linux-2.6# cd ..
debian:/usr/src/# ls -l
total 274744
-rw-r--r-- 1 root src 55659 2011-01-12 18:34 config-2.6.30-3-bpo50-atom
drwxr-sr-x 26 root src 4096 2011-01-12 23:14 linux-2.6
drwxrwxr-x 24 root root 4096 2011-01-12 18:44 linux-2.6.30.10
-rw-r--r-- 1 root src 75791486 2009-12-04 06:05 linux-2.6.30.10.tar.gz
drwxr-xr-x 25 root root 4096 2011-01-12 19:04 linux-2.6.31
debian:/usr/src/#
As you can see in the above output of the ls command, the real problem is the attribute “s” (in red) that is set on your source directory. We need to get rid of it by the following command:
debian:/usr/src/# chmod -R a-s linux-2.6
Now give your make-kpkg command again and you won’t get the directory permission error message.
That’s it!


Email Subscription









February 21st, 2012 at 12:59 am
Thank you, correct solution.
Reply to this comment