febootstrap: Fedora equivalent of debootstrap

As I mentioned before I was looking for a Fedora equivalent of Debian’s debootstrap. The alternatives aren’t really great, so I wrote one instead. Allow me to present febootstrap, a close copy of debootstrap.

One advantage of febootstrap is that it can build new Fedora instances without needing to be root. I use fakeroot and fakechroot to achieve this. These allow you to run commands so that they “think” they’re running as root, when in fact they aren’t. They are frequently used tools in the Debian world, for example, for building and testing packages reproducibly.

$ febootstrap fedora-10 ./f10
$ ls -l ./f10/
total 1096
drwxr-xr-x  2 rjones rjones   4096 2009-03-19 18:38 bin
drwxr-xr-x  2 rjones rjones   4096 2008-09-06 11:13 boot
drwxr-xr-x  4 rjones rjones   4096 2008-09-06 11:13 dev
drwxr-xr-x 14 rjones rjones   4096 2009-03-19 18:38 etc
-rw-rw-r--  1 rjones rjones 231038 2009-03-19 18:38 fakeroot.log
[&c .. note the owner/perms will be correct in the initrd.img]
$ febootstrap-to-initramfs ./f10 > initrd.img

$ febootstrap --groupinstall="Mail Server" fedora-10 ./mailserver
$ febootstrap-to-initramfs ./mailserver > initrd.img

The next step is to work on minimizing those filesystems. At the moment, a “minimal” Fedora install, by which I mean only bash and coreutils and their dependencies, is a shocking 233 MB. If I write that to an initrd image, then that means 233 MB of real RAM is consumed before we even start running the kernel or any programs! Particularly for virtualized environments, this is a real problem. I plan a minimization tool which can strip out anything except the binaries, libraries and other files that are really needed.

(Please note if you really try this, you will certainly need to apply the patch to fakechroot, which can be found in the tarball. That patch is not optional).


Filed under Uncategorized

23 responses to “febootstrap: Fedora equivalent of debootstrap

  1. Awesome! Exactly what I need. Now I can painlessly switch my last Gentoo machine to CentOS or Fedora ๐Ÿ™‚

  2. Pingback: Why “minimal” is 225 MB « Richard WM Jones

  3. You might consider using containers… then you can actually have root in your new environment. Check out OpenVZ (http://wiki.openvz.org).

    I maintain the contributed Fedora OS Templates.

  4. rwmj

    Scott, yes I’d love to use containers. The problem is that I need to be root to be able to make one, hence I’m back to square #1 on that front. The specific problem with OpenVZ is that it’s not the standard Fedora kernel. Hopefully all the container patches will enter upstream soon.

  5. Hi,

    I am trying febootstrap, but I get following error when I use this command “febootstrap fedora-10 ./f10”

    Error: Cannot retrieve repository metadata (repomd.xml) for repository: febootstrap. Please verify its path and try again.

    I installed this package according to README:

    make install (as root)

    I didn’t get any error

    Should I create a ticket in Bugzilla?


  6. rwmj

    Have you patched fakechroot (see the README)?

  7. I am using the version that was tested:

    [root@gondor febootstrap-1.0]# rpm -qa |grep fakeroot

    There is this information in README:

    – Tested with version 1.11

    Should I patch my fakeroot?

  8. rwmj

    No, you should patch fakechroot, read the README file carefully, or try the RPMs that I put up yesterday.

  9. Same Error again!

    I installed the src packet, created archives rpm, installed all it and nothing change, same error:

    Error: Cannot retrieve repository metadata (repomd.xml) for repository: febootstrap. Please verify its path and try again

    This means problem with repository, no? I don’t know if I must create one to it works.

    Please I wanna test it. Because I will write a article in Fedora Project from Brazil! ๐Ÿ˜€

  10. rwmj

    You’ll need to check the source code and debug it. I can’t tell what’s wrong from the error message.

  11. rwmj

    Rafael, please try version 1.3 which should fix the problem you are having.

  12. Ok, it works now, but to improve this we must copy this files to new system:


    We must mount the proc partition with this command before chroot:

    mount proc /opt/rawhide -t proc

    But one question, how can I use yum in this “jail”?

    When I try use this I get this error:

    Error: Cannot retrieve repository metadata (repomd.xml) for repository: rawhide. Please verify its path and try again

    What file I need to this works?

    Febootstrap is very good! I am understanding more about it to write something.

    Good job!

  13. I found the problem.

    Problem with name resolution.

    I fix this problem with this command:

    cp /etc/resolv.conf rawhide/etc/

    It is possible put these copy in instruction to create a “new system”?

    Thank you!!!

  14. Another question. I don’t know if here is better place to do this, but until I don’t know where, I will talk here, ok?

    With this command:

    febootstrap-to-initramfs ./rawhide > initrd.img

    I got this initrd.img with 705MB:

    705M initrd.img

    But my rawhide folder has 379 MB:

    379M rawhide/

    Why this can happens? I am not a development guy, I just a Sysadmin, my knowledge about devel is limited.

    Thank you!

  15. Pingback: Febootstrap, o Debootstrap do Fedora

  16. rwmj

    Rafael, in answer to your several questions:

    (1) /etc/fstab, mtab, resolv.conf etc: Yes we need to install some extra files in the root. At the moment I tend to mount and install stuff in the /init script (see the examples/*.sh). But we can do better for this.

    (2) Running stuff in the root: Right now you have to run fakechroot … fakeroot by hand. See the scripts and manual page. I will add a “febootstrap-run” script to make this easier.

    (3) 705MB initrd.img: This is a real strange one, I have absolutely no idea how it can get bigger! The initramfs images are compressed, so they should be smaller … You could try looking at the image itself to see what’s going on, ie. zcat initrd.img | cpio -itv

  17. Thanks! the application is great!

  18. David

    Thanks for the program, for a debootstrap user like myself it is nice to have a comparable command when I need to switch streams.

    When I use `febootstrap –groupinstall=”Base” fedora-11 ./ ` I get the group “Base” as requested, then dependency resolution gives me the whole XWindows environment to resolve dependencies, arguably not Base.

    With debootstrap the default is “base” and then user defined packages are added and dependencies solved – I prefer that system as the problem I’m having is that yum seems a bit too clever for its own good here.

    Where are the yum grouplists looked after? Base is extremely bloated with mdadm, hunspell, mlocate, dmraid as default installs.

    • rich

      You probably want to install the “Core” group, which doesn’t include X.

      On the other hand, Core is still fairly large. You can get a smaller image by installing just the package “bash” + whatever programs you need, and then minimizing the whole thing. That will give you something similar to debootstrap base.

      Note that you can specify programs by path (eg. /usr/sbin/tcpdump) and yum will find the right package for you.

      yum grouplists are managed in a thing called “comps.xml”, and there is a project to minimize the size of Fedora, but don’t hold your breath — it’s not a priority of anyone except us!

  19. jay

    This is fantastic! I too have long wanted the ability to bootstrap a minimal Fedora.

    I know this post is a bit old (I got here from your supermin appliance post) but I was wondering how this related to tools like Revisor, which let you roll your own Fedora (and incidentally, which has never worked for me).

  20. rich

    Hi Jay,

    I’ve not used Revisor specifically, but there are several tools in this area: for example, livecd-creator and appliance-creator. All of them (including febootstrap) are essentially wrappers around “yum”.

    The difference with febootstrap is we needed something that could be run as non-root. All other tools require root, which makes it impossible to use them from “make”, scripts, Fedora’s build system, web services etc.


  21. jay

    Thanks Rich.

    It certainly makes sense to use yum (I’ve always thought the package manager should be best @ something like… installing packages).

    Having built rpm to include with my LFS bootstrap, I know it takes a heck of a lot of support code before the package repo magic can even work so I’d just assumed you guys had some other magic sauce!

    I’m excited to give febootstrap a try, gotta get my Eucalyptus image up next!

    Thanks again!

  22. Great tool!

    Is any method to create xen domU using this tool?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.