Download, untar any-engine and cd there.

tar xf any-current.tgz
cd any-current

Replace 'current' version of any-engine with an actual one. For version 0.11.1 it will be:

tar xf any-0.11.1.tgz
cd any-0.11.1

Download any-lfs scripts and package sources:


Put all lfs materials inside the working directory:

for i in any-lfs-8.0.tgz lfs-packs-8.0.tar ; do
    tar xf ${i}

Build instructions

The full build sequence is as follows.

Make available any commands:


Build all packages from tools. Their names are written in text file tools.src.

any do lfs,pass1 tools.src

Prepare for work with chroot.

sudo chroot `pwd` /bin/bash --login
chown root:root \
    /tools/bin/mount \
    /tools/bin/sudo \
    /tools/bin/umount \
chmod 4555 /tools/bin/mount /tools/bin/sudo /tools/bin/umount
cp /tools/etc/sudoers /etc/
After preparations above our self-built isolated environment will be ready for regular chrooting with anch command.

Build all essential packages before bash.

PATH="${PATH}:/tools/bin" PROGSU=/tools/bin/sudo anch do lfs lfs-part1.src
After the end of this command bash will be installed into environment. With launching next command fresh-built bash will be used instead of the one from /tools directory.

PATH="${PATH}:/tools/bin" PROGSU=/tools/bin/sudo anch do lfs lfs-part2.src

Here we have all packages built. We need to do some preparations for further installation.

lspkg -f lfs lfs-part1.src,lfs-part2.src 2> /dev/null > package-list.txt
rm -rf tools
rm -rf ./build/work
File package-list.txt will keep names of all binary packages we have just built. It will be used for installation to target machine.

The following steps are needed for further building packages from BLFS.

sudo chroot `pwd` /bin/bash --login
chown -R root:root \
    /bin/mount \
    /usr/bin/sudo \
    /bin/umount \
    /usr/libexec/sudo/ \
    /etc/sudoers /etc/sudoers.d
chmod 4555 /bin/mount /usr/bin/sudo /bin/umount

Now our host environment is completely ready for building new packages.

anch do lfs some-package-1.2.3
anch do lfs something-large.src

Installation instructions

In the example below we use device file /dev/sdd as the target for our installation. Commands of this section should be executed from root user.

Create partitions on /dev/sdd device for our installation.

gdisk /dev/sdd
# create BIOS Boot partition (/dev/sdd1)
# create Main partition (/dev/sdd2)
mkfs.ext4 /dev/sdd2

Prepare directory layout on target disk:

mount /dev/sdd2 /mnt
tar xfp build/pack/lfs/rootdirs-0.0*.tgz -C /mnt
# mount other partitions, if you had done some
# mount /dev/sdd3 /mnt/var
# mount /dev/sdd4 /mnt/tmp

Install packages!

for i in $( cat package-list.txt ) ; do
    tar xfp build/pack/lfs/$i -C /mnt
rm -rf /mnt/tools
rmdir /mnt/lib64
ln -s lib /mnt/lib64

Now edit configuration files to boot up.

# edit /mnt/etc/fstab
# edit /mnt/boot/grub/grub.cfg

We need to setup our installed environment: execute package scripts for their correct work. For that we manually chroot into that environment.

cp any/bin/enter /mnt/sbin/
chroot /mnt

Now do the setup.

ln -s bash /bin/sh
for i in /var/lib/pkg/scripts/* ; do

Generate password for root user.


We need to initialise GRUB in order to boot from the device.

/etc/rc.d/rcS.d/S00mountvirtfs start
/etc/rc.d/rcS.d/S10udev start
grub-install --target=i386-pc /dev/sdd
Starting services is needed in order to give GRUB information about disk devices.

Clean up and leave the chrooted environment.

pkill -9 udevd
umount /run /sys /proc /dev

Now unmount installed disk device.

# if we did additional partitions:
# umount /mnt/tmp
# umount /mnt/var

umount /mnt

And we are done!


In the example above we install our self-built system to /dev/sdd2 partition. We can reboot, choose lfs menu entry in grub and get to it.

Moreover, the entire system had been saved in directory build/pack/lfs/ in form of binary tar packages. It can be reinstalled again to another device or machine.