From 868784bd9105b378438b049d3835f7d32968774f Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 28 Sep 2019 20:22:07 -0600 Subject: Work on assignment --- README.md | 305 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 304 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6607a2b..cb94bc3 100644 --- a/README.md +++ b/README.md @@ -584,15 +584,318 @@ Your report should include advice to other people attempting to do the same. 1. Study the system configuration files and answer the following questions: a. What startup style does your system most resemble, BSD or AT&T? + + I am running Fedora 30 Workstation which resembles System V. + b. Why? Give at least two reasons for your answer above. (Examples would be presence or absence of /etc/inittab, init.d scripts, etc.) + + Most of the binaries that ship with the system are stored in `/usr/bin/` and `/usr/sbin` + instead of `/bin` and `/sbin/`. Fedora also has a `/etc/inittab` and `/etc/init.d`. + Fedora doesn't have an `/etc/rc.conf`. An OpenBSD system has startup scripts + defined in `/etc/rc.d`. + + ```bash + モ tree /etc/rc.d/ + /etc/rc.d/ + ├── init.d + │   ├── functions + │   ├── livesys + │   ├── livesys-late + │   └── README + ├── rc0.d + │   ├── K01livesys-late -> ../init.d/livesys-late + │   └── K99livesys -> ../init.d/livesys + ├── rc1.d + │   ├── K01livesys-late -> ../init.d/livesys-late + │   └── K99livesys -> ../init.d/livesys + ├── rc2.d + │   ├── K01livesys-late -> ../init.d/livesys-late + │   └── K99livesys -> ../init.d/livesys + ├── rc3.d + │   ├── S00livesys -> ../init.d/livesys + │   └── S99livesys-late -> ../init.d/livesys-late + ├── rc4.d + │   ├── S00livesys -> ../init.d/livesys + │   └── S99livesys-late -> ../init.d/livesys-late + ├── rc5.d + │   ├── S00livesys -> ../init.d/livesys + │   └── S99livesys-late -> ../init.d/livesys-late + └── rc6.d + ├── K01livesys-late -> ../init.d/livesys-late + └── K99livesys -> ../init.d/livesys + + 8 directories, 18 files + ``` + c. Which directory contains the rc.d (or similar file)? Explain the contents of the rc.d (or the file/s) that does the same in your setup. + + On Fedora, the /etc/rc.d is mostly empty. + There's a couple of shell scripts but it looks like it might be used for running Fedora from a live CD. + + ```bash + モ tree /etc/rc.d/ + /etc/rc.d/ + ├── init.d + │   ├── functions + │   ├── livesys + │   ├── livesys-late + │   └── README + ├── rc0.d + │   ├── K01livesys-late -> ../init.d/livesys-late + │   └── K99livesys -> ../init.d/livesys + ├── rc1.d + │   ├── K01livesys-late -> ../init.d/livesys-late + │   └── K99livesys -> ../init.d/livesys + ├── rc2.d + │   ├── K01livesys-late -> ../init.d/livesys-late + │   └── K99livesys -> ../init.d/livesys + ├── rc3.d + │   ├── S00livesys -> ../init.d/livesys + │   └── S99livesys-late -> ../init.d/livesys-late + ├── rc4.d + │   ├── S00livesys -> ../init.d/livesys + │   └── S99livesys-late -> ../init.d/livesys-late + ├── rc5.d + │   ├── S00livesys -> ../init.d/livesys + │   └── S99livesys-late -> ../init.d/livesys-late + └── rc6.d + ├── K01livesys-late -> ../init.d/livesys-late + └── K99livesys -> ../init.d/livesys + + 8 directories, 18 files + ``` + + The latest version of Fedora uses `systemd` for managing startup daemons. + `systemd` is configured using unit files. + + ```bash + モ tree /etc/systemd/system/ + /etc/systemd/system/ + ├── bluetooth.target.wants + │   └── bluetooth.service -> /usr/lib/systemd/system/bluetooth.service + ├── ctrl-alt-del.target -> /usr/lib/systemd/system/reboot.target + ├── dbus-org.bluez.service -> /usr/lib/systemd/system/bluetooth.service + ├── dbus-org.fedoraproject.FirewallD1.service -> /usr/lib/systemd/system/firewalld.service + ├── dbus-org.freedesktop.Avahi.service -> /usr/lib/systemd/system/avahi-daemon.service + ├── dbus-org.freedesktop.ModemManager1.service -> /usr/lib/systemd/system/ModemManager.service + ├── dbus-org.freedesktop.nm-dispatcher.service -> /usr/lib/systemd/system/NetworkManager-dispatcher.service + ├── dbus-org.freedesktop.timedate1.service -> /usr/lib/systemd/system/timedatex.service + ├── dbus.service -> /usr/lib/systemd/system/dbus-broker.service + ├── default.target -> /lib/systemd/system/graphical.target + ├── dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants + │   └── qemu-guest-agent.service -> /usr/lib/systemd/system/qemu-guest-agent.service + ├── display-manager.service -> /usr/lib/systemd/system/gdm.service + ├── getty.target.wants + │   └── getty@tty1.service -> /usr/lib/systemd/system/getty@.service + ├── graphical.target.wants + │   ├── accounts-daemon.service -> /usr/lib/systemd/system/accounts-daemon.service + │   ├── rtkit-daemon.service -> /usr/lib/systemd/system/rtkit-daemon.service + │   ├── switcheroo-control.service -> /usr/lib/systemd/system/switcheroo-control.service + │   └── udisks2.service -> /usr/lib/systemd/system/udisks2.service + ├── messagebus.service -> /usr/lib/systemd/system/dbus-broker.service + ├── multi-user.target.wants + │   ├── abrtd.service -> /usr/lib/systemd/system/abrtd.service + │   ├── abrt-journal-core.service -> /usr/lib/systemd/system/abrt-journal-core.service + │   ├── abrt-oops.service -> /usr/lib/systemd/system/abrt-oops.service + │   ├── abrt-vmcore.service -> /usr/lib/systemd/system/abrt-vmcore.service + │   ├── abrt-xorg.service -> /usr/lib/systemd/system/abrt-xorg.service + │   ├── atd.service -> /usr/lib/systemd/system/atd.service + │   ├── auditd.service -> /usr/lib/systemd/system/auditd.service + │   ├── avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service + │   ├── chronyd.service -> /usr/lib/systemd/system/chronyd.service + │   ├── crond.service -> /usr/lib/systemd/system/crond.service + │   ├── cups.path -> /usr/lib/systemd/system/cups.path + │   ├── dbxtool.service -> /usr/lib/systemd/system/dbxtool.service + │   ├── dkms.service -> /usr/lib/systemd/system/dkms.service + │   ├── dnf-makecache.timer -> /usr/lib/systemd/system/dnf-makecache.timer + │   ├── docker.service -> /usr/lib/systemd/system/docker.service + │   ├── firewalld.service -> /usr/lib/systemd/system/firewalld.service + │   ├── libvirtd.service -> /usr/lib/systemd/system/libvirtd.service + │   ├── mcelog.service -> /usr/lib/systemd/system/mcelog.service + │   ├── mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service + │   ├── ModemManager.service -> /usr/lib/systemd/system/ModemManager.service + │   ├── NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service + │   ├── nfs-client.target -> /usr/lib/systemd/system/nfs-client.target + │   ├── remote-fs.target -> /usr/lib/systemd/system/remote-fs.target + │   ├── rngd.service -> /usr/lib/systemd/system/rngd.service + │   ├── sssd.service -> /usr/lib/systemd/system/sssd.service + │   ├── vboxautostart-service.service -> /usr/lib/systemd/system/vboxautostart-service.service + │   ├── vboxballoonctrl-service.service -> /usr/lib/systemd/system/vboxballoonctrl-service.service + │   ├── vboxdrv.service -> /usr/lib/systemd/system/vboxdrv.service + │   ├── vboxservice.service -> /usr/lib/systemd/system/vboxservice.service + │   ├── vboxweb-service.service -> /usr/lib/systemd/system/vboxweb-service.service + │   └── vmtoolsd.service -> /usr/lib/systemd/system/vmtoolsd.service + ├── network-online.target.wants + │   └── NetworkManager-wait-online.service -> /usr/lib/systemd/system/NetworkManager-wait-online.service + ├── nfs-blkmap.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── nfs-idmapd.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── nfs-mountd.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── nfs-server.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── nginx.service.d + ├── printer.target.wants + │   └── cups.service -> /usr/lib/systemd/system/cups.service + ├── redis-sentinel.service.d + │   └── limit.conf + ├── redis.service.d + │   └── limit.conf + ├── remote-fs.target.wants + │   └── nfs-client.target -> /usr/lib/systemd/system/nfs-client.target + ├── rpc-gssd.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── rpc-statd-notify.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── rpc-statd.service.requires + │   └── nfs-convert.service -> /usr/lib/systemd/system/nfs-convert.service + ├── sockets.target.wants + │   ├── avahi-daemon.socket -> /usr/lib/systemd/system/avahi-daemon.socket + │   ├── cups.socket -> /usr/lib/systemd/system/cups.socket + │   ├── dbus.socket -> /usr/lib/systemd/system/dbus.socket + │   ├── dm-event.socket -> /usr/lib/systemd/system/dm-event.socket + │   ├── iscsid.socket -> /usr/lib/systemd/system/iscsid.socket + │   ├── iscsiuio.socket -> /usr/lib/systemd/system/iscsiuio.socket + │   ├── multipathd.socket -> /usr/lib/systemd/system/multipathd.socket + │   ├── spice-vdagentd.socket -> /usr/lib/systemd/system/spice-vdagentd.socket + │   ├── sssd-kcm.socket -> /usr/lib/systemd/system/sssd-kcm.socket + │   ├── virtlockd.socket -> /usr/lib/systemd/system/virtlockd.socket + │   └── virtlogd.socket -> /usr/lib/systemd/system/virtlogd.socket + ├── sysinit.target.wants + │   ├── dmraid-activation.service -> /usr/lib/systemd/system/dmraid-activation.service + │   ├── import-state.service -> /usr/lib/systemd/system/import-state.service + │   ├── iscsi.service -> /usr/lib/systemd/system/iscsi.service + │   ├── lvm2-lvmetad.socket -> /usr/lib/systemd/system/lvm2-lvmetad.socket + │   ├── lvm2-lvmpolld.socket -> /usr/lib/systemd/system/lvm2-lvmpolld.socket + │   ├── lvm2-monitor.service -> /usr/lib/systemd/system/lvm2-monitor.service + │   ├── multipathd.service -> /usr/lib/systemd/system/multipathd.service + │   └── selinux-autorelabel-mark.service -> /usr/lib/systemd/system/selinux-autorelabel-mark.service + ├── systemd-timedated.service -> /dev/null + ├── timers.target.wants + │   ├── mlocate-updatedb.timer -> /usr/lib/systemd/system/mlocate-updatedb.timer + │   └── unbound-anchor.timer -> /usr/lib/systemd/system/unbound-anchor.timer + └── vmtoolsd.service.requires + ├── vgauthd.service -> /usr/lib/systemd/system/vgauthd.service + └── vmtoolsd-init.service -> /usr/lib/systemd/system/vmtoolsd-init.service + ``` + d. What is stored in rc0.d? Execute the ls command while in rc0.d, and say what is common among all the files stored there. + + ```bash + モ ls -alh /etc/rc0.d/ + total 8.0K + drwxr-xr-x. 2 root 4.0K Jun 28 07:45 ./ + drwxr-xr-x. 10 root 4.0K Sep 3 07:01 ../ + lrwxrwxrwx. 1 root 22 Apr 25 20:30 K01livesys-late -> ../init.d/livesys-late* + lrwxrwxrwx. 1 root 17 Apr 25 20:30 K99livesys -> ../init.d/livesys* + ``` + + On this system there is two shell scripts defined in the `/etc/rc0.d` directory. + These two scripts are used for adding late init scripts for running the live image. + e. What is the function of files stored in init.d and the /etc/inittab? + + On older systems the `init.d` is the directory where you place startup shell scripts. + They typically respond to `start`, `stop` and sometimes `restart`. + + The `/etc/inittab` was used by the System V init system. + It would define what processes to start and monitor. + + Fedora now uses `systemd` so the `/etc/inittab` is not used. + + ```bash + モ cat /etc/inittab + # inittab is no longer used. + # + # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. + # + # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target + # + # systemd uses 'targets' instead of runlevels. By default, there are two main targets: + # + # multi-user.target: analogous to runlevel 3 + # graphical.target: analogous to runlevel 5 + # + # To view current default target, run: + # systemctl get-default + # + # To set a default target, run: + # systemctl set-default TARGET.target + ``` + + ```bash + モ ls -alh /etc/init.d/ + total 44K + drwxr-xr-x. 2 root 4.0K Sep 3 07:01 ./ + drwxr-xr-x. 10 root 4.0K Sep 3 07:01 ../ + -rw-r--r--. 1 root 18K Jun 28 06:46 functions + -rwxr-xr-x. 1 root 7.3K Apr 25 20:31 livesys* + -rwxr-xr-x. 1 root 1.1K Apr 25 20:30 livesys-late* + -rw-r--r--. 1 root 1.2K Sep 3 06:59 README + ``` + + ```bash + モ cat /etc/init.d/README + You are looking for the traditional init scripts in /etc/rc.d/init.d, + and they are gone? + + Here's an explanation on what's going on: + + You are running a systemd-based OS where traditional init scripts have + been replaced by native systemd services files. Service files provide + very similar functionality to init scripts. To make use of service + files simply invoke "systemctl", which will output a list of all + currently running services (and other units). Use "systemctl + list-unit-files" to get a listing of all known unit files, including + stopped, disabled and masked ones. Use "systemctl start + foobar.service" and "systemctl stop foobar.service" to start or stop a + service, respectively. For further details, please refer to + systemctl(1). + + Note that traditional init scripts continue to function on a systemd + system. An init script /etc/rc.d/init.d/foobar is implicitly mapped + into a service unit foobar.service during system initialization. + + Thank you! + + Further reading: + man:systemctl(1) + man:systemd(1) + http://0pointer.de/blog/projects/systemd-for-admins-3.html + https://www.freedesktop.org/wiki/Software/systemd/Incompatibilities + ``` + f. How do you enable/disable the CTRL-ALT-DELETE as an alternative to shutdown? -2. Read the main page for the shutdown command. + + To start and stop the service you can use `systemctl`. + + ```bash + モ systemctl status ctrl-alt-del.target + ● reboot.target - Reboot + Loaded: loaded (/usr/lib/systemd/system/reboot.target; enabled; vendor preset: enabled) + Active: inactive (dead) + Docs: man:systemd.special(7) + ``` + + ```bash + モ systemctl list-unit-files | grep ctrl-alt + ctrl-alt-del.target enabled + ``` + +2. Read the man page for the shutdown command. a. How do you shut down the system to a single-user mode? Try it and present results. + + ```bash + ``` + b. What’s difference between single-user mode and how the system normally runs? + + > Single-user mode is a mode where only the administrator (root) has access to the computer, the mode is designed for maintenance and is often used for repairs. - https://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x5152.htm + c. Explain options in the command “shutdown -t 100 +3 -h”. + + d. How do you boot into single-user mode? e. What, if anything, do you notice that is different about booting into single-user mode compared to shutting down to single-user mode? f. Shut the system down; then boot it normally. Look in the file /var/log/messages (often /var/adm/messages on some systems). How does the information in the “messages” file compare with what appears on the screen during boot? -- cgit v1.2.3