Introduction explained the basic usage procedure of FuguIta.
In this chapter, we will introduce more advanced usage that takes advantage of the features of FuguIta.

[Memo]
This chapter assumes that you continue to use the environment set in Introduction as follows:

  • Assuming fugu-demo.localnet as hostname
  • ready to access internet
  • General user yoshi is created. Since yoshi also belongs to the wheel group, he can become root.

Manage OpenBSD

Add application software

FuguIta can add various software in addition to the software provided by OpenBSD.

The easiest way to add software is to use OpenBSD's ports/packages system.
To add software for packages, run the command pkg_add as root. As an example, here is an example of installing Mozilla Firefox, a web browser.

fugu-demo$ su -
Password:
fugu-demo# pkg_add firefox
quirks-4.53 signed on 2021-12-19T13:27:04Z
quirks-4.53:(ok)
firefox-95.0.1:libiconv-1.16p0:(ok)
firefox-95.0.1:gettext-runtime-0.21p1:(ok)
    :
    略
    :
firefox-95.0.1:dconf-0.40.0:(ok)
firefox-95.0.1:gtk+3-3.24.30:(ok)
firefox-95.0.1:(ok)
Running tags:ok
The following new rcscripts were installed: /etc/rc.d/messagebus
See rcctl for details.
New and changed readme(s):
        /usr/local/share/doc/pkg-readmes/dbus
        /usr/local/share/doc/pkg-readmes/firefox
        /usr/local/share/doc/pkg-readmes/glib2
        /usr/local/share/doc/pkg-readmes/gtk+3
fugu-demo# exit
fugu-demo$

In the above example, we temporarily became root using the su command. Of course, you can log out of yoshi, log back in as root, and execute pkg_add there. Executing pkg_add will also add other software required to run the target application. In the firefox example above, these are libiconv, gettext-runtime, dconf, gtk+3, etc. It is displayed that there is a document about the installed software under the directory /usr/local/share/doc/pkg-readmes, so it is a good idea to read it.

Applications can be added in a manner similar to the example above.
See https://ftp.jaist.ac.jp/pub/OpenBSD/7.2/packages/amd64/ with a web browser to see what software can be pkg_added from ports/packages.

[Memo]
The ports/packages system is explained in detail at https://www.openbsd.org/faq/faq15.html. Also, in the above example, we used ftp.jaist.ac.jp as the download source, but there are other download sites, and you can see the list at https://www.openbsd.org/ftp.html. increase.
It is also possible to directly compile and install the source code released by the software developer without using ports/packages, so-called "stray build".

On FuguIta, the software added by pkg_add is also subject to data save/restore by the usbfadm command.

Server setting example - change the NTP server that refers to the time

NTP (Network Time Protocol) is a protocol (communication protocol) for synchronizing the time of each computer while communicating on the network.
OpenBSD has a function to synchronize its own time with the time reference on the Internet using NTP, and this function can also be used in FuguIta.

OpenBSD configures whether to use NTP during installation. On the other hand, FuguIta has this feature enabled by default.

The NTP function is implemented by the program ntpd, and to see the operating status of ntpd, execute the command ntpctl increase.

[Memo]
The NTP software used by OpenBSD is called ``OpenNTPD'' and was created by the OpenBSD developers.
Linux and FreeBSD use different implementations of the same ntpd.

$ ntpctl -s status
4/4 peers valid, constraint offset 0s, clock synced, stratum 3

If "clock synced" is displayed as in the above example, ntpd communicates with the external NTP server that serves as the time reference, and as a result, you can see that the time is synchronized. on the other hand,

$ ntpctl -s status
0/1 peers valid, clock unsynced

If it is "clock unsynced" like this, the time has not been synchronized for some reason.

On OpenBSD, if the NTP function is enabled during installation, it will refer to a group of servers called pool.ntp.org as the time reference, and FuguIta's settings follow that.

On corporate LANs, etc., communication with external NTP servers such as pool.ntp.org may not be possible due to security concerns. In such a case, if an NTP server is operated on the company LAN, the local host's time can be kept accurate by referring to that server.

Here is how to configure the NTP server;

ntpd is configured by the file /etc/ntpd.conf, so edit ntpd.conf with root privileges.

$ doas -s
Password:
# vi /etc/ntpd.conf
 ntpd.conf内のこの3行を
  ↓
servers pool.ntp.org
sensor *
constraints from "https://www.google.com"
  ↓
 以下の一行に変更
  ↓
server ntp.localnet

In the above example, the settings are changed to refer to the NTP server "ntp.localnet".

After editing the configuration file, restart ntpd to reflect the changes.
A program like ntpd that runs in the background and provides services is called a daemon in Unix, but OpenBSD uses the command rcctl to operate the daemon can.

# rcctl restart ntpd
ntpd(ok)
ntpd(ok)
# 

Since the setting change work is completed above, return to the general user from root. After that, monitor the behavior of ntpd with ntpctl.

# exit
$ ntpctl -s status
1/1 peers valid, clock unsynced

If it looks like the above, it is not synchronized (yet), but you can see that one peer (peer, referring NTP server) is valid.

$ ntpctl -s status
1/1 peers valid, clock synced, stratum 3

After a while, it was confirmed that the time was synchronized.

ntpctl can also display the state of ntpd in more detail. Inaddition, ntpd itself leaves operation records in log files such as/var/log/daemon and /var/log/messages.
For details, refer to the manual page of each command and configuration file.

[Memo]
ntpd corrects the time drift very slowly. This is because a sudden big change in the time may adversely affect the operation of the system. Therefore, if the time difference is large, it may take a long time to synchronize.

Change OS settings

In the previous section, How to change the NTP server settings.

This section describes the configuration of services running on OpenBSD. Because it's not realistic to give a detailed description of every configuration method, I'll divide the configuration into categories and explain each of those categories.

kernel parameters

Functions of the OpenBSD kernel can be controlled in a number of ways, one of which is using the sysctl command.

$ sysctl -a | less
kern.ostype=OpenBSD
kern.osrelease=5.8
kern.osrevision=201510
kern.version=OpenBSD 5.8-stable (RDROOT.MP) #2: Wed Nov 11 13:18:48 JST 2015
    root@nimbus5.localnet:/opt/fi/5.8/sys/arch/i386/compile/RDROOT.MP

kern.maxvnodes=44152
kern.maxproc=1310
  ~以下略~

The example above shows all kernel parameters.
Since the display content does not fit on one screen, the display data is piped to the pager program less and displayed.

If you know in advance which parameter you want to display, you can specify its name to display it.
The example below shows the maximum amount of memory to allocate for file I/O buffering.

$ sysctl kern.bufcachepercent
kern.bufcachepercent=20
$

From this display, you can see that the buffer is set to allocate up to 20% of the installed memory capacity.

To change this value: Root privileges are required to change settings, so sysctl commands are executed via the doas command.

$ doas sysctl kern.bufcachepercent=50
Password:
kern.bufcachepercent: 20 -> 50
$

You can also set it automatically at system startup instead of manually running the sysctl command. For that, write the contents you want to set in a file called /etc/sysctl.conf.

[Memo]
In addition to changing kernel settings Rewrite kernel by

  • config command
  • Change at boot time with UKC (User Kernel Config)
  • kernel recompile

There are methods such as, but the contents that can be set and the difficulty of work differ for each. For details, please refer to each manual page and FAQ on the official site.

Network Basic Settings

As explained above, network-related settings are made when FuguIta starts up, so if you can communicate without any problems, you don't need to change any settings.
If you operate FuguIta as a server or network gateway, you may need to change or add settings.

Interface Settings
Settings related to network interfaces such as IP addresses and netmasks are set in the file /etc/hostname.<interface name>. The format of this file can be found at hostname.if(5).

[Memo]
What kind of network interfaces your PC has is displayed with "ifconfig -a".

route control
default route is described in /etc/mygate. For other route control, run the route control daemon or describe the execution of the route command in /etc/hostname.if or /etc/rc.local.
Name resolution
/etc/resolv.conf
Packet filtering
PF is a packet filter developed by OpenBSD, but it has a lot of functions other than filtering such as network bandwidth control and address conversion. . For PF, there are online manuals such as pfctl(8) and pf.conf(5) [[PF - User's Guide>https See http://www.openbsd.org/faq/pf/index.html]].

Daemon start/stop and setting

OpenBSD comes with various daemons installed, including some that don't run by default. Change the NTP server that refers to the time explained how to start, stop, and change the settings of the NTP daemon as an example. Follow similar steps for other daemons.

On OpenBSD, /etc/rc.conf.local controls the startup of such daemons. and options to be given to the daemon at startup.

[Memo]
Actually, all daemons are specified in /etc/rc.conf, and rc.conf.local is rc.conf works to override the settings of

To control the behavior of various daemons, the contents of rc.conf.local are changed, so edit it with a text editor.In addition, the command rcctl can be used to control starting/stopping daemons and to change settings. Like ntpd is configured via ntpd.conf, other daemons also have their own configuration files, many of which reside directly under /etc. In addition, the directory /etc/examples contains sample files for setting various daemons, so you can refer to, copy, or edit these files as actual setting files.

Other settings

/etc/rc.local is a shell script executed during the final stages of system startup. If you want to perform processing other than what has been explained so far, describe the processing in this file.

Please refer to rc(8) for how OpenBSD starts up and shuts down.

FuguIta boot mode

Boot Mode 1 - Faster boot time / Saves memory usage

If you specify mode 1 when starting FuguIta, the time required for the system to complete booting will be shortened.
Various setting items are the same as mode 0.

Select boot mode;
  0: fresh boot (normal)
  1: fresh boot (lower memory, faster boot than mode 0)
  2: fresh boot (works only on mfs)
  3: retrieve user data from USB flash memory
  4: retrieve user data from floppy disk
  5: interactive shell for debugging
->1

Memory usage (mfs size) after startup is also less than mode 0.
As a guideline, it will be possible to operate from a machine with about 64 MB of mounted memory;

File usage (mode 0)
$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/rd0a      1.6M    729K    833K    47%    /
/dev/cd0a      697M    697M      0B   100%    /sysmedia
/dev/vnd5a     676M    664M   11.9M    98%    /fuguita
mfs            698M   25.5M    673M     4%    /ram
File usage (mode 1)
$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/rd0a      1.6M    730K    832K    47%    /
/dev/cd0a      697M    697M      0B   100%    /sysmedia
/dev/vnd5a     676M    664M   11.9M    98%    /fuguita
mfs            713M    6.8M    706M     1%    /ram

However, boot mode 1 has the advantage of requiring fewer resources than the standard boot mode, mode 0, but has the disadvantage of not being able to change files and directories under /usr. In other words, you cannot add applications using pkg_add or the like.

Start mode 1 can be used when operation is possible only with the software included in FuguIta. The above situation will be inherited even if you restart in mode 3 after starting in mode 1 and saving the file with usbfadm.

Boot Mode 2 - Operation in memory

Boot mode 2 is a mode in which all files are transferred on mfs and everything operates in memory.

Select boot mode;
  0: fresh boot (normal)
  1: fresh boot (lower memory, faster boot than mode 0)
  2: fresh boot (works only on mfs)
  3: retrieve user data from USB flash memory
  4: retrieve user data from floppy disk
  5: interactive shell for debugging
->2

In mode 2, DVD and USB memory are unmounted when the system boot is completed, so you can remove those devices and operate. Since program execution and file reading and writing are all performed in memory, it can be expected to operate faster than modes 0 and 1.

$ df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/rd0a      1.6M    730K    832K    47%    /
mfs            813M    736M   76.7M    91%    /ram

However, as explained at the beginning, in this mode 2, all system files on the DVD or USB memory are copied to mfs, so the amount of installed memory on the PC should be approximately 800MB or more as a guide.

Even in mode 2, if the file is saved with usbfadm and then restarted in mode 3, the state at the time of file saving is restored.

[Memo]
Please note that the device cannot be removed in the following cases.

  • if virtual memory usage is greater than real memory and swap partition cannot be disabled (warning message is displayed)
  • If you are using encrypted partition (you will get a warning message)
  • If you additionally mount partitions in that device

boot mode and file system

What is the difference in file system structure between boot mode 0 and boot mode 1? The differences are explained below.

fi-filesys-mode0.png

The diagram on the right shows the file layout in startup mode 0 (click the diagram to enlarge). Example path for /bin/ed, /usr/bin/vi, pkg_added /usr/local/bin/emacs.

Root filesystem is RAM DISK, rd. This device is built into the kernel and has already been mounted since system boot. Under root is an unfamiliar directory called "boottmp". It contains commands that are necessary at the very beginning of system startup and utilities specialized for FuguIta.

The FuguIta device is actually a DVD or USB memory that stores the boot loader, OS kernel, and file system image p. It is mounted read-only at /sysmedia. The file system image on /sysmedia is mapped to /dev/vnd4 and mounted at /fuguita. This is the OpenBSD file tree. It's pretty much the original OpenBSD, except for a few changes to match the live system. This file system is also read-only. Therefore, files cannot be created, modified, or deleted under this.

/ram is a memory file system called mfs (memory file system) and is both readable and writable. Files that need to be changed, such as /etc/*.conf, user data under /home, and software added by pkg_added, are placed above this. Also, files that rarely change are replaced with symlinks to equivalent files in /fuguita. This will reduce the memory usage of mfs.

fi-filesys-mode1.png

Next is boot mode 1. In boot mode 1, /usr is symbolically linked to /fuguita/usr. This makes booting faster and using less memory than mode 0 by not copying or linking /usr to /ram. However, /usr/local is not writable, so pkg_add is not possible.

fi-filesys-mode2.png

The file layout for boot mode 2 is shown on the right. This is much simpler than modes 0 and 1, only / and /ram are mounted and all external devices are unmounted. Of course, all files can be changed.

Management of FuguIta

Install the Japanese desktop environment

On Fuguita, you can install the Japanese desktop environment by executing the command dtjsetup. Below is an example of running dtjsetup.

# dtjsetup                                   ← Start dtjsetup
                                               (Both root and general users can use it)
#==========================================
# Welcome to dtjsetup
#     Desktop (and Japanese) setup utility
#
# for FuguIta-6.6-amd64-202001171
#==========================================

Which desktop software will you install?     ← Choosing a desktop environment
  1:  no desktop (wm only)
  2: [rox-filer]
  3:  xfce
  4:  mate
  5:  lumina
  6:  lxqt
->                                           ← If you enter only [ENTER],
                                                the You have selected the item.
Which window manager will you install?       ← Select a window manager if you selected
  1:  cwm                                       1 or 2 in the previous section.
  2:  fvwm                                      
  3:  twm                                       
  4: [icewm]
  5:  fluxbox
  6:  jwm
->

Will you setup Japanese language environment? [y/N] -> y
Which input method will you install? 
  1: [scim-anthy]
  2:  uim-gtk
  3:  fcitx-anthy
  4:  ibus-skk
->

*** You selected icewm as desktop software.
*** Installing Japanese environment is YES.
*** Japanese input method is scim-anthy.

*** Checking your root authorization...
*** OK.

*** Checking network accessibility...
*** OK.

*** Installing packages: rox-filer icewm ja-kterm ja-sazanami-ttf mixfont-mplus-ipa mplus-fonts scim-anthy
Will you continue? [y/N] -> y
quirks-3.183 signed on 2020-01-31T18:21:51Z
rox-filer-2.11p3:libiconv-1.16p0:ok
rox-filer-2.11p3:xz-5.2.4:ok
    :
icewm-1.6.1:libsndfile-1.0.28:ok
icewm-1.6.1:ok
Ambiguous: choose package for ja-kterm
a	0: <None>
	1: ja-kterm-6.2.0p9
	2: ja-kterm-6.2.0p9-xaw3d
Your choice: 1
ja-kterm-6.2.0p9:ok
    :
scim-anthy-1.2.7p11:ok
Running tags:
New and changed readme(s):
	/usr/local/share/doc/pkg-readmes/glib2
	/usr/local/share/doc/pkg-readmes/gtk+2
	/usr/local/share/doc/pkg-readmes/scim
--- +ja-sazanami-ttf-20040629p3 -------------------
You may wish to update your font path for /usr/local/share/fonts/sazanami
--- +mixfont-mplus-ipa-20060520p7 -------------------
You may wish to update your font path for /usr/local/share/fonts/mixfont-mplus-ipa
--- +mplus-fonts-063 -------------------
You may wish to update your font path for /usr/local/share/fonts/mplus-fonts

*** /root/.xsession already exists.
*** This will be replaced with a new file.
*** and the old one will be renamed to /root/.xsession_20200206_170903.

*** Rewrite .xsession configuration file.
Will you continue? [y/N] -> y

Copy this .xsession file to /etc/skel ? [y/N] -> y    ← Once copied, this setting will be
                                                         inherited when a new user account is
                                                         created.
*** Japanese environment and related software have been set up.
*** However, the time zone has not yet been set to JST.
Set timezone to JST? [Y/n] -> y

*** When you use this machine both running OpenBSD and Windows.
*** You may set the hardware clock to JST instead UTC.
Set hardware clock to JST? [Y/n] -> n

*** all installation and configuration completed.
*** Check your /root/.xsession and login to X if OK.

*** Note: You can save this configuration and addtionally installed softwares
***	  by using usbfadm utility.
***	  And can reload them at next boot time by selecting boot mode 3.
DeskTop.jpg

After the above settings have been made, log out and log back in from the xenodm login screen to launch the installed desktop environment.

In the desktop environment, various applications can be added using the pkg_add command.

[Memo]
Detailed explanation from installing FuguIta to installing various applications /ca008a34d73d5f1f6dd8]] has been published on the technical information sharing site Qiita. See also

Enable login screen for X

As described in Login method selection in FuguIta's startup settings, you can choose between the method of logging in from the console screen and the method of logging in from the X Window System login screen(xenodm). Select.

Even if you choose to log in from the console screen, you can later change the method to log in from the X Window System login screen (xenodm).
To do this, modify the contents of the /etc/rc.conf.local file as described in Changing OS configuration.

The following example uses the rcctl command to enable xenodem.

$ doas rcctl enable xenodm  
$ doas rcctl ls on
check_quotas
cron
library_aslr
ntpd
pf
pflogd
slaacd
smtpd
sndiod
sshd
syslogd
xenodm
#

If you enable xdm with the rcctl command, you can see that the line "xdm_flags=" is added to rc.conf.local.

$ cat /etc/rc.conf.local
xenodm_flags=
$

After changing the settings, save with usbfadm, and then start xdm in mode 3.

[Memo]
When xdm is displayed, press <Control>+<Alt>+<F1> to switch to the normal text login screen. This virtual console has 12 faces in total, <Control>+<Alt>+<F1> to <Control>+<Alt>+ Allocated up to <F12>. The X display is bound to the 5th virtual console, so pressing <Control>+<Alt>+<F5> will return you to the X screen.

Update FuguIta

OpenBSD has a major release every six months, and at that time the version changes like OpenBSD 7.1 → OpenBSD 7.2.
And in half a year, fixes related to security and stability improvements have been made, and the fix information is provided on the official OpenBSD website at http://www.openbsd.org/errata72.html.

FuguIta also follows this modified information, and the currently published version has all the modified information applied so far (actually, application work and operation check Therefore, there is a time lag of several days after the correction information is released.)

In addition, to check the version of the OS currently in operation on FuguIta, execute the command as follows.

$ uname -a                                       ← version of OS
OpenBSD fugu-demo.localnet 5.8 RDROOT.MP#2 i386
$ sysctl kern.version                            ← version of kernel
kern.version=OpenBSD 5.8-stable (RDROOT.MP) #2: Wed Nov 11 13:18:48 JST 2015
    root@nimbus5.localnet:/opt/fi/5.8/sys/arch/i386/compile/RDROOT.MP

$ cat /usr/fuguita/version                       ← version of FuguIta
5.8-201512272


Front page   New Page list Search Recent changes   Help   RSS of recent changes