I recently released an Offline Bundle for installing the ProFTP Daemon in ESXi 5.x. This was the result of a self-educational project: The subject of this project was not really how to develop software for ESXi, but how to nicely package software for ESXi in a way that makes it easy to distribute and easy to deploy and use for the average VMware administrator. I chose the example of an FTP daemon, because I already stumbled several times over requests for having this available in ESXi, and I know that there were some hacks for it around since the days of ESXi 3.5.
I promised to share what I have learnt in this project, and I will deliver on this promise in three parts. This first part is about binaries and binary compatibility.
About ESXi's relationship to Linux
Since the beginning of VMware ESX there were ongoing rumors that the classic ESX and also the modern ESXi hypervisor are derived from Linux. I really do not want to pick up this discussion here ... just some words of clarification that will help to understand the following: For sure the initial reason for this rumor (and misinformation!) was the fact that the so called Service Console OS of the classic ESX (that ended to exist with ESX 4.1) was indeed a modified Redhat Linux distribution. However, the VMKernel that includes VMware's core hypervisor functionality is proprietary and undisclosed code that is not derived from the Linux kernel - at least this is what VMware claims and today there is no reason to not believe them.
With ESXi the Service Console is gone, but there is still an ESXi Shell, and if you have ever explored the directory structure that is available in this shell then you will have noticed the GNU C Library (libc.so) in both 32bit (in /lib) and 64bit (in /lib64) among other GPL'ed GNU libraries there. All Linux distributions - but also most of the other free and commercial Unix-like Operating Systems - are based on these libraries, and so is ESXi. This is not really a surprise - It would be more of a surprise if VMware had taken the huge effort of developing their own set of libraries for ESXi. Why not use what already exists and is freely available? Still interesting though is that ESXi also includes a library named ld-linux.so: This is a shared library that is used for loading and executing Linux binaries in the common ELF format.
What does that mean? Well, this most certainly means that VMware uses Linux for developing and compiling at least parts (but probably all) of ESXi, and - even more important for us - that ESXi can run Linux binaries! Not all of them, but ...
Getting the right binaries
... those that use no shared libraries (i.e. are statically linked) or only those libraries that are available in ESXi.
Now that we want to get an application like ProFTPD to run in ESXi we basically have two options:
- Compile it from its source code inside a Linux OS, but in a way that the resulting binary does only depend on the libraries that are available in ESXi. This process is known as Cross-compiling, and it needs an experienced Linux software developer to get this done right ... Guess what I am not ;-)
- Get your hands on a precompiled Linux software package that already meets our specific requirement.
Most Linux software packages are distributed in RPM (Redhat Package Manager) format, and there are multiple search engines available for finding RPM files of a specific application: I used http://rpmfind.net to search for proftpd packages and got 202(!) hits - all differing in the proftpd version (today the latest one is 1.3.4b), the specific Linux distribution (different version of Fedora, OpenSUSE, Mandriva etc.) that the package was built for, and the CPU architecture (32bit vs. 64bit).
Luckily - when looking at the details of the search results - rpmfind.net will also show you a list of the required libraries (and other dependencies) for each of the packages. So I ended up in selecting a package with a somewhat recent version (1.3.3) of proftpd, having the shortest list of requirements and being 64bit (because ESXi is based on 64bit code since version 4, although I'm quite sure that even ESXi 5.1 would still also run 32bit Linux binaries). It was the proftpd-1.3.3-1rt.x86_64.rpm package of the (probably not very well known) RobLinux distribution. At this point I want to thank its maintainer Roberto Taglioretti for providing this package - it turned out to be a perfect fit!
Unpacking and testing the binary
Besides some meta data RPM files include a cpio archive of all the files and directories that make up the package, and I was able to extract this cpio-file with the Windows version of 7zip (Linux users will want to use the rpm2cpio tool for this). After I uploaded the cpio-file to a datastore of an ESXi 5.1 host I opened a shell on this host and extracted the cpio-file with the command
cpio -idv < name-of-cpio-file
This also unpacked the proftpd daemon binary, and I was really able to execute that in the ESXi shell without any error messages! If the binary was not suitable for ESXi it would have thrown error messages about missing required libraries or generated segmentation faults.
... To be continued ...
This was the first part of the "Daemon's VIB" series. In the next part we will add some files to our package to make sure that the daemon starts automatically at system boot and to configure the ESXi firewall.
No comments:
Post a Comment
***** All comments will be moderated! *****
- Please post only comments or questions that are related to this post's contents!
- Advertising and link spamming will not be tolerated!