This chapter describes the basic procedure when the system is booted and ready for use.
We will also point out sources of information that may be helpful for those unfamiliar with Unix-like operating systems, and for those with experience using other Unix-like operating systems.
Once FuguIta has finished booting, you will be presented with the OpenBSD operating system login screen.
At first, only the superuser account can log in, so enter ``root at the ``login: prompt, and enter the password you set at startup at the ``Password:'' prompt.
OpenBSD/amd64 (fugu-demo.localnet) (tty00) login: root Password: OpenBSD 7.2-stable (RDROOT.MP) #28: Fri Feb 3 11:29:19 JST 2023 Welcome to FuguIta, the OpenBSD-based live system. FuguIta aims to help popularize OpenBSD operating system by making it easier to get started with. For information on FuguIta's specific features and how to use them, please refer to the documentation on https://fuguita.org/. If you have any questions or suggestions for FuguIta, please send an email to me or post a message to fuguita.org's message board. Please feel free to contact me. Yoshihiro Kawamata kaw@on.rim.or.jp , https://fuguita.org/ You have new mail. fugu-demo#
If the login is successful, the shell prompt "fugu-demo#" will be displayed and commands can be executed.
As an example, let's run the command ps.
fugu-demo# ps -aux USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND root 68528 3.6 0.1 868 884 00 Sp 6:51AM 0:01.89 -ksh (ksh) root 1 0.0 0.1 884 532 ?? I 6:40AM 0:01.68 /sbin/init root 14453 0.0 0.1 792 644 ?? Ip 6:43AM 0:00.47 /sbin/slaacd _slaacd 53995 0.0 0.1 812 784 ?? Ip 6:43AM 0:00.81 slaacd: engi _slaacd 33982 0.0 0.1 800 732 ?? Ip 6:43AM 0:00.81 slaacd: fron root 55401 0.0 0.1 712 548 ?? IU 6:44AM 0:00.17 dhclient: em _dhcp 78950 0.0 0.1 840 700 ?? Ip 6:44AM 0:00.10 dhclient: em root 86344 0.0 0.2 520 2184 ?? IpU 6:46AM 0:00.64 syslogd: [pr _syslogd 45328 0.0 0.1 1128 1488 ?? Sp 6:46AM 0:01.04 /usr/sbin/sy root 73380 0.0 0.1 836 584 ?? IU 6:46AM 0:00.27 pflogd: [pri _pflogd 53476 0.0 0.1 876 540 ?? Sp 6:46AM 0:02.97 pflogd: [run _ntp 63935 0.0 0.3 1016 2868 ?? S<p 6:47AM 0:02.87 ntpd: ntp en _ntp 18769 0.0 0.2 820 2508 ?? Ip 6:47AM 0:01.86 ntpd: dns en root 34145 0.0 0.2 788 1568 ?? S<pU 6:47AM 0:00.81 /usr/sbin/nt root 63360 0.0 0.1 1324 1280 ?? I 6:47AM 0:00.37 sshd: /usr/s root 61566 0.0 0.2 1680 2052 ?? Ip 6:48AM 0:00.82 /usr/sbin/sm _smtpd 19845 0.0 0.4 1448 3940 ?? Ip 6:48AM 0:01.83 smtpd: klond _smtpd 66321 0.0 0.4 1716 4240 ?? Ip 6:48AM 0:02.23 smtpd: contr _smtpd 91561 0.0 0.4 1552 4164 ?? Ip 6:48AM 0:01.95 smtpd: looku _smtpd 90688 0.0 0.4 1844 4396 ?? Ip 6:48AM 0:02.69 smtpd: pony _smtpq 16446 0.0 0.4 1640 4252 ?? Ip 6:48AM 0:02.47 smtpd: queue _smtpd 82450 0.0 0.4 1440 3988 ?? Ip 6:48AM 0:02.17 smtpd: sched _sndio 66682 0.0 0.1 516 744 ?? I<p 6:48AM 0:00.17 /usr/bin/snd _sndiop 92235 0.0 0.1 504 920 ?? IpU 6:48AM 0:00.08 sndiod: help root 1376 0.0 0.1 672 1268 ?? Sp 6:51AM 0:00.84 /usr/sbin/cr root 6575 0.0 0.0 484 360 00 R+pU/0 7:32AM 0:00.35 ps -aux root 13541 0.0 0.1 288 1296 C0 I+pU 6:51AM 0:00.58 /usr/libexec root 70324 0.0 0.1 292 1308 C1 I+pU 6:51AM 0:00.54 /usr/libexec root 10475 0.0 0.1 296 1312 C2 I+pU 6:51AM 0:00.44 /usr/libexec root 81779 0.0 0.1 292 1304 C3 I+pU 6:51AM 0:00.58 /usr/libexec root 45364 0.0 0.1 284 1280 C5 I+pU 6:51AM 0:00.47 /usr/libexec fugu-demo#
ps is a command that displays what programs (processes) are currently running.
Even if the system is just starting up and it looks like there is no movement on the screen, you can see that many processes have already been started internally.
From now on, I will explain the settings that should be done when you log in as root for the first time.
FuguIta immediately after booting in mode 0 has the time zone (time zone) set to UTC (Universal Coordinated Time).
Japan Standard Time (JST) is 9 hours ahead of Coordinated Universal Time.
fugu-demo# date Fri Feb 10 05:14:49 UTC 2023
To change FuguIta's time zone to JST, enter the command as follows and change the file pointed by the symbolic link /etc/localtime.
fugu-demo# cd /etc fugu-demo# ls -l localtime lrwxr-xr-x 1 root wheel 23 Feb 10 05:13 localtime -> /usr/share/zoneinfo/UTC fugu-demo# ln -s -f /usr/share/zoneinfo/Asia/Tokyo localtime fugu-demo# ls -l localtime lrwxr-xr-x 1 root wheel 30 Feb 10 14:15 localtime -> /usr/share/zoneinfo/Asia/Tokyo fugu-demo# date Fri Feb 10 14:15:44 JST 2023 fugu-demo#
[Memo]
⇒If the JST after setting is different from the actual time, use the date command to correct it.
Immediately after starting FuguIta, you can only log in with the superuser (system administrator) account root.
On a Unix-based OS, you normally log in as a general user and use the system on a daily basis.
When doing system administration, log back in as superuser to perform administrative tasks.
[Caution]
!!While logged in as the superuser, it is easy to perform operations that render the system inoperable. Of course, unintentional erroneous operation is no exception. To prevent such risks, it is ``strongly recommended'' that you create a general user account and use it normally.
Below, create an account called yoshi as a general user.
Creating user accounts is also system management, so do it as root.
Use the command adduser to add a user account.
First, you will be asked for default values ?k?kwhen adding a user account. This is only asked the first time adduser is run. Normally, there is no problem with inputting only the <Enter> key.
# adduser Couldn't find /etc/adduser.conf: creating a new adduser configuration file Reading /etc/shells Enter your default shell: bash csh ksh nologin nsh sh [ksh]: Your default shell is: ksh -> /bin/ksh Default login class: authpf bgpd daemon default pbuild staff unbound [default]: Enter your default HOME partition: [/home]: Copy dotfiles from: /etc/skel no [/etc/skel]: Send welcome message?: /path/file default no [no]: Do not send message(s) Prompt for passwords by default (y/n) [y]: Default encryption method for passwords: auto blowfish [auto]: Use option ``-silent'' if you don't want to see all warnings and questions. Reading /etc/shells Check /etc/master.passwd Check /etc/group
Next, enter the information for general user account creation. As an example, let's create a user account called "yoshi".
As shown at the beginning, the input can be corrected (retyped) at the end.
Ok, let's go. Don't worry about mistakes. There will be a chance later to correct any input. Enter username []: yoshi Enter full name []: Yoshihiro Kawamata Enter shell bash csh ksh nologin nsh sh [ksh]: Uid [1000]: Login group yoshi [yoshi]: Login group is ``yoshi''. Invite yoshi into other groups: guest no [no]: wheel Login class authpf bgpd daemon default pbuild staff unbound [default]: Enter password []: Enter password again []: Name: yoshi Password: **** Fullname: Yoshihiro Kawamata Uid: 1000 Gid: 1000 (yoshi) Groups: yoshi wheel Login Class: default HOME: /home/yoshi Shell: /bin/ksh OK? (y/n) [y]: y Added user ``yoshi'' Copy files from /etc/skel to /home/yoshi Add another user? (y/n) [y]: n Goodbye! #
[Memo]
⇒In this example, the account yoshi is also added to the group called wheel.
Users with a wheel subscription can temporarily become root to perform system administration tasks.
A general user account called yoshi is now created.
As explained in the previous section, to perform system administration tasks, you must temporarily become a superuser from a general user, or log out as a general user and then log back in as a superuser.
On OpenBSD, general users can execute commands with root privileges using the command doas.
To use doas, you first need to edit the configuration file /etc/doas.conf.
doas.conf does not exist at first, so execute the following command to create the file (if doas.conf already exists, edit doas.conf with a text editor ).
# echo permit persist :wheel > /etc/doas.conf # chmod 0600 /etc/doas.conf
This will create a file doas.conf with a single line "permit persist :wheel". This is a setting that means "to allow users belonging to the wheel group to execute commands with root privileges".
[Memo]
⇒When you execute doas, you will be prompted for the password of the user who executed it, but since "persist" is specified in the above example, doas re-executing will bypass the user's password input.
As explained in Creating a FuguIta LiveUSB, you can create a LiveUSB version of FuguIta by downloading the image file from the download site, expanding it, and writing it.
However, this LiveUSB version of FuguIta can only use 2GB of space regardless of the size of the USB memory used. ~ Of this, the FuguIta system occupies about 1GB, so usbfadm can save about 1GB of data.
The usbfadm utility that comes with FuguIta has a feature called expand that can expand the size of the partition that stores data.
Below is an example of using usbfadm expand.
fugu-demo# usbfadm ← start usbfadm with root privileges Welcome to usbfadm. USB flash drive administration tool for FuguIta Version/Arch: 7.2/amd64 (FuguIta-7.2-amd64-202302081) Boot mode: manual Target device: not set Data saved as: not set readline capability available TAB to complete the reserved words Type ? for help. ? : ? ->target ← Specify the partition to extend with the target command Searching storage device Please make sure the device inserted. Then press ENTER -> sd0i sd0j sd0k sd1a +sd1d vnd5a ← list of detected partitions. target device ->sd1d Partitions with a + sign at the beginning are data storage partitions sd1d : ? ->info ← check the capacity of the specified partition Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/sd1d 1.1G 2.5K 1.1G 0% 5 1287065 0% /mnt ← 容量は1.1GB scanning... 512B 7.0/amd64/noasks sd1d : ? ->expand ← call expand function Select the expansion method for sd1d: 1: growfs - expands the partition while retaining its contents 2: newfs - expand and format the partition 3: [exit without expansion] ->2 ← extend partition using "newfs"
There are two ways to extend a partition: "growfs" and "newfs".
growfs expands the area while retaining the data stored in the partition.
newfs reformats the partition after expanding the space.
Please note that newfs will erase all saved files and directories. On the other hand, even with growfs,
it is recommended that you back up your data before running it.
This makes sd1d as large as possible. Note that all contents in sd1d will be removed Do you proceed? [y/N] -> y /dev/rsd1d: 3136.5MB in 6423488 sectors of 512 bytes 257 cylinder groups of 12.24MB, 3134 blocks, 6272 inodes each super-block backups (for fsck -b #) at: 144, 25216, 50288, 75360, 100432, 125504, 150576, 175648, 200720, 225792, : 6368432, 6393504, 6418576, ** /dev/rsd1d ** File system is already clean ** Last Mounted on ** Phase 1 - Check Blocks and Sizes ** Phase 2 - Check Pathnames ** Phase 3 - Check Connectivity ** Phase 4 - Check Reference Counts ** Phase 5 - Check Cyl groups 1 files, 1 used, 5611214 free (14 frags, 701400 blocks, 0.0% fragmentation) sd1d : ? ->info ← check capacity after expansion Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/sd1d 2.7G 2.5K 2.7G 0% 5 1611897 0% /mnt ← 2.7GBに増加している scanning... 512B 7.0/amd64/noasks sd1d : ? ->quit Bye bye... fugu-demo#
[Memo]
⇒File system parameters (format type, block size, fragment size, inode density, etc.) are used as they are before expansion in growfs, while in newfs they are changed to the size after expansion. The matching parameters are set and formatting is performed.
Enter the exit command to terminate (logout) the account you are currently using.
fugu-demo# exit OpenBSD/amd64 (fugu-demo.localnet) (tty00) login:
We created a general user account in the previous section, so try logging in with this account.
OpenBSD/amd64 (fugu-demo.localnet) (tty00) login: yoshi Password: OpenBSD 7.2-stable (RDROOT.MP) #30: Wed Feb 8 13:07:26 JST 2023 Welcome to FuguIta, the OpenBSD-based live system. FuguIta aims to help popularize OpenBSD operating system by making it easier to get started with. For information on FuguIta's specific features and how to use them, please refer to the documentation on https://fuguita.org/. If you have any questions or suggestions for FuguIta, please send an email to me or post a message to fuguita.org's message board. Please feel free to contact me. Yoshihiro Kawamata kaw@on.rim.or.jp , https://fuguita.org/ fugu-demo$ pwd /ram/home/yoshi fugu-demo$ ls fugu-demo$ ls -a . .Xdefaults .cvsrc .mailrc .ssh .. .cshrc .login .profile fugu-demo$
[Memo]
⇒When logged in as root, the shell prompt will be "fugu-demo#", but for general users it will be "fugu-demo$".
Follow this notation in the following examples.
FuguIta saves all data such as files created by the user, changed settings, added packages, system logs, etc. to the storage partition created in the LiveUSB version of FuguIta, and recalls it at the next startup. can do. Run the usbfadm command to save the data. Usbfadm requires administrator privileges to run, so use the doas command to run usbfadm.
fugu-demo$ doas usbfadm doas (yoshi@fugu-demo.localnet) password: Welcome to usbfadm. USB flash drive administration tool for FuguIta Version/Arch: 7.2/amd64 (FuguIta-7.2-amd64-202302081) Boot mode: manual Target device: /dev/sd0d Data saved as: fugu-demo readline capability available TAB to complete the reserved words Type ? for help. ? : ? ->
First, specify the destination partition using the target command.
After confirming that the storage device is installed, press ENTER to scan the device.
Devices with a + sign in front of the device name are devices that can be used for saving.
? : ? --> target Searching USB flash drives Please make sure the device inserted. Then press ENTER -> cd0a sd0a +sd0d targe device--> sd0d
Then name the data you want to save using the saveas command.
If the name is omitted, the host name will be used as the save
sd0d : ? --> saveas Name of saved data --> fugu-demo Your data will be saved as ``fugu-demo''.
Notice that the prompt string, which was originally "? : ?", has changed. The values ?k?kset by the target command and saveas just now are displayed in the prompt so that you can check them.
Finally run the sync command to actually save the data.
/dev/sd0d : fugu-demo -> sync Sync current mfs as fugu-demo, OK? -> y building file list ... done created directory /mnt/livecd-config/fugu-demo ./ etc/ etc/bgpd.conf etc/boot.conf : : var/yp/Makefile.yp var/yp/Makefile.yp.dist var/yp/README sent 16455591 bytes received 232568 bytes 180412.53 bytes/sec total size is 15492096 speedup is 0.93
Let's display the information of the data saved with the info command.
/dev/sd0d : fugu-demo -> info Filesystem Size Used Avail Capacity Mounted on /dev/sd0d 218M 18.9M 179M 9.6% /mnt scanning... 18.9M 6.0/amd64/fugu-demo
The data seems to be saved without problems, so exit usbfadm.
/dev/sd0d : fugu-demo -> bye fugu-demo$
[Memo]
Saving with usbfadm can also be done from the shell command line.fugu-demo$ doas usbfadm -r doas (yoshi@fugu-demo.localnet) password: ======================================== = Sync current mfs as fugu-demo into /dev/sd0d = sending incremental file list deleting etc/X11/xenodm/authdir/authfiles/A:0-G4H73h : var/spool/smtpd/purge/ var/spool/smtpd/temporary/ #Option -r tells usbfadm to re-save the file.
You can also use cron to run periodically in the background.# crontab -l #minute hour mday month wday command --- omit --- #save session periodically #0 */4 * * * PATH=$PATH:/usr/local/bin /usr/fuguita/sbin/usbfadm -rqThis causes usbfadm saves to happen in the background every 4 hours. -q is a "quiet" option that does not show progress etc.
[Memo]
⇒You can use any partition that is formatted in the OpenBSD FFS format and has a directory named /livecd-config, even if it is not created with the usbfadm command.
To terminate FuguIta operation, log in as root and execute the shutdown command.
Or as a normal user, execute the shutdown command using the doas.
fugu-demo$ doas shutdown -h -p now doas (yoshi@fugu-demo.localnet) password: Shutdown NOW! shutdown: [pid 4771] fugu-demo$ *** FINAL System shutdown message from root@fugu-demo.localnet *** System going down IMMEDIATELY System shutdown time has arrived fugu-demo$ syncing disks... done
In the above example, the -h option is specified as a specification to the shutdown command, so the system is halted.
In addition, since the -p option is specified at the same time, the power will be automatically turned off immediately after stopping (some PC models do not support turning off the power with the -p option. In this case, to turn off the unit).
If you specify the -r option instead of the -h or -p options, the system will reboot.
In Fuguita, user-created data and system configuration files are held in memory. It will disappear.
The fact that the operations performed on Fuguita disappear when the system is stopped means that from a different point of view, it is less likely to affect existing systems installed on the internal hard disk.
In other words, deleting files, stopping processes, etc. as root has limited impact, so you can practice system administration with confidence.