Ceci est une ancienne révision du document !
Q Can a desktop user follow the Ubuntu 20.04 boot process through to Log In?
The reason I posed the above question was due to a speed problem with both WiFi & Bluetooth. The problem showed up when opening a web page, but would then time out, whereas the transfer of a file using Bluetooth would state that a small file would take over ten minutes or more to load.
After looking on the web, I found that I could use ‘speedtest-cli’ to check the network speed. It can be seen that the download speed is non-existent (below).
While writing these notes, I wanted to check the above ‘Hosted by ….’ timing when the WiFi was working correctly but, unfortunately, ‘speedtest-cli’ which is written in Python, is now not working and gives runtime errors.
Also from the web, use ‘lspci -v’ to find the WiFi / Bluetooth device and driver being used, i.e. Qualcomm QCA9377 Adapter and ath10k_pci driver (bottom right).
But, looking under ‘Settings / About / Software Updates / Additional Drivers’ (see top right), the QCA9377 Adapter we are told is using the ‘Disable WiFi ASPM L0s’ driver??
So can we use the boot process to find where the driver for the Network Adapter gets loaded?
Booting Ubuntu
The following is my understanding of what happens when a computer starts Ubuntu. Please email ronnie@fullcirclemagazine.org with any comments, corrections, or observations; your help is appreciated, as I am unable to find a definitive explanation.
I wanted to try and understand the boot process, and find any files that link through from power up, to a prompt for me to log in. There have been many hours reading books, and looking on many, many web pages to get the information listed below.
There are a number of distinct steps before an operating system asks you to log in to a username. The main steps for computers before 2011 are: • Power On Self Test (POST) • Basic Input/Output System (BIOS) • Master Boot Record (MBR) • GRand Unified Bootloader (GRUB{this has three sub-stages}, GRUB2) • Linux Kernel • Initial (init) • Runlevel Programs…
In 2011 the combined BIOS + MBR was updated, and now uses EFI or Unified EFI, so the main steps are: • Power On Self Test (POST) • Extensible Firmware Interface (EFI) or Unified EFI (UEFI) • GRand Unified Bootloader (GRUB{this has three sub-stages}, GRUB2) • Linux Kernel • Initial (systemd)..
The first steps are the same for any computer and are hardware specific.
POST, as the name implies, is a self-test of direct memory access and other hardware, initializing it to a known operational, working state, i.e. the power supply, memory, cpu, etc.
The order that the computer looks for a boot loader can be adjusted using the BIOS, e.g. CD-ROM, USB, Hard Disk, etc. The main use of the original BIOS was to read the MBR (Master Boot Record) which pointed to the one and only operating system stored in the boot sector.
Computer manufacturers’ EFI (firmware interface) varies greatly but is more complex than the older BIOS. Instead of relying on code in the boot sector on the hard disk, EFI relies on boot loaders stored as files in a disk partition known as the EFI System Partition (ESP). Thus EFI manages the storage of separate boot loaders for each OS that you install on the computer, e.g. Ubuntu, Mint, Windows, etc.
GRUB is the program which makes the computer smart enough to find the operating system kernel and start loading it into memory. The original GRUB has been superseded by GRUB2, but most systems use the name of ‘GRUB’ for GRUB2, and ‘GRUB Legacy’ for the original GRUB. The main difference is that GRUB Legacy was used with BIOS, whereas GRUB (GRUB2) is designed to work with EFI.
Linux Kernel is at the heart of every Linux system, and is made up of kernel drivers, many of which come in the form of Kernel Modules which handle the hardware in Linux.
Initial (or the initialization process) starts all the programs based on the desired features that the user wants to run in the Linux system. For example, on a laptop computer, the Linux system does not need to start a web server service, and a Linux server used by a company does not need to start a graphical desktop environment.
Runlevel Programs. The initialization process determines what services to start based on the runlevel of the system. There are seven levels numbered 0 to 6, and each one is assigned a set of services that should be active for that runlevel.
Background of GNU/Linux
We need an understanding of where Linux (as we call it) comes from, so that we can understand why Ubuntu uses the above steps in the way it does.
It was both Richard M Stallman & Linus Torvalds who originally started GNU/Linux. All systems that we call Linux today are, in fact, built on the work of this collaboration. Linux is a Unix-like operating system that conforms closely to conventions & standards associated with Unix, but does not contain any of the original Unix code.
Unix and GNU/Linux use runlevels, which are numbered from zero to 6, and S is sometimes used as a synonym for one of the levels. Folder ‘etc/’ (in Ubuntu 20.04) has sub-folders of rc0.d to rc6.d, as well as rcS.d – which look like runlevels.
Ubuntu is what is called a distribution of GNU/Linux – a distro for short. There are many Linux distros, Mint, SUSE, Fedora Red Hat, etc, including Ubuntu, that all use the Linux Kernel but then build their own user interface and other software on top.
Ubuntu 20.04
The computer used to view the boot process was a Dell Inspiron 3000 model 3581, with a disk partitioned into three - i.e. dev/sda1, dev/sda2 and dev/sda3.
The grand unified boot loader that Ubuntu 20.04 uses is GRUB (GRUB2, not GRUB Legacy). Linux uses GRUB to enable the user to boot different operating systems on the one computer system, albeit at different times.
The GRUB file that the computer runs is named grub.cfg, and is in the directory folder /boot/grub/grub.cfg. The contents of the grub.cfg file are automatically generated by ‘grub-mkconfig’ using templates from /etc/grub.d and settings from /etc/default/grub.
As mentioned above, the Linux Kernel is at the heart of all the distros.
The part of the grub.cfg file shown top right can be seen to set root to ‘hd0,gpt3’ which points to partition dev/sba3. The grub.cfg file also uses ‘initrd’ which is an initial RAM disk bound to the kernel and loaded as part of the kernel boot procedure. The ‘initrd’ contains a minimum set of directories & exe’s to get to the real root file system including the ‘insmod’ tool which installs kernel modules into the kernel.
There is also ‘vmlinuz-5…’ which is the statically linked executable file that contains the Linux kernel, and gets loaded from the GRUB file. This can be checked by opening a terminal window and running ‘uname -srm’ and ‘hostnamectl status’ (shown bottom right).
This is where I get confused, as the earlier Ubuntu distros have used ‘init’, ‘SystemV’ and ‘run levels’ to load other files, drivers, etc, to get to a usable operating system. As mentioned earlier, Ubuntu 20.04 has sub-folders that look just like the ‘run levels’.
We are told that Ubuntu 20.04 uses ‘systemd’. ‘systemd’ looks in the etc/systemd/system folder for the default.target file. When you find this file, it’s only a link to the file lib/systemd/system/graphical.target.
I was hoping to see ‘systemd’ being called from GRUB, but all I could find there was the ‘initrd’ ram file and the ‘insmod’ tool. So I do not know how ‘systemd’ gets started. It may be that the last thing that the kernel does is to start ‘systemd’, but I can not find anywhere to confirm this.
‘systemd’ uses ‘target’ files which are the Linux current or desired run state, and they define the services that must be present, running and active for the system to run in that desired state. A desired state could be the ‘rescue.target’, just a basic system, or the ‘graphical.target’ which has all services running with a graphical user interface.
The diagram bottom left is a copy from the boot man page, and shows the general sequence of events during the systemd startup.
(near the heading Network File System in the list) and find a reference to either of the WiFi network drivers that we have found earlier? (see bottom right).
Opening the files only shows that the contents of these files point to more general target files.
Summing Up
The question we posed was “Can a desktop user follow the Ubuntu 20.04 boot process through to Log In?”
For this user the answer would be a resounding “NO”.
The amount of files that are loaded, points towards backwards compatibility to earlier GNU/Linux boot-up procedures.
As the laptop was still in warranty, Dell was approached a number of times for technical advice as to why the WiFI was running slow, but I was told that as the operating system was Ubuntu they could not help.
During investigations of why the WiFi & Bluetooth was so slow, Dell’s Ubuntu test procedure web pages were used to record test results in preparation of another discussion with Dell. No files were changed, but for no reason I can find, the system just started working at full capacity again.