Learn and Discover Open Source with Daily Genuine Experience. From Coding, Design, Package Management Tweak to Desktop Customization.
 
   

Table of Content

There are few sections here.

  • Preface: Test Bed
  • Getting Started With Docker
  • Package Management: Reading, Source Code, Front End, Get Help
  • Updating System: Ports Update, System Upgrade
  • Package IRSIF: Install, Removal, Query Search, Show Info, List File
  • Dependency: Help, Dependency, Reverse Dependency, Test
  • System Wide: Installed Packages
  • Ports Difference
  • Group
  • History: The Log File
  • Clean Up
  • Hold Package
  • Issues with Unmaintained Docker Container
  • Conclusion

Preface

Goal: Examine Package Manager, Focus on Command Line Interface

This Crux is even easier with docker container, no need to set up system. Therefore we can dive right away to compilation.

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 crux

Docker Pull Crux Linux

$ docker image list 

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

REPOSITORY              SIZE
opensuse/amd64          101MB
dock0/arch              870MB
gentoo/stage3-amd64     873MB
debian                  100MB
fedora                  232MB
busybox                 1.13MB
vbatts/slackware        86.7MB
voidlinux/voidlinux     202MB
kevinleptons/lfs-auto   753MB
crux                    342MB
$ docker run -it crux
bash-4.3# exit
$ docker ps 

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

IMAGE                       NAMES                  STATUS
opensuse/amd64:tumbleweed   elegant_nightingale   Up 17 hours
crux                        lucid_brown           Up 6 hours
fedora:rawhide              musing_torvalds       Up 7 hours
voidlinux/voidlinux         awesome_davinci       Up 6 hours
gentoo/stage3-amd64         amazing_shirley       Up 8 hours
vbatts/slackware            cranky_keller         Up 6 hours

Docker openSUSE: List Running Containers

$ docker start lucid_brown
nifty_beaver
$ docker attach lucid_brown
bash-4.3# 

Docker Crux: Getting Started


Package Management

Before Arch, there was Crux. Arch was intended as additional Crux package manager, but then was recreated from scratch. While Arch Linux use .pkg.tar.xz extension for package, Crus use .pkg.tar.gz extension for package.

Reading

Source

Front End

prt-get

Get Help

If you are helpless, just add this help | less argument.

$ prt-get help | less

Or if you have man-db installed. I mean after, source downloaded, compiled, built, and finally installed, yes you can do below command.

$ man prt-get

Updating System

First Thing First

First thing to do is updating my system as usual.

Ports Update

You can use ports -u command. That remind me of emerge -u command.

$ ports -u
Updating file list from crux.nu::ports/crux-3.1/core/
Updating collection core
Finished successfully
Updating file list from crux.nu::ports/crux-3.1/opt/
Updating collection opt
Finished successfully
Updating file list from crux.nu::ports/crux-3.1/xorg/
Updating collection xorg
Finished successfully

Docker Crux: Ports Update

System Upgrade

Now is time to use prt-get, an advanced package management tool for CRUX.

Consider system update using prt-get sysup.

$ prt-get sysup
prt-get: updating /usr/ports/core/openssl
=======> Building '/usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz'.
bsdtar -p -o -C /usr/ports/core/openssl/work/src -xf /usr/ports/core/openssl/openssl-1.0.2g.tar.gz
cp mksslcert.sh /usr/ports/core/openssl/work/src
+ build
+ cd openssl-1.0.2g
+ export 'MAKEFLAGS= -j1'
+ MAKEFLAGS=' -j1'
...

Docker Crux: Update System

As you can see above, openssl has been failed to compile. Which we will solve later.


Package IRSIF

Install, Remove, Search, Info, File

Read the fine manual.

Package Install

You can use prt-get install to install new package, or prt-get update to upgrade package currently installed package.

$ prt-get install man nano htop mc ncdu fish
prt-get: installing /usr/ports/opt/mc
=======> Building '/usr/ports/opt/mc/mc#4.8.15-1.pkg.tar.gz'.
bsdtar -p -o -C /usr/ports/opt/mc/work/src -xf /usr/ports/opt/mc/mc-4.8.15.tar.xz
+ build
+ cd mc-4.8.15
...

Docker Crux: prt-get Install

Package Removal

$ prt-get remove htop

Docker Crux: prt-get Remove

Removing package would not not package that depend on it. Package would be removed without prior warning. Therefore be careful while remove.

$ prt-get search htop
htop
$ prt-get dsearch htop
htop
$ prt-get fsearch htop
Found in /usr/ports/opt/bash-completion:
  /usr/share/bash-completion/completions/htop

Found in /usr/ports/opt/htop:
  /usr/bin/htop

Docker Crux: prt-get Search

Package Show Info

$ prt-get info htop
Name:         htop
Path:         /usr/ports/opt
Version:      1.0.3
Release:      1
Description:  an interactive process viewer
URL:          http://hisham.hm/htop
Packager:     Simone Rota, sip at crux dot nu
Maintainer:   Thomas Penteker, tek at serverop dot de
Dependencies: ncurses

Docker Crux: prt-get Info

List Files

Listing files in particular package.

$ pkginfo -l wget

Or

$ pkginfo --list wget
etc/
etc/wgetrc
usr/
usr/bin/
usr/bin/wget
usr/man/
usr/man/man1/
usr/man/man1/wget.1.gz

Docker Void: pkginfo list

There is this file owner command.

$ pkginfo -o /etc/wgetrc 
$ pkginfo --owner /etc/wgetrc 
Package  File
wget     etc/wgetrc

Docker Void: pkginfo owner


System Wide

System wide information.

Installed Packages

$ pkginfo -i

Equal to:

$ pkginfo --installed
acl 2.2.52-1
attr 2.4.47-1
autoconf 2.69-1
automake 1.15-1
bash 4.3.42-1
...
wget 1.17-1
which 2.21-1
xz 5.2.2-1
zip 3.0-1
zlib 1.2.8-1

Docker Crux: pkginfo --installed


Dependency

There are two main topics in dependency, dependency itself, and reverse dependency. Beside these two, there are other topic as well, such as managing conflict that we do not cover here.

Help

Ports has a very nice help that show all dependency related options.

$ prt-get help | less
...
DEPENDENCIES
  depends   <port1 port2...>  show dependencies for these ports
  quickdep  <port1 port2...>  same as 'depends' but simple format
  deptree   <port>            show dependencies tree for <port>
  dependent [opt] <port>      show installed packages which depend on 'port'
...

Docker Crux: Help Dependency

Dependency

Package that required by: such as man-db need libpipeline and other.

This dependency information can be achieved by depends or deptree command. This will show required parts of the package.

$ prt-get depends man-db
-- dependencies ([i] = installed)
[i] zlib
[i] gdbm
[i] libpipeline
[i] man-db
Most people love tree
$ prt-get deptree man-db
-- dependencies ([i] = installed, '-->' = seen before)
[i] man-db
[i]   zlib
[i]   gdbm
[i]   libpipeline

Docker Crux: prt-get Deptree

Reverse Dependency

Package that require: such as libpipeline needed by man-db or other.

This reverse dependency require dependent command.

$ prt-get dependent libpipeline
man-db

Docker Crux: prt-get Dependent

Test

Removing libpipeline would not remove man-db. libpipeline would be removed without prior warning. Therefore be careful while remove.

$ prt-get remove libpipeline

-- Packages removed
libpipeline
$ man man
man: error while loading shared libraries: libpipeline.so.1: 
cannot open shared object file: No such file or directory

Docker Crux: Remove libpipeline


Ports Difference

You check the ports difference.

$ ports -d
Collection  Name     Port      Installed
core        openssl  1.0.2g-1  1.0.2d-1

$ prt-get diff 
Differences between installed packages and ports tree:

Port                Installed           Available in the ports tree

openssl             1.0.2d-1            1.0.2g-1            
bash-4.3#  

Docker Crux: Ports difference


Group

I cannot find any reference about group in Crux’s Ports. I guess there is no group concept.


The Log File

This is most the forgotten part of package management, although it is not uncommon to notice messages. For that reason, I put the recorded event here, before discussing about any further feature.

Log options in Crux is disabled as default. You have to enable it manually by editing prt-get.conf

$ vim /etc/prt-get.conf 
writelog enabled           # (enabled|disabled)
logfile  /var/log/pkgbuild/%n.log

Docker: vim /etc/prt-get.conf

This is the nano log after nano installation.

$ less /var/log/pkgbuild/nano.log
=======> Building '/usr/ports/opt/nano/nano#2.4.3-1.pkg.tar.gz' succeeded.
prt-get: Using PKGMK_PACKAGE_DIR: /usr/ports/opt/nano
prt-get: installing nano 2.4.3-1
prt-get: /usr/bin/pkgadd nano#2.4.3-1.pkg.tar.gz
prt-get: build done Thu Aug 24 10:20:01 2017

Most likely you want the tail, latest transaction, at the bottom of the recorded event.

Docker: /var/log/pkgbuild/nano.log

Reading


Clean Up

Time after time, your cache size may growing bigger and bigger.

Package Cache

  • /usr/ports/core/ * / * .pkg.tar.gz
$ ls -lR  /usr/ports/core/man-db/

Docker CRUX: Ports Library

Unfortunately, I haven’t find any reference, on how to clean up this port directory.


Hold Package

Hold in prt-get is pretty straightforward. Ports can hold package using lock mechanism. This is just a terminology.

Consider a system upgrade, we choose to hold openssl as our guinea pig example. We can see that sysup will have different result.

$ prt-get sysup
prt-get: updating /usr/ports/core/openssl
$ prt-get lock openssl
$ prt-get sysup
System is up to date
$ prt-get listlocked
openssl
$ prt-get unlock openssl
$ prt-get sysup
prt-get: updating /usr/ports/core/openssl
=======> Building '/usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz'.
bsdtar -p -o -C /usr/ports/core/openssl/work/src -xf /usr/ports/core/openssl/openssl-1.0.2g.tar.gz
cp mksslcert.sh /usr/ports/core/openssl/work/src

Docker Crux: prt-get Lock


Issues with Unmaintained Docker Container

pkgadd

Sometimes prt-get does not work, as you can see below. We have to face openssl install issue.

$ prt-get update openssl
...
=======> ERROR: Building '/usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz' failed.

-- Packages where update failed
openssl

Docker Crux: prt-get Update

I was lucky, the package is there in openssl directory. Therefore I can install using lower level pkg command directly.

$ ls /usr/ports/core/openssl/
Pkgfile       openssl#1.0.2g-1.pkg.tar.gz
mksslcert.sh  openssl-1.0.2g.tar.gz

$ pkgadd -u /usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz 

$ prt-get diff
No differences found

Docker Crux: pkgadd Update


Dependency Build

$ prt-get install mc
...
configure: WARNING: 'Check' utility not found. Check your environment
checking for GLIB... no
configure: error: glib-2.0 not found or version too old (must be >= 2.26)
=======> ERROR: Building '/usr/ports/opt/mc/mc#4.8.15-1.pkg.tar.gz' failed.

-- Packages where install failed
mc

Docker Crux: mc error

$ prt-get search glib
dbus-glib
glib
glibc
glibc-32
poppler-glib
taglib

Docker Crux: mc error

It turned out that glibc version is 2.19, which is less than 2.26.

$ prt-get info glibc
Name:         glibc
Path:         /usr/ports/core
Version:      2.19
Release:      5
Description:  The C library used in the GNU system
URL:          http://www.gnu.org/software/libc/
Maintainer:   CRUX System Team, core-ports at crux dot nu
Files:        post-install

Docker Crux: info glibc

Unfortunately, update command, not uprading the glibc version.

$ prt-get update glibc
prt-get: updating /usr/ports/core/glibc
=======> Package '/usr/ports/core/glibc/glibc#2.19-5.pkg.tar.gz' is up to date.
prt-get: reinstalling glibc 2.19-5
pkgadd: rejecting etc/ld.so.cache, keeping existing version
pkgadd: rejecting etc/resolv.conf, keeping existing version
pkgadd: rejecting etc/hosts, keeping existing version

-- Packages updated
glibc

prt-get: updated successfully

Docker Crux: update glibc

Distribution Upgrade

Distribution upgrade from 3.1 to 3.2 can be done using live DVD. But cannot be done directly due to ncurse break. Distribution upgrade from 3.2 to 3.3 also can be done using live DVD. Since we are using Docker, it can’t be done with external boot.

I should stay with 3.1 instead

Conclusion

There are things unsolved

Thank you for reading


Epsi Nurwijayadi bio photo
By Epsi Nurwijayadi