Skip to content

1.7 Manage Software Configurations

Configure Kernel Options

Kernel Modules vs Drivers
  • some consider a kernel module just a "piece of software" of any kind at the kernel level that provide additional/different functionality, while a driver is a KIND of module used for communicating with hardware
  • drivers are more specific and fixed, they communicate directly to the hardware and often start at boot. Examples include sound drivers for audio devices, display drivers for graphics cards, and network drivers for network interfaces
  • modules are loaded dynamically throughout runtime and provide. They are easy to install or remove without rebooting the system. Sometimes for a PCI device, the driver and module are the same, such as on my ethernet interface
$ lspci -vs 00:1f.6
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-LM (rev 31)
    DeviceName:  Onboard LAN
    Subsystem: Lenovo Ethernet Connection (2) I219-LM
    Flags: bus master, fast devsel, latency 0, IRQ 122
    Memory at df000000 (32-bit, non-prefetchable) [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: e1000e
    Kernel modules: e1000e

NTP

For system components to operate, such as Cronjobs and systemd timers to run at the proper time, there must be accurate timekeeping. Computers can utilize the Network Time Protocol (NTP) to synchronize their time to an upstream time server or a pool of servers to maintain accurate time. It is a UDP service that runs on port 123.

NTP is how millions of computer's clocks stay synchonized over a network. This involved many time servers utilizing algorithms to mitigate the effect of network latency. NTP can typically maintain time to within 10 milliseconds over the public internet.

The stratum model is key in understanding how the precision of time degrades over a network. Stratum 0 are devices directly connected to the reference clock, such as a GPS antenna. Stratum 1 are time servers that distribute time to clients i.e Stratum 2 devices. The higher the Stratum number, the more the timing accuracy and stability degrades because the greater distance from the reference clock.

Use the following command to check your system clock and the sync status. Though status is actually the default if you just run timedatectl by itself.

❯ timedatectl status
               Local time: Wed 2023-11-15 16:44:58 CST
           Universal time: Wed 2023-11-15 22:44:58 UTC
                 RTC time: Wed 2023-11-15 22:44:58
                Time zone: America/Chicago (CST, -0600)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

If NTP service is inactive, set it to true.

timedatectl set-ntp 1

Here we can look at the NTP server, what stratum level we are, delay, etc.

timedatectl timesync-status 
       Server: 2620:2d:4000:1::40 (ntp.ubuntu.com)
Poll interval: 4min 16s (min: 32s; max 34min 8s)
         Leap: normal
      Version: 4
      Stratum: 2
    Reference: C944586A
    Precision: 1us (-25)
Root distance: 1.715ms (max: 5s)
       Offset: +7.926ms
        Delay: 139.890ms
       Jitter: 2.988ms
 Packet count: 4
Chrony

Chrony is a flexible NTP implementation to sync your clock across various NTP servers. It's deamon, chronyd continuously adjusts the system clock to calculate offset and drift.

Here is a guide from Ubuntu on installing and configuring Chrony.

localectl

This command is for managing your keyboard configuration and language settings.

❯ localectl
   System Locale: LANG=en_US.UTF-8
                  LANGUAGE=en_US:en
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105

As an example, you could set the keymapping to a US layout with localectl set-keymap us.

Here you can display locale names available on your system, which determines the language, character encoding, and cultural conventions used for displaying and formatting text.

❯ localectl list-locales 
C.UTF-8
en_AG.UTF-8
en_AU.UTF-8
en_BW.UTF-8
en_CA.UTF-8
en_DK.UTF-8
en_GB.UTF-8