Maintain the NetBSD Base System Using pkg * Tools Yuuki Enomoto ∗ Ken’ichi Fukamachi † Abstract This paper describes the script ”basepkg.sh” for base system packaging to make NetBSD base system more granular. Today, fine granular systems are expected to provide more rapid secu- rity update and more flexible customization in creating a very small base system for sensor network. In ”NetBSD”, base system packaging mechanism called ”syspkg” has been developed, but now, its development is stagnant. In addition, it is troubled to deal with ”syspkg” consisting of a lot of Makefiles and shell scripts. Thus we developed a shell script simpler than ”syspkg” framework. This script uses src/distrib/sets/lists files and pkg create command to generate a fine granular base package. We verified our system can provide minimum functionality that our package can replace a part of NetBSD base system. It provides the first step for more granular NetBSD base system. 1 Introduction Many Unix systems have its own package manager(s) to manage soft- ware. The scope managed by the ”Unix” such as Linux distribution and package manager depends the system. *BSD is used mainly as servers. It is Some developers consider that the very important to keep operating sys- whole system consists of packages, an- tems up to date for security. If a soft- other consider that the operating sys- ware is found to be vulnerable, server tem consists of the base and optional administrators must update the soft- packages. ware as soon as possible. This updating process should be For example, Debian Linux pack- rapid. So, it must be useful to replace a ages the whole system to update vulnerable software with the latest bi- and upgrade it easily. FreeBSD nary by using some rapid mechanism 11.0 introduced a framework called e.g. package managers. PkgBase[FreeBSD 2017]. to divide the ∗ Chitose Institute of Science and Technology, 758-90, Bibi, Chitose, Hokkaido, 066-8655, mailto: m2160020@photon.chitose.ac.jp https://e-yuuki.org/ † Chitose Institute of Science and Technology, 758-90, Bibi, Chitose, Hokkaido, 066-8655, mailto:k-fukama@photon.chitose.ac.jp http://www.nsrg.fml.org/ 1
base system into 757 packages where managers (e.g. ”Portage”) compile the pkg(8) can manage the FreeBSD base source code and install it into the sys- system. tem. On the other hand, NetBSD had developed ”syspkg” under the same concept described above, but its de- 2.2 FreeBSD velopment is stagnant[NetBSD 2017]. Currently updating a base software ”FreeBSD” has a package system on NetBSD needs building from the called ”ports” to handle optional source code (or replacing the binary if 3rd party packages[FreeBSD 2017]. the major upgrade is available). It is ”ports” consists of a lot of Makefiles no quick response. So, NetBSD base to describe configurations. ”pkg” com- system packaging is required. mand manages actual installation/de- install action et.al. 2 Comparison of By default, ”ports” do not in- stall the binary package directly, but Package Manage- ”ports” can get and compile the source ment Systems code, and install it into the system us- ing the ”pkg” command. ”Package” is a collection of software, Also, ”ports” can fetch and install configuration files and documents. binary packages provided by FreeBSD. This collection is usually packed into a Instead of using ”ports”, FreeBSD single archive file in the format .tar.gz, users can use ”pkg” command to ma- .zip, et.al. ”Package Manager” is a nipulate packages. software that manages package instal- lation, deinstallation and updating. Almost all Unix clone systems con- 2.3 NetBSD sist of a base mandatory system, aux- iliary systems (e.g. compilers, docu- NetBSD has a portable package sys- ments, X11 Window) and optional 3rd tem called ”pkgsrc”[NetBSD 2017] de- party packages. The package manager rived from the FreeBSD ”ports” sys- can modify the system by adding or tem. ”pkgsrc” is mainly developed deleting optional binary packages. for NetBSD but also can be avail- able on a lot of platforms: NetBSD, 2.1 Linux Distribution FreeBSD, OpenBSD, DragonFlyBSD, Solaris, Linux, Darwin and other com- ”Debian” Linux and the derived dis- mercial UNIX systems. Some systems tributions use ”dpkg”, ”apt-get” and such as DragonFlyBSD use ”pkgsrc” ”apt” commands for package manage- as the package management system by ments. default. ”CentOS” and the derived distribu- tions use ”rpm” and ”yum” commands ”pkgsrc” is similar to FreeBSD as package management systems. ”ports” but different to use another There are a few Linux distributions utilities called ”pkg *” to install or re- (e.g. ”Gentoo”) where the package move compiled software. 2
2.3.1 NetBSD pkg * Utility system[Debian 2017]. Software and functions in the base system can be In NetBSD, the pkg * utility consists easily added and deleted by handling of the following commands. them as a set of packages. • pkg add In the case of BSD Unix(s), FreeBSD 11.0 introduced a mecha- • pkg admin nism called PkgBase. FreeBSD divides • pkg create the base system into 757 packages for pkg(8) to be able to manage the base • pkg delete system. Today NetBSD does not support • pkg info base system packaging. NetBSD costs ”pkg create” creates a binary pack- us a little bit of time to update a base age and saves it in ”tgz” format. software. We need to build from the ”pkg add” installs and upgrades source code and install it. Or we need package(s) created using pkg create. to fetch and extract the binary distri- ”pkg delete” removes the speci- bution to overwrite the binary if the fied package(s) from the system. latest major distribution is available. ”pkg info” displays the package infor- For example, consider that you mation. ”pkg admin” executes man- want to install or remove only ”groff” agement tasks for the package system. on your system. We have roughly granular tar-balls 2.4 OpenBSD on NetBSD where the base system is not packaged. We download text.tgz OpenBSD package system is similar to from the ftp site and unpack it in the NetBSD one. But the package utility root directory. So software other than is written in Perl not C. Commands groff will be installed together. such as pkg add and pkg delete are the Instead of using text.tgz, we same Perl script, which changes the be- can install groff from ”pkgsrc” havior by the called argument. (pkgsrc/textproc/groff). But OpenBSD users can write ar- in this case, after further up- bitrary package management scripts dates, two ”groff” will be in- by using these Perl modules in stalled such as in /usr/bin/groff and /usr/libdata/perl5/OpenBSD/. /usr/pkg/bin/groff. It may confuses users. Such a problem can be solved 3 Base System Pack- by packaging the base system with fine granularity. aging NetBSD had developed ”syspkg” under the same ideas described above, 3.1 Base System Packaging but its development is stagnant. Theo- There are Linux distributions manag- retically ”syspkg” can manage the base ing the base system as a collection system, but it is incomplete and not of packages. Debian Linux is a typ- used well. We can run build.sh with ical one. Debian’s ”Essential” pack- the option -syspkgs to create a com- age provides the minimum functional- piled base package, but the compiled ity required to generate a small base package cannot be installed. 3
Recommend
More recommend