Study Writeup: Linux Distributions Overview

From Matt Morris Wiki
Jump to navigation Jump to search

This is a Study Leave topic.

What Is It?

A Linux distribution (often called a distro for short) is an operating system made as a software collection based on the Linux kernel and, often, on a package management system.

Why Study It?

I'm going to be spending a lot of time in the Linux world as part of playing with Docker and related tech: getting a handle on the options around distros is the first stage. Right now all I know is that RedHat get used by corps desperate for something that looks like an old-school support model, Ubuntu is for the mainstream consumer space, and Arch lets you blow your own arm off with an exciting degree of ease.

Since my needs are going to be somewhat non-standard it'll be a good idea for me to avoid wasting time with the wrong distros as a base for my Linux work.

Toggl code

Toggl code is WRITEUP-LINUXDIST

Deliverables

Max 3 hours of time.

TODO: Multiple distros coexisting

Installation: How To Create Bootable Live USB Of Linux Mint ( 16 Petra ) In Windows , Linux And Mac

Writeup

General requirements for a modern distribution: 700MHz, 1G Ram, 5G Disk

All The Linux

For a 4G / 160G / Intel 2 Core machine, 35GBP secondhand from ebay as of Feb16

Partitions

  • 1G boot
  • 2G Swap
  • 20G for main install (ubuntu)
  • extended
    • 12G for each subsequent (160 - 23 = 137, 11 available)

Systems

  • ubuntu 14.04.4
  • elem os 0.3.2
  • lxle 14.04.3
  • mint 17.3
  • opensuse 42.1 kde
  • opensuse 42.1 gnome
  • arch 2016.03.01

Aim

  • Brief writeup on each
  • KDE vs Gnome impression
  • What do you like best?

Remote Connections (VNC etc)

To turn off TLS encryption in vino, which causes VNC Viewer & many other programs to complain they can't deal with the security challenge, issue this command:

gsettings set org.gnome.Vino require-encryption false

Multiple Installations

Print and read this: Installing Multiple Linux Distributions on a Single Machine

Good advice on multiple kernel builds: Configuring, compiling and installing a custom Linux kernel

Fixing grub: System Rescue CD: Repairing a damaged Grub

Fedora

Fedora 27 and Steam

After upgrade, running steam gave:

Running Steam on fedora 27 64-bit
STEAM_RUNTIME is enabled automatically
Installing breakpad exception handler for appid(steam)/version(1461972496)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

Key was to run:

LIBGL_DEBUG=verbose steam

Which gave me:

Running Steam on fedora 27 64-bit
STEAM_RUNTIME is enabled automatically
Installing breakpad exception handler for appid(steam)/version(1461972496)
libGL: OpenDriver: trying /usr/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/dri/swrast_dri.so
libGL: dlopen /usr/lib/dri/swrast_dri.so failed (/home/matthew/.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu/libgcc_s.so.1: version `GCC_7.0.0' not found (required by /lib/libLLVM-5.0.so))
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

... pointing to a problem with the GCC version in the embedded runtime off .local/share/Stream - presumably resolved from the ambient GCC installation present in Fedora when Steam was installed (Fedora 25).

I blew away .local/share/Stream and re-ran stream, it reinstalled the runtime, and everything worked.

Note that this method killed all my saved games! Could have tried moving things around instead but I did't have anything I particularly wanted to hang onto.

Arch

Notes for Arch Linux Beginners' Guide

Dealing with missing by-label on initial setup run

cd /dev/disk
mkdir by-label #(if the folder is not there)
cd by-label
ln -s ../../sr0 ARCH_201504
and maybe this but I think actually not ... mount -t iso9660 /dev/disk/by-label/ARCH_201504 /run/archiso/bootmnt
exit

to get the keyboardm use loadkeys uk

dhcpcd will detect ethernet if you forgot to plug it in before starting!

Partition Removal

Boot off a live USB and run GParted

To remove dev mapper once partition gone:

  • dmsetup remove /dev/mapper/...
    • dmsetup remove /dev/mapper/cl00-root
    • dmsetup remove /dev/mapper/cl00-swap
    • dmsetup remove /dev/mapper/cl00-home

Kernel Removal

  • /boot/vmlinuz*KERNEL-VERSION*
  • /boot/initrd*KERNEL-VERSION*
  • /boot/System-map*KERNEL-VERSION*
  • /boot/config-*KERNEL-VERSION*

/* lib/modules/*KERNEL-VERSION*/

  • Update grub configuration file /etc/grub.conf or /boot/grub/menu.lst to point to correct kernel version.

Grub2 Rescue

FInd the right partition:

  • grub rescue> ls
  • grub rescue> ls (hd0,x)/

Start grub off:

  • grub rescue> set prefix=(hd0,1)/boot/grub
  • grub rescue> set root=(hd0,1)
  • grub rescue> insmod normal
  • grub rescue> normal

Then rewrite grub config & run grub2-install

CentOS

Fixing Windows Boot

CentOS install doesn't retain the Windows boot by default - Ubuntu is friendlier!

Fixing windows boot for CentOS: https://www.centos.org/forums/viewtopic.php?f=47&t=47376

Get the partitions so you can see which one Windows is:

  • $ sudo fdisk -l

Add the following text - root=(hd0,i) where i is zero-indexed partition count (0 for sda1, etc)

  • $ sudo nano /etc/grub.d/40_custom
menuentry "Windows Server 2008 (on /dev/sda3)" {
        set root=(hd0,2)
        chainloader +1
}

Updating Grub Config

  • $ sudo grub2-mkconfig -o /etc/grub2.cfg
  • $ sudo cat /etc/grub2.cfg

NOT /boot/grub2/grub.cfg !!!

If missing partitions, try mounting and unmounting them, e.g.

[matthew@localhost ~]$ sudo mkdir /mnt_sda2 (first time only) [matthew@localhost ~]$ sudo mount /dev/sda2 /mnt_sda2 [matthew@localhost ~]$ sudo umount /dev/sda2 [matthew@localhost ~]$ sudo mkdir /mnt_sda5 (first time only) [matthew@localhost ~]$ sudo mount /dev/sda5 /mnt_sda5 [matthew@localhost ~]$ sudo umount /dev/sda5

Good Things To Install

The "kate" text editor is part of the KDE SDK:

  • $ sudo yum install kdesdk

General Kernel Info

Trying Other Kernels

(First time only) Install and update tools:

  • $ sudo yum groupinstall "Development Tools"
  • $ sudo yum install ncurses-devel
  • $ sudo yum update

Get kernel source:

Make sure it's clean

  • $ sudo make mrproper

Create kernel config using previous settings

  • $ sudo sh -c 'yes "" | make oldconfig'

Make the kernel (I need to look how to speed this up - took hours!!)

  • ARCH from uname -m
  • number after j is number of cores
  • $ sudo make ARCH=x86_64 -j2

Install the kernel

  • $ sudo make modules_install install

Update grub config (see above)

Current Extra config:

menuentry "Windows 7 Professional (on /dev/sda2)" {
        set root=(hd0,1)
        chainloader +1
}
menuentry 'NOR:DEFAULT CentOS 7.1.1503 (Core) (on cl-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'nor:def' {
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos3'   
        linux /vmlinuz-3.10.0-229.4.2.el7.x86_64 root=/dev/mapper/cl-root
        initrd /initramfs-3.10.0-229.4.2.el7.x86_64.img
}
menuentry 'EXP:DEFAULT CentOS 7.1.1503 (Core) (on clexp-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'exp:def' {
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos6'   
        linux /vmlinuz-3.10.0-229.4.2.el7.x86_64 root=/dev/mapper/clexp-root
        initrd /initramfs-3.10.0-229.4.2.el7.x86_64.img
}
menuentry 'EXP:3.18.4 CentOS 7.1.1503 (on clexp-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'exp:3.18.4' {
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos6'   
        linux /vmlinuz-3.18.4 root=/dev/mapper/clexp-root
        initrd /initramfs-3.18.4.img
}
menuentry 'EXP:3.18.16 CentOS 7.1.1503 (on clexp-root)' --class gnu-linux --class gnu --class os $menuentry_id_option 'exp:3.18.16' {
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos6'
        linux /vmlinuz-3.18.16 root=/dev/mapper/clexp-root
        initrd /initramfs-3.18.16.img
}

Current

DistroWatch page hits as of 04 June 2015 give:

  • 1 Mint 2909<
  • 2 Ubuntu 1730=
  • 3 Debian 1666>
  • 4 Fedora 1296>
  • 5 openSUSE 1288
  • 6 CentOS 1038=
  • 7 elementary 989<
  • 8 Mageia 981>
  • 9 Manjaro 933<
  • 10 Arch 881<

Overview

The main trunks are Debian, RedHat and Slackware.

  • Arch Linux (2002): Elegant, minimal, simple. Needs understanding from user, it's command-line rather than MS-style graphical tools. Rolling releases.
    • Manjaro (2011): Tries for more user-friendliness while still following Arch principles of rolling releases etc
    • Antergos (2012): Originally Cinnarch. Another attempt to make Arch more user friendly, using a graphical install
  • Debian (1993): GNU/Free orientation; huge and widely used. Ubuntu is based on it. Many options as to desktop, ports. Kernels supported are Linux, kFreeBSD and (unofficially) GNU HURD.
    • Knoppix (2000): Designed to be run directly from CD/DVD/Flash Drive.
    • Ubuntu (2004): From Debian. End-user oriented. Desktop is Unity (was GNOME until 2010). Every fourth release (every 2 years) has a Long Term Support (LTS) agreement. Run by Canonical software, who make money through support and other technical services
      • Linux Mint (2006): Aimed at ease of use. Full out-of-the-box multimedia support by including some proprietary software such as Adobe Flash. Some LTS, v17.x supported until Apr2019 (5 years). Good USB Flash Drive support
      • Kubuntu: less-used KDE variant of Ubuntu
      • Xubuntu (2006): Uses Xfce desktop
      • Lubuntu (2011): Lightweight, uses LXDE desktop.
      • Elementary OS (2011): Mac-Like philosophy of use simplicity: better global aesthetics by streamlining the user interface, reduce software dependency by using core apps written in the C language or Vala, diminish the need to access the terminal.
  • Fedora (2003): Sponsored by Red Hat. It's what Linus uses. Innovation with short support cycles (release every 6 months, supported for 13 months).
    • Red Hat Enterprise Linux (2003): Nowadays based off Fedora. Oriented to enterprises requiring long support cycle: major releases every 2 years, with current support life out to 10. Replaces Red Hat Linux, which was discontinued to make way for it.
      • CentOS (2004): Aims to be free, enterprise-class, community-supported computing platform that's compatible with RHEL. Affiliated with Red Hat but aspires to be more public, open, and inclusive. While Red Hat employs most of the CentOS head developers, the CentOS project itself relies on donations from users and organizational sponsors
      • Oracle Linux (2006): Used internally in Oracle, and sold with technical support program externally
  • Gentoo (2002): Compiled locally. Gentoo is sometimes described as a "meta-distribution". Gives full control of software build. Investing the time to config and tune can result in very efficient desktops and servers. Gentoo encourages users to build a Linux kernel tailored to their particular hardware. It allows very fine control of which services are installed and running; also, memory usage can be reduced, compared to other distributions, by omitting unnecessary kernel features and services. Good for fairly technical people who want to learn more about Linux. Has active and helpful community.
    • Chromium OS (dev): Base for Google's Chrome OS. Designed to work primarily with web application.
      • CoreOS (2013): Very much in the news: fork of Chrome OS, oriented towards container running (Docker etc), now with their own container standard (Rocket)
  • Mageia (2011): Forked from now-defunct Mandriva, shares its philosophy of ease of use
  • openSUSE (2005): Community effort, sponsored by SUSE, a German company selling Linux products, some previous association with Novell too
  • Slackware (1993): Simplicity of system design. Don't change upstream sources. Command-line oriented. Relies on original config mechanisms rather than distribution-specific config where possible. Seems to be gradually falling off in popularity. Managed by Patrick Volkerding.

Real-Time

The CONFIG_PREEMPT_RT kermel patch seems to be the main approach:

RTLinux had a different approach: running the OS as a preemptive process

Kernel Versions

Wikipedia Linux Kernel page

  • 2.6.x.y: 17Dec03 - 18May11 (2.6.39)
  • 3.x.y: 21Jul11 - 08Feb15 (3.19)
  • 4.x.y: 12May15 - present (4.1)

There were no meaningful technical reasons for the numbering change from 2.6.39 to 3.0, or from 3.19 to 4.0. The major version number was increased just to avoid large minor numbers.

In practice current distros are some way behind the leading edge. For instance as of 05Jun15, the current RHEL release (version 7) ,which came out in 15Apr14, used kernel 3.10, which came out in 30Jun13 - that is, the kernel is about 2 years behind the latest release 4.1.

By contrast, the current Debian "jessie" release (8.0) came out in Apr15 and uses kernel 3.16 (03Aug14), and the current Ubuntu 15.04 release came out in Apr15 and uses kernel 3.19.3 (Feb15).

Hatreds

RedHat vs Oracle

From Nov 2010, with the release of RHEL 6, the company released its kernel package with all patches pre-applied. This makes it harder for people (Oracle in particular) reselling support for distros on top of RHEL. CentOS is not so much affected because it doesn't sell support.

Oracleset up a new service that allows Red Hat Enterprise Linux (RHEL) customers to more easily browse the source code of changes Red Hat has made to its version of the Linux kernel. Called RedPatch, the new service is a Git repository that holds every patch Red Hat has applied to the kernel source, broken out as one code commit per patch.

Lots of people vs Red Hat

I hate Redhat with a passion that burns like a thousand stars. - random arstechnica thread

Red Hat bankroll a lot of Linux development, and are also the leading providers of corporate-friendly support models. This combination of power-holding and alignment with non-free interests does not dispose everyone well towards them.

Red Hat hacked off a lot of people in 2004 when dropping their lower-end offering and forcing people wanting a supported Red Hat distro to move to RHEL. So there's that.


Lots of people vs Ubuntu

Ubuntu is resented for a number of reasons - its rapid success relative to Debian (in the minds of some of the public, Ubuntu is Linux), but more damagingly, there is a perception in some quarters that Ubuntu leeches off Debian, using all the hard work Debian puts in without committing upstream fixes itself (keeping all its enhancements to its own distribution level). There also seems to be an element of unwillingness to see a popular Linux distribution that reminds end users of Windows/Mac?

Desktop wars

On the desktop, as of LinuxQuestions 2014 Desktop Environment Of The Year. KDE was most popular, with Xfce next.

Desktop:

  • KDE (1996): innovative, uses Qt
  • Xfce (1996): lightweight, uses GTK+
  • GNOME (1997): more stable, uses GTK+
  • LXDE (2006): lightweight, used by Raspbian for instance
  • Unity (2010): Ubuntu
  • GNOME 3 (2011): Mobile oriented, not universally loved, chased a lot of people off Gnome
  • MATE (2011): Forked from GNOME 2
  • Cinnamon (2011): Another GNOME fork, default for Linux Mint distribution

Windowing:

  • X (1987): still widely used
  • Mir (dev): Ubuntu for Unity 8 (next gen)
  • Wayland (2012): support by GNOME/KDE etc is a work in progress

Lots of people vs systemd

When a computer starts:

  • some kind of built-in firmware (in PCs, this is the BIOS or UEFI) takes over control, initializes the system, and loads a boot loader from a storage device (usually a hard drive)
  • This boot loader is a bit more elaborate and loads a kernel from a storage device.
  • The kernel then loads drivers, initializes hardware access, and starts one very specific program: The init process. As it is the first process to be run by the kernel, it gets the process ID (PID) 1.

The original init process is called "SysV init", which refers to both the binary /sbin/init as well as the whole process. This has well-known deficiencies:

  • It doesn't cover all initialisations:
    • starting processes on socket connections has to be done by inetd or xinetd
    • If you want to monitor a service and restart it when it fails, you have to use supervisor or circus.
    • etc
  • So the admin is left with multiple different places to look for whether a service is running, or even what services are running at all.
  • SysV init simply expects each and every service to re-implement common functionality instead of implementing it itself once.
    • every service has to daemonize itself. This is not a trivial task, requiring 15 separate steps to do correctly. Even the system call daemon(7) is discouraged because it forgets some of the steps.
    • all services that open TCP ports below 1024 are expected to start as root, open the socket, and drop user privileges by themselves.
    • Generally, dropping user privileges and setting up a chroot has to be done by services
    • Logging is another aspect that every service gets to re-implement badly.
  • So SysV init is limited in what it does, and people aren't very happy even with how it tackles what it does do

There were many candidates to replace SysV init, but systemd is clearly winning as of mid 2015. Ubuntu have switched to it from 15.04. Debian adopted it in 2014, with a bitter fight around it. See here for Debian's reasoning on adopting systemd. Timeline:

  • 2006: Upstart begins
  • 2010: systemd begins
  • 2011: Fedora (RedHat) enable systemd by default
  • Oct2013: Debian begin to debate whether to go for systemd
  • 12Feb2014: Debian go for systemd over Upstart (4:4 deadlock requiring chairman's casting vote)
  • 14Feb2014: Ubuntu follow suit (as they position as central member of Debian family)

Systemd gets a lot of hate, and the following is typical: Systemd flies in the face of the Unix philosophy: ‘do one thing and do it well,’ representing a complex collection of dozens of tightly coupled binaries. Its responsibilities grossly exceed that of an init system, as it goes on to handle power management, device management, mount points, cron, disk encryption, socket API/inetd, syslog, network configuration, login/session management, readahead, GPT partition discovery, container registration, hostname/locale/time management, mDNS/DNS-SD, the Linux console and other things all wrapped into one.

However the battle seems to be pretty conclusively over here.

Some good reading:

LXDE tips

Removing items from user menus

  • change to ~/.local/share/applications
  • cp /usr/share/applications/NAME.desktop .
  • leafpad NAME.desktop
  • Add NoDisplay=true at start of initial section