[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] febootstrap and zypper



On Fri, Nov 30, 2012 at 08:38:24PM +0100, Olaf Hering wrote:
> I think it does. With the --root option above it considers only
> packages within that directory. Other than that, I think only
> --pkg-cache-dir needs to be set because an unprivileged user has no
> write permissions in /var/cache/zypp.

That all sounds good, so ignore what I said in the other reply.

> So I think if febootstrap takes files from the installed system and
> in addition looks at the possibly downloaded packages then all
> should be fine.

At boot time, febootstrap-supermin-helper takes files from the
installed system.  Except for files that could have changed (/etc
files, or more specifically, files marked with %config).  Those files
come from the RPMs.  We ensure the non-%config files exist on the host
by using dependencies:

  http://pkgs.fedoraproject.org/cgit/libguestfs.git/tree/libguestfs.spec#n94

It's actually fairly easy to understand how it all works if you run
febootstrap on a system like Fedora that already has a package
handler.  None of these commands need root, or will damage your
system.

  $ cd /tmp; febootstrap --names bash
  febootstrap: warning: some host files are unreadable by non-root
  febootstrap: warning: get your distro to fix these files:
  	     /usr/sbin/build-locale-archive
  	     /usr/sbin/glibc_post_upgrade.x86_64

[after a few minutes, two files are created in the current directory]

  $ ls -l
  -rw-rw-r--.  1 rjones rjones    466258 Nov 30 19:56 hostfiles
  -rw-rw-r--.  1 rjones rjones   2732544 Nov 30 19:56 base.img
  $ wc -l hostfiles
  17552 hostfiles
  $ grep /bin/bash hostfiles 
  /usr/bin/bash
  /usr/bin/bashbug-64
  $ cpio -itv < base.img
  [...]
  -rw-r--r--   1 rjones   rjones        158 Nov 30 19:56 etc/hosts
  -rw-r--r--   1 rjones   rjones        370 Nov 30 19:56 etc/hosts.allow
  -rw-r--r--   1 rjones   rjones        460 Nov 30 19:56 etc/hosts.deny
  -rw-r--r--   1 rjones   rjones        942 Nov 30 19:56 etc/inputrc
  -rw-r--r--   1 rjones   rjones          0 Nov 30 19:56 etc/ld.so.cache
  -rw-r--r--   1 rjones   rjones         28 Nov 30 19:56 etc/ld.so.conf
  drwxr-xr-x   2 rjones   rjones          0 Nov 30 19:56 etc/ld.so.conf.d
  -rw-r--r--   1 rjones   rjones          0 Nov 30 19:56 etc/motd
  -rw-r--r--   1 rjones   rjones       1706 Nov 30 19:56 etc/nsswitch.conf
  drwxr-xr-x   2 rjones   rjones          0 Nov 30 19:56 etc/opt
  -rw-r--r--   1 rjones   rjones        609 Nov 30 19:56 etc/passwd
  [...]

'base.img' contains the directory outline and configuration files,
while 'hostfiles' is a list of files that will be pulled in from the
host filesystem.  'base.img' + 'hostfiles' is what we call the
"supermin appliance".

To reconstruct a real appliance (as is done when libguestfs runs), do:

  $ mkdir output
  $ febootstrap-supermin-helper --format ext2 \
      base.img hostfiles `uname -m` \
      ouput/kernel output/initrd output/appliance
  $ ls -l output/
  total 283112
  -rw-r--r--. 1 rjones rjones 4294967296 Nov 30 20:00 appliance
  -rw-rw-r--. 1 rjones rjones    1220608 Nov 30 20:00 initrd
  lrwxrwxrwx. 1 rjones rjones         33 Nov 30 20:00 kernel -> /boot/vmlinuz-3.6.2-2.fc18.x86_64

And that's all there is to it.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]