Table of Content

There are few sections here.

  • Preface: Postpone, Reading, Test Bed
  • Getting Started With Docker
  • No Package Management
  • Requirement Check
  • No Dependency Resolver
  • Example 1: less: Detail
  • Example 2: man-db: Dependency, Detail
  • Resolving Dependency: cheat
  • Conclusion

Preface

Goal: Examine Package Manager, Focus on Command Line Interface

You jump, I jump !

LFS (Linux From Scratch) is once scary for me when I was a beginner, but do not let the fear intimidate you. Once you jump to LFS and swim, you will know that the myth is not true at all.

This LFS is even easier with docker container, avoid daunting task such as setting up system. Therefore we can dive right away to compilation.

Here is I share my LFS experience. Of course this won’t we a full blown experience, since I have decided to postpone LFS learning.

Postpone

Unfortunately, I failed in some process, and I do not even know, whether it is my stupidity as usual, or by lack of docker limitation knowledge I have rarely give up, but I must admit I’m running out of time.

All I can say is, I have to pending this LFS experience, and continue LFS in chroot environment. I will write article later about this LFS.

Reading

Test Bed

  1. Container: Docker

  2. Operating System: Artix (OpenRC )

  3. Window Manager: Herbstluftwm

Since we are going to use docker again, you can read a common overview here.

Of course you can use virtualization, the issue is distraction. We need to avoid tendency to focus on GUI tools. At the same time, limiting the scope to CLI tools. Most of the time, CLI tools is considered lower level than the GUI one.


Getting Started With Docker

As usual, first, we do attach docker process.

$ docker pull kevinleptons/lfs-auto
$ docker image list 

  --format 'table {{.Repository}}\t{{.Size}}'

REPOSITORY              SIZE
gentoo/stage3-amd64     873MB
vbatts/slackware        86.7MB
voidlinux/voidlinux     202MB
kevinleptons/lfs-auto   753MB
$ docker run -it voidlinux/voidlinux bash
bash-4.4# exit
$ docker ps -a 

  --format 'table {{.Image}}\t{{.Names}}\t{{.Status}}'

IMAGE                   NAMES               STATUS
kevinleptons/lfs-auto   wonderful_nobel     Exited (127) 31 minutes ago
voidlinux/voidlinux     awesome_davinci     Exited (0) 12 hours ago
gentoo/stage3-amd64     amazing_shirley     Exited (0) 36 hours ago
vbatts/slackware        cranky_keller       Exited (0) 38 hours ago
$ docker start wonderful_nobel
wonderful_nobel
$ docker attach wonderful_nobel
bash-4.4#

Docker LFS: Getting Started


No Package Management

LFS use no Package Manager. You have to download manually and compile by yourself, sometimes with feeling of being stupid in the corner. But hey… you are going to feel closer to each package, and feel the intimacy too, which is good for learning


Requirement Check

Using guidance from LFS chapter 2.

$ bash version-check.sh

Docker LFS: Requirement Check


No Dependency Resolver

The fact that LFS has no package management, means you need to compile all the packages directly from source. Most compilation error that I experience comes from dependency issue. Most compilation works well after I address the dependency issue.

I was once trying to compile nano on my first jump to LFS in docker, and failed miserably. Then I realize nano needs ncurses. My second attempt is less, as I predict, less does not need any dependency. My third attempt is compile man-db. Unfortunately man-db required a few package as dependency. But after all, the process has been completely done.

Here is the steps, by trial and error.

  • install ncurses: succeed

  • install less: succeed

  • install man:
    configure depend on pkg-config
    configure depend on libpipeline
    configure depend on gdbm
    make depend on groff
    make using groff A4 failed
    make using groff letter succeed

  • install pkg-config: succeed

  • install libpipeline: succeed

  • install gdbm: succeed

  • install groff: succeed

  • install man: succeed

Nomore fear now. I realized that I can do it by examining each error. In fact, I can cheat, by using other distro to identify the dependency.


Example 1: less

less is my first successful install. less is also an easy example. Just follow the procedure, and you are done.

Reading:

Source:

Detail

$ cd ~

$ wget -c http://www.greenwoodsoftware.com/less/less-487.tar.gz

$ tar -xvf less-487.tar.gz

$ cd less-487
$ ./configure --prefix=/usr --sysconfdir=/etc
...
regular expression library:  posix
configure: creating ./config.status
config.status: creating Makefile
config.status: creating defines.h
$ make
...
gcc -I. -c -DBINDIR=\"/usr/bin\" -DSYSDIR=\"/etc\"  -g -O2 lesskey.c
gcc  -o lesskey lesskey.o version.o
gcc -I. -c -DBINDIR=\"/usr/bin\" -DSYSDIR=\"/etc\"  -g -O2 lessecho.c
gcc  -o lessecho lessecho.o version.o
$ make install
./mkinstalldirs /usr/bin /usr/share/man/man1
/usr/bin/install -c less /usr/bin/less
/usr/bin/install -c lesskey /usr/bin/lesskey
/usr/bin/install -c lessecho /usr/bin/lessecho
/usr/bin/install -c -m 644 ./less.nro /usr/share/man/man1/less.1
/usr/bin/install -c -m 644 ./lesskey.nro /usr/share/man/man1/lesskey.1
/usr/bin/install -c -m 644 ./lessecho.nro /usr/share/man/man1/lessecho.1

Docker LFS: less: make install

Commonly the steps are

  • ./configure, mostly with a few parameter.

  • make, sometimes with parameter.

  • maybe require make check.

  • and finally make install.


Example 2: man-db

Dependency

As mentioned, man-db depend on a few packages. This package should be installed first: pkg-config, libpipeline, gdbm, groff, man.

Basic package dependency can be found here.

Detail

Reading:

Source:

$ cd ~

$ wget -c http://download.savannah.gnu.org/releases/man-db/man-db-2.7.6.1.tar.xz

$ tar -xvf man-db-2.7.6.1.tar.xz

$ cd man-db-2.7.6.1

This is what it looks like, for beginer who never compile anything.

$ ./configure --prefix=/usr                        \
            --docdir=/usr/share/doc/man-db-2.7.6.1 \
            --sysconfdir=/etc                    \
            --disable-setuid                     \
            --enable-cache-owner=bin             \
            --with-browser=/usr/bin/lynx         \
            --with-vgrind=/usr/bin/vgrind        \
            --with-grap=/usr/bin/grap            \
            --with-systemdtmpfilesdir=
...
configure: creating ./config.status
config.status: creating Makefile
...
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: creating gnulib/po/POTFILES
config.status: creating gnulib/po/Makefile

Docker LFS: man: configure

$ make 
...
Making all in tools
make[2]: Entering directory '/root/man-db-2.7.6.1/tools'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/root/man-db-2.7.6.1/tools'
make[2]: Entering directory '/root/man-db-2.7.6.1'
make[2]: Leaving directory '/root/man-db-2.7.6.1'
make[1]: Leaving directory '/root/man-db-2.7.6.1'
$ make check
...
Making check in tools
make[1]: Entering directory '/root/man-db-2.7.6.1/tools'
make[1]: Nothing to be done for 'check'.
make[1]: Leaving directory '/root/man-db-2.7.6.1/tools'
make[1]: Entering directory '/root/man-db-2.7.6.1'
make[1]: Leaving directory '/root/man-db-2.7.6.1'

Docker LFS: man: make

$ make install
...
Making install in tools
make[1]: Entering directory '/root/man-db-2.7.6.1/tools'
make[2]: Entering directory '/root/man-db-2.7.6.1/tools'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/man-db-2.7.6.1/tools'
make[1]: Leaving directory '/root/man-db-2.7.6.1/tools'
make[1]: Entering directory '/root/man-db-2.7.6.1'
make[2]: Entering directory '/root/man-db-2.7.6.1'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/root/man-db-2.7.6.1'
make[1]: Leaving directory '/root/man-db-2.7.6.1'

Docker LFS: man: install


Resolving Dependency

Since I use Docker in not an official way to practice LFS, I also cheat using the host. I find a way to resolve dependency. You can use pactree using arch based distribution (ALPM). Your package manager, might have similar tool.

Here is my screenshot using Artix Linux, the host of my docker.

Docker LFS: man: install

With Tree

  • pactree

  • rpmreaper

  • prt-get deptree

  • slpkg deps-status --tree

Without Tree

  • dnf repoquery --requires man-db

  • zypper info --requires man

  • pacman -[S|Q]i man-db

  • xbps-query -R -x man-db

  • emerge -ep man-db

  • apt-cache showpkg man-db

  • prt-get depends

Next time, I’ll check the dependency first before building my LFS package.


Conclusion

It has been an honour, being (almost) a LFS user.

This is just building LFS at a glance. Of course there are more than my limited knowledge. There is also more advance topic such as BLFS, ALFS, and CLFS.

Thank you for reading