Anatomy of GNU / Linux

Some time ago on Habré there was a small wave of posts on the topic “Why I [did not] choose Linux”. As a decent fanatic, I got haircut, but I decided that it was more productive to tell something about my favorite system than to break copies in the comments.





I got the impression that many GNU / Linux users have little idea of ​​what this operating system is made of, so they claim that it is slurred from pieces that came to hand. At the same time, the architecture of most distributions is well-established and governed by a number of standards, including the freedesktop.org graphical environment standard and the Linux Standard Base, which extends the Unix standards. When I was introduced to GNU / Linux a few years ago, I lacked a simple anatomical map of a typical distribution for immersion, so I'll try to tell you about it myself.





Loader

An operating system session begins with a bootloader like a theater from a hanger. The default bootloader today is GNU GRUB , also known as GRUB 2 . The first branch, now called " GRUB Legacy ", is still available . Another bootloader with a long history is Syslinux .





The bootloader's job is to initialize the Linux kernel. To do this, in general, you need to know where the kernel is and be able to read this place (section Ext4, for example). To help the kernel, the bootloader usually pulls in the initial boot image as well, which we will talk about later. GRUB does a lot of other things, such as building very complex menus and chainloading other boot loaders (Windows Boot Manager for example). GRUB has shell-like configuration syntax and is extensible in modules.





GRUB is large and powerful, sometimes too powerful, and embedded systems often use the compact Das U-Boot .





Nucleus

Linux (« , !»). , , POSIX- . /boot/



vmlinuz



, «vm» , «z» , .





, :





  • mainline («»);





  • LTS ( );





  • rt ( );





  • (zen, hardened etc);





  • libre ( , ).





  • -Linux Debian GNU/Hurd ( GNU Hurd) Debian GNU/kFreeBSD ( FreeBSD ). , , GNU/Linux.





initrd initramfs. , . , .





(- ZFS, - LUKS). . . , . :





  • initramfs-tools — Debian.





  • Dracut ( ) — RHEL (CentOS, Scientific Linux etc.). , .





  • mkinitcpio Archlinux, Dracut, .





  • make-initrd — Alt Linux.





Plymouth, . (-), , , « »™ Ubuntu Fedora.





Init

— . PID 1. . , , /sbin/init



( /usr/bin/init



, , ).





. Sysvinit, Unix System V. Sysvinit . , , , , «-». 00-- 10- : OpenRC Gentoo, Upstart Canonical, Systemd Red Hat . Systemd. . . , - Apache 153 , apache Arch Linux — 15 . , , , , , Unix.





, . — « , », , POSIX . « » (login shell) — , . , . , /etc/passwd



.





:





  • Bourne shell (sh) — « », .





  • Bourne again shell (bash) — GNU/Linux sh.





  • Debian Almquist shell (dash) — , sh. Debian, /usr/bin/sh



    .





  • Z shell (zsh) — bash, . , .





  • BusyBox — , , — POSIX- ( : $ busybox sh



    ).





, . — X Window System 1984 . , . , Unix- . GNU/Linux ( BSD) Xfree86. X.Org Server, Xorg, XFree86.





X Window System — , , — . , . SSH , , ( sshd):





$ ssh -X hostname firefox
      
      



, X Window System : , — . «The UNIX-HATERS Handbook».





X, , , , .





X keyboard extension, , .





«» . — Wayland. Wayland . , Wayland 2008 , X .





Weston Window Manager
Weston

Weston — Wayland. . , weston



.





. « » (root window), , , «» , . «» . .





, (DM) . , , ( ) . - , ( , , ). , . ~/.xinitrc



. startx



.





Life without DM
DM
Living with SDDM
c SDDM

:





  • GDM GNOME;





  • SDDM KDE;





  • LightDM — ;





  • FlyDM — Astra Linux.





(DE) , , :





  • ;





  • ;





  • ;





  • ;





  • , ;





  • ;





  • , ;





  • ( );





  • ., .





, GNOME KDE, , . Awesome i3.





Window Manager Window Maker
Window Maker

Window Maker GNUstep. GNUstep NeXTSTEP. .





— , , . , Windows Forms , Motif (Open Motif ).





GTK Qt. GTK GIMP GNOME. C , Python C++, Vala. Qt — , ( - ). C++ , (). . KDE .





API

Mesa — . API OpenGL , , Vulkan ( API VDPAU VAAPI). , Mesa , DirectX .





, , , , .





PAM — Pluggable Authentication Modules — . , , , . PAM , PAM Kerberos ( MIT' krb5), PAM . ( so



) . , (pam_mkhomedir.so



) (pam_mount.so



).





su sudo ( root



). — su , - , sudo — . sudo , - , - .





Polkit . sudo, , sudo — . , , JavaScript'.





Linux Security Modules (LSM) — Linux, ́ . ́ , . — SELinux AppArmor. Red Hat, Immunix Canonical Ltd. , SELinux RHEL , AppArmor — Ubuntu. . , , . , - . - . , .





GNU/Linux , , , .





CUPS — « UNIX», Apple. , , , . CUPS - ( localhost:631).





Muzzle CUPS
CUPS

CUPS , SANE. , SANE . CUPS. , , HPLIP HP Inc. HPLIP GNU/Linux HP. , HPLIP CUPS , HP CUPS, . hp-setup



.





ALSA. , PulseAudio ALSA. , PulseAudio — , , . JACK, . , MIDI-.





Red Hat PipeWire PulseAudio JACK. .





POSIX- . GNU/Linux , (IPC) -. D-Bus, . ? , , . .





GNU/Linux ( ). NetworkManager — Red Hat, , . NM , . NetworkManager , , , VLAN' , , nmtui



nmcli



. , Red Hat, , Debian , « » NM . , — Wicd.





WiFi-, , WPA supplicant, iwd, , Intel.





Bluez, Bluetooth-.





iptables . , , Linux Netfilter. ( ) nftables nft. , , IPv4, IPv6, ARP L2-. iptables nftables . , nft iptables.





- nftables ( ), RHEL firewalld, Ubuntu — UFW.





— . — RPM Red Hat dpkg Debian. — pacman Arch Linux. RPM dpkg : , , . , . RHEL yum, dnf, Debian apt-get apt-cache, apt. pacman , . , . nix, .





— - . , ( GNU/Linux). : Flatpack Gnome, Snap Canonical AppImage . , . , . .





, — GNOME Software KDE Discover.





KDE Discover
KDE Discover
GNOME Software with a branded button in the title bar
GNOME Software

:





Contemporary GNU / Linux as seen by an artist
GNU/Linux

GNU/Linux, , . :





  • GNU Free Software Foundation;





  • Red Hat, , IBM;





  • kernel.org Linux Foundation.





, , — , ? , : open source. , . , , - , , -, . , GNU/Linux, - .






@ajijiadduh, , , .





You can send edits and suggestions to https://gitlab.com/bergentroll/gnu-linux-anatomy .





Copyright © 2020 Anton "bergentroll" Karmanov.





This work is licensed under the Attribution-ShareAlike 4.0 Worldwide (CC BY-SA 4.0) license .












All Articles