Creating a debian package
Not long ago i have started an upgrade of one of our company’s servers from old redhat to Debian. The main difficulty was one mission-critical process, that was running there in chroot. So i’ve got a task to create a debian package for this chrooted directory.
It seemed rather simple when starting the task, but i’ve read a rather big howto about package creation and went through to a Makefiles howto and after that i had about 10 tries before i made a simple package to build and to install as a i expected. So the package was only working, nothing to say about it’s conformance with Debian policy - lintian, a software which checks builded packages for errors,- gave a lot of errors about copyright, docs etc. etc. So a lot to do before uploading to official debian mirrors, but we didn’t intend to do that so i went on with making backups and creating needed package.
I spent about 12 hours before i made it to build and to do what i needed. After i tried it on one of our servers, i saw some errors and went on fixing. As i said the main part of a package is a chroot environment - /srv/software. I said chroot /srv/software and got an error: chroot: cannot execute /bin/bash: Permission denied. I googled for about half an hour - nothing found, so i asked my colleague for help. He noticed that file/directories permissions in a newly created (by the package installation) chroot directory were wrong, and really that was the reason.
Fixing the package for a while, after 2 rebuilds it was ready and i got rid of this problem. So, conclusions:
- when using cp command in any scripts/makefiles and especially when copying something recursively, pay attention to file/directory permissions, and, if you must preserve them, use cp -ax;
- when creating a debian package pay attention to the debian/rules file. It includes instructions to run various helpers (dh_*) during package installation process. One of those is dh_fixperms, which removes write attribute for everyone other than owner and sticky/suid bits from every file/directory which is installed by the package.
So, pay attention ![]()
2007-05-10 at 6.04 pm
Actually the problem was not in binary files permissions… Problem with that /bin/bash execution was caused by invalid permissions on Linux binary modules loader file (/lib/ld-xx.x.so or something like that) - it should always have +x permission for all users (0755 for example).
2007-05-10 at 6.52 pm
Yep, this was the beginning of investigations. I still don’t know how u have figured it out
Anyway, thanks for help and for comment
2007-05-10 at 7.02 pm
I don’t know too
I simply knew that it could be an issue, but don’t ask where this information from 