Return to Video

#rC3 - Linux remixen - Ich back' mir eine Linux-Distro

  • 0:00 - 0:16
    wikipaka preroll music
  • 0:16 - 0:23
    Hello and welcome to my talk on Remixing
    Linux. My name is The one with the braid,
  • 0:23 - 0:30
    and today I'm going to introduce your own
    creation of a Linux distribution. We will
  • 0:30 - 0:37
    talk on remixing Linux, on the
    architecture you require to run an own
  • 0:37 - 0:51
    Linux distribution, and some of the usual
    use cases. OK, let's start. Well, what are
  • 0:51 - 0:57
    use cases, what are purposes of your own
    Linux distribution? Of course, you could
  • 0:57 - 1:03
    customize Linux distribution for your
    enterprise environment. For example, if
  • 1:03 - 1:08
    you require special network settings, your
    own services to be installed, it's
  • 1:08 - 1:15
    sometimes easier to create an own
    distribution than using a ready to use
  • 1:15 - 1:21
    distribution and customizing it. Another
    option is that you discovered something
  • 1:21 - 1:28
    fully new and decide to create your own
    Linux distribution. That's what we call
  • 1:28 - 1:34
    yet another Linux distribution.
    Please, please do not do this. We already
  • 1:34 - 1:42
    have enough different flavors of Linux.
    OK, another valid reason is missing
  • 1:42 - 1:47
    software. If you require a special
    software for use case and you want to
  • 1:47 - 1:52
    bundle it into your operating system.
    That's a usual use case. Moreover,
  • 1:52 - 2:02
    embedding for microcontrollers is a common
    use case for Linux remixing, as well as
  • 2:02 - 2:11
    OEM hardware support for computer vendors
    to bundle Linux. Some known vendors do
  • 2:11 - 2:19
    this. Yeah, and of course, another desktop
    or in general different preinstalled
  • 2:19 - 2:25
    applications are a good reason to create
    your own distribution. OK, what are we
  • 2:25 - 2:31
    going to have a look on today? We will
    look on live systems, because that's the
  • 2:31 - 2:36
    most common use case. Afterwards we will
    go through step by step instructions for
  • 2:36 - 2:44
    and next, we take an example of Ubuntu. We
    talk on making your system installable and
  • 2:44 - 2:50
    we will talk about a simple tool
    simplifying some of these steps. We will
  • 2:50 - 2:55
    have a look on Linux from scratch, meaning
    compiling everything yourself without
  • 2:55 - 3:01
    using any templates or anything. And we'll
    look at the architecture you require to
  • 3:01 - 3:07
    run your own Linux distribution, a.k.a.
    package mirrors. OK, let's start with a
  • 3:07 - 3:15
    live system. What are properties of a live
    system? Of course it needs to fulfill some
  • 3:15 - 3:23
    requirements. If you use a tiny pen drive,
    I don't know, eight gigabyte or 16
  • 3:23 - 3:30
    gigabyte, it's obvious you need to
    compress your whole system. Moreover, it
  • 3:30 - 3:37
    must be writable at runtime. Just try to
    mount your root filesystem in Read-Only and
  • 3:37 - 3:43
    run a web browser. You run into big
    trouble. Same for network connections. If
  • 3:43 - 3:50
    you connect to wifi without writable root
    system, you will run into big trouble. And
  • 3:50 - 3:56
    another requirement, it's not really a
    requirement, but it's recommended is an
  • 3:56 - 4:01
    accessible live media. So if we have our
    pen drive containing our live Linux
  • 4:01 - 4:06
    distribution, we sometimes need to access
    the pen drive itself in our live
  • 4:06 - 4:12
    environment. For example, if we'll have
    packages of our distribution inside or on
  • 4:12 - 4:20
    our pen drive, we may want to install them
    later. Then it's quite good to have your
  • 4:20 - 4:27
    live media accessible. Well, of course, we
    could script everything on our own, but
  • 4:27 - 4:34
    someone already did all these steps and
    has put them into a tiny software called
  • 4:34 - 4:41
    Casper. Casper does exactly what we want,
    creates a union file system, meaning an
  • 4:41 - 4:48
    overlay on the existing file system and
    creates a kind of fake writable system in
  • 4:48 - 4:54
    memory, file system in memory. So it
    allows modification of files, creation of
  • 4:54 - 4:59
    new files while they are actually being
    stored in the memory instead of on our
  • 4:59 - 5:06
    physical disk. It mounts the live media
    and it shows up a pretty display manager
  • 5:06 - 5:12
    you can see over here. That's the Ubuntu
    mate, it asks whether you want to try our
  • 5:12 - 5:19
    system or whether we want to install our
    system. OK, let's talk about the
  • 5:19 - 5:25
    compression, because the compression we
    require is tremendous. If we have a normal
  • 5:25 - 5:33
    desktop distribution. Believe me, it
    consists of about 30 gigabyte of data.
  • 5:33 - 5:38
    Our applications, as soon as you install
    some more applications like LibreOffice or
  • 5:38 - 5:47
    a Web browser and some tools, you will
    reach the 30 gigabyte or 20 gigabytes, but
  • 5:47 - 5:53
    if you ever downloaded a live
    distribution, you will realize it's not 30
  • 5:53 - 6:04
    gigabyte. It's about two gigabyte or one
    point five. I noted in my slides. Yeah, it
  • 6:04 - 6:11
    means we need to compress our file system
    on about 5 or 10 percent of the actual
  • 6:11 - 6:19
    size. That's not difficult. There are many
    compression algorithms we may use, but we
  • 6:19 - 6:27
    have another requirement. We need
    performant readability. As soon as we boot
  • 6:27 - 6:33
    a system, our kernel won't stop accessing
    any files, reading files, writing files.
  • 6:33 - 6:39
    So we need a performant readability
    because no one wants to wait five minutes
  • 6:39 - 6:46
    to see the Web browser. And that's what
    the squash file system is made for. The
  • 6:46 - 6:52
    squash file system is a compressed file system.
    It's kind of a disk image, but more
  • 6:52 - 6:59
    advanced. It's used in diverse Linuxes.
    It's used in the operating system of
  • 6:59 - 7:06
    Chromecast and in the Linux userland it's
    used by app images. These are these click-
  • 7:06 - 7:13
    to-run Linux binaries you can download,
    and it's used by snap packages from
  • 7:13 - 7:20
    canonical's proprietary snap package
    manager, which is unfortunately very
  • 7:20 - 7:27
    widely spread. Yeah. Now we know something
    about compression. Let's talk about how
  • 7:27 - 7:34
    the customization works. Well, first of
    all, we download a template. We create a
  • 7:34 - 7:41
    base system from which we start our
    customization process. Well, we start
  • 7:41 - 7:49
    the customization itself. We prepare a CD
    environment. So when you put a bootloader
  • 7:49 - 7:56
    on a CD, we pack our root file system we
    just created, put it on the CD, put a
  • 7:56 - 8:05
    kernel there, make it, harden it a bit,
    and at the end we will pack it. OK, let's
  • 8:05 - 8:16
    go through it, step by step. In this case,
    we will have a look at Ubuntu, we will go
  • 8:16 - 8:23
    step by step through the customization
    process of Ubuntu. How do you start the
  • 8:23 - 8:31
    customization process? Well, you need an
    existing ISO file from a live environment
  • 8:31 - 8:39
    of Ubuntu, because it contains the
    bootloader, the directory structure and
  • 8:39 - 8:48
    everything, all the assets. Of course, you
    could create them on your own, but, well,
  • 8:48 - 8:55
    it's more work than you have to do. You
    can easily use the existing bootloader and
  • 8:55 - 9:01
    the existing files and directory structure
    from an existing ISO file. Well, let's
  • 9:01 - 9:07
    extract it and we're fine. We're done with
    it. Afterwards, we need to create a base
  • 9:07 - 9:15
    system. A base system is, well, the base
    of Linux. We have the base utils, the
  • 9:15 - 9:25
    base files, the directory structure, the
    kernel, a shell. The package manager of
  • 9:25 - 9:33
    our operating system we have. Without any
    unnecessary tools, without, just the base
  • 9:33 - 9:41
    of everything. You can either download the
    prepared base system of the distribution for
  • 9:41 - 9:49
    download, but you could create one on your
    own using tools like the other Debian tool
  • 9:49 - 9:55
    to create base system or the corresponding
    tools from other distributions. Yeah, as
  • 9:55 - 10:01
    soon as you have your base system, you
    need to change your root inside this base
  • 10:01 - 10:09
    system. And then you start the
    customization process by installing the
  • 10:09 - 10:15
    necessary drivers. We already talked about
    Casper. Casper is this tool providing the
  • 10:15 - 10:24
    live software and the live scripts, the
    overlay file system in Ubuntu based
  • 10:24 - 10:32
    systems. And it creates an initial RAM-
    file-system and installes the required
  • 10:32 - 10:38
    kernel modules to load and to boot a
    squashed file system. So let's install
  • 10:38 - 10:46
    these three packages, Casper, Ubiquity-
    Casper and Lupin-Casper. And afterwards we
  • 10:46 - 10:52
    can install whatever we want. We can
    install our loved vim, we can install our
  • 10:52 - 11:00
    loved Alpaka software, and we can install
    an alternative shell, the packages we
  • 11:00 - 11:07
    want. In the example code I provided here
    we look on changing the plymouth screen.
  • 11:07 - 11:13
    That's the startup screen which shows up
    when you boot the distribution. I don't
  • 11:13 - 11:20
    know, you could put an Alpaka in there or
    the logo of rC3. Yeah, that's what we do
  • 11:20 - 11:27
    in customization or modification of the
    system. Afterwards, we continue packing
  • 11:27 - 11:34
    everything we created. First of all, we
    need a Kernel to boot , because well
  • 11:34 - 11:40
    before our base system can be extracted,
    we need to load a kernel by the bootloader
  • 11:40 - 11:47
    and the kernel must contain the
    corresponding kernel modules to load, to
  • 11:47 - 11:53
    boot a squash file system. That's what
    Caspar already prepared for us, we only
  • 11:53 - 12:00
    need to create the initial run file system
    and if you read the code I provided, you
  • 12:00 - 12:08
    will see I was missing an minus between
    update and init RAM file system. Let's
  • 12:08 - 12:17
    create our initial RAM file system and
    copy them or copy it together with our
  • 12:17 - 12:25
    kernel to our extracted live environment.
    And can delete the prior kernels and so
  • 12:25 - 12:31
    on. We don't need them. We have our own
    kernels now. Afterwards we pack our base
  • 12:31 - 12:36
    system. Of course we need to unmount any
    mount points in the base system we created
  • 12:36 - 12:43
    and create a squash file system from it.
    And these three files, the VM Linux, the
  • 12:43 - 12:50
    initial Ramdisk and the squashfs file
    system, they are the major pillars of our
  • 12:50 - 12:56
    live environment. If we have those three,
    we are actually ready to go now. We can
  • 12:56 - 13:01
    either use our existing bootloader from
    our extracted ISO file or we, of course,
  • 13:01 - 13:07
    you can install your own bootloader in
    this directory. But well, it's easier to
  • 13:07 - 13:14
    use the existing. For security purposes
    and for hardening your live environment I
  • 13:14 - 13:22
    would recommend to put the MD5 sums of all
    files in your ISO file in this
  • 13:22 - 13:28
    environment, because as soon as you, for
    example, copy your distribution, for
  • 13:28 - 13:37
    example, on a pen drive on which is fat or
    ext4 formatted, it could be modified by
  • 13:37 - 13:43
    anyone. And that's why it's much better to
    verify the MD5 sums at the boot process.
  • 13:43 - 13:50
    Casper will automatically detect whether
    the MD5 sum, the txt file exists and if
  • 13:50 - 13:57
    it exists, it will automatically verify
    these MD5 sums. OK, now we are actually
  • 13:57 - 14:03
    ready to go, ready to pack up our ISO
    file. There's a famous tool called
  • 14:03 - 14:11
    genisoimage. So generate an ISO image,
    that's a command you could use. The
  • 14:11 - 14:20
    command takes care of legacy booting
    except of output file, the disk and the
  • 14:20 - 14:28
    disk image and the -r parameter, you could
    leave out everything if you do not require
  • 14:28 - 14:37
    legacy bootloaders. But if you want to
    obey legacy bootloaders, you should also
  • 14:37 - 14:45
    hybritize your ISO file to be able to dd
    the ISO file to a pen drive. Otherwise,
  • 14:45 - 14:52
    without the ISO hybrid command, it won't
    boot from, it would boot from a CD, but
  • 14:52 - 15:01
    not from a pen drive. Yeah. OK, now we
    created our own Linux distribution. Well
  • 15:01 - 15:05
    not that much. It's actually just a
    repacked Linux distribution. Now we talk
  • 15:05 - 15:11
    about making it a real distribution.
    That's why we talk about making it
  • 15:11 - 15:19
    installable. Why should we make it
    installable? Of course we could manually
  • 15:19 - 15:25
    install our system. We could manually format
    our hard drive, extract our file system and
  • 15:25 - 15:33
    manually create users and so on, et
    cetera, et cetera. But most of users
  • 15:33 - 15:40
    prefer graphical way except of these geeks
    taking part at the rC3. That's why an
  • 15:40 - 15:48
    installer may be useful. An installer does
    exactly what we need. It creates
  • 15:48 - 15:55
    partitions, creates users, installs
    language-packs, offers installation of
  • 15:55 - 16:00
    extra software and does everything the
    user might want. Creates users, connects
  • 16:00 - 16:06
    to wifi, whatever. And there are three
    very common installer frameworks:
  • 16:06 - 16:12
    Ubiquity, Calamaris and Anaconda. Now
    we'll have a look at these frameworks.
  • 16:13 - 16:22
    Ubiquity is known from Ubuntu. It's ready
    to use if installed, but it's actually not
  • 16:22 - 16:30
    at all customizable. Anyway, some hackers
    at GitHub found some ways to customize it
  • 16:31 - 16:36
    and provided some good information, some
    helpful information in their repositories.
  • 16:36 - 16:43
    The next one is Calamaris. Calamiris is
    highly customizable, is used by many
  • 16:43 - 16:51
    distributions, including SUSE Linux, I
    think Xubuntu, so the XFCE Ubuntu flavor,
  • 16:51 - 17:00
    DeepinOS, I think I am unsure. I think
    elementary as well. But if you only
  • 17:00 - 17:06
    install it, it won't work. You need to
    customize it. The third one is known from
  • 17:06 - 17:14
    the Fedora project. It's called Anaconda.
    It's a very advanced tool. It's able to
  • 17:14 - 17:20
    update existing systems. If we have an old
    Fedora installation, we can boot our live
  • 17:20 - 17:27
    CD and update the existing installation
    and moreover, very useful for admins is
  • 17:27 - 17:33
    the remote functionality. It can be
    started via SSH and automatically update
  • 17:33 - 17:38
    everything and automatically install and
    deploy the software we need. Um, yeah.
  • 17:40 - 17:47
    Well, I already mentioned, for everything
    you can manually do and customize, there
  • 17:47 - 17:52
    is a graphical tool. If you prefer the
    graphical way you could use the tool
  • 17:52 - 18:01
    remastersys, aka LinuxRespin. That's the
    the older name. It offers a simple
  • 18:01 - 18:07
    graphical user interface for packing your
    currently installed system into a live
  • 18:07 - 18:13
    distribution, allowing to install it. It
    does not allow a high amount of
  • 18:13 - 18:17
    customization in the graphical way, of
    course, you can manually perform it on the
  • 18:17 - 18:24
    command prompt. But it's an easy way to,
    for example, backup your just installed
  • 18:24 - 18:30
    system or you readily configured system to
    a pen drive to make it installable later.
  • 18:34 - 18:40
    And now, Linux from scratch. I guess most
    of you already heard of Linux from scratch
  • 18:40 - 18:46
    from scratch means, yeah, pretty much
    Linux from scratch. You start without
  • 18:46 - 18:52
    anything. You start on your host system
    and create an own system from scratch.
  • 18:53 - 18:59
    What does that mean? It means you should
    have lots of time. Lots of RAM, and many
  • 18:59 - 19:05
    processor cores. Because you need to
    compile everything yourself. Beside the
  • 19:05 - 19:10
    kernel, you need to compile the whole
    userland. If you want, you can include a
  • 19:10 - 19:16
    package manager or whatever. But if you
    make real Linux from scratch, you do not
  • 19:16 - 19:20
    take any binaries but compile everything
    yourself, everything on your own.
  • 19:21 - 19:29
    Currently, minimally, you need to compile
    226 dependencies. But in some years it
  • 19:29 - 19:36
    will be some more dependencies and the
    amount of dependencies required increases.
  • 19:36 - 19:41
    Yeah, after you compile everything, of
    course you need to configure everything,
  • 19:41 - 19:47
    need to provide a bootloader. But as soon
    as this is done, as soon as you created
  • 19:48 - 19:54
    your own base system, your own system from
    scratch inside a fake root, it's the same
  • 19:54 - 20:03
    as we already talked on during live system
    customization. As soon as you have this
  • 20:03 - 20:08
    fake root, you simply pack it to an image,
    so a squash file system, write it on a
  • 20:08 - 20:14
    disk, provide a bootloader, and that's it.
    OK, one more word. I will talk about
  • 20:15 - 20:19
    maintaining architecture for
    distributions. I will talk about package
  • 20:19 - 20:25
    servers. If you have a distribution, you
    usually provide updates, security fixes
  • 20:26 - 20:33
    and whatsoever. Maybe software the users
    may install later. Yeah, that's a package
  • 20:33 - 20:40
    mirror, a packet server. From Debian, you
    can simply mirror existing servers, for
  • 20:40 - 20:48
    example, the Debian or the Ubuntu or the
    Linux Mint servers by using the tool apt-
  • 20:48 - 20:54
    mirror. It simply mirrors, means it does
    not allow any customization. For ArchLinux
  • 20:54 - 21:01
    it's easy as well. You can simply use vftp
    and crontab to download the packages and
  • 21:01 - 21:09
    provide them on your host system, on your
    server and synchronize from them. That's
  • 21:09 - 21:15
    much easier than in the Debian
    environment. But usually if you have a
  • 21:15 - 21:22
    distribution, you want to customize it. At
    Debian, the tool aptly is very widely
  • 21:22 - 21:26
    spread because it allows very advanced
    management of different snapshots from
  • 21:26 - 21:31
    different repositories, mirrors, local
    repositories, single packages, allows
  • 21:31 - 21:37
    diffs and so on. But it does not allow any
    optimization. So good luck at scripting on
  • 21:37 - 21:44
    your own. If you look at ArchLinux, for
    example, you would usually write your own
  • 21:45 - 21:50
    package build files as you know them from
    the Arch user repository and include the
  • 21:51 - 21:58
    readily build packages into your directory
    from which you serve your updates. That's
  • 21:58 - 22:02
    much easier than in the Debian
    environment. I still found one more
  • 22:02 - 22:08
    graphic explaining aptly. That's what
    aptly can do. It can do everything. Well,
  • 22:08 - 22:12
    you have mirrors, you have local
    repositories. You can take snapshots, take
  • 22:12 - 22:17
    differences from snapshots, publish these
    differences, publish merged snapshots of
  • 22:17 - 22:24
    them, publish single snapshots, diff
    everything and do whatever you want. It's
  • 22:24 - 22:31
    very performant, the tool and yeah, but
    it's hard to use. It requires some time to
  • 22:31 - 22:39
    be learned. Yeah, that's it already on
    remixing Linux. Now there should be an
  • 22:39 - 22:45
    Q&A. Thank you very much for your
    attention of this talk. I hope I could
  • 22:45 - 22:53
    give you a good introduction into remixing
    Linux and good luck at coding and enjoy
  • 22:53 - 22:57
    your Remote Chaos Experience.
  • 22:57 - 23:01
    Music
  • 23:01 - 23:13
    Subtitles created by c3subtitles.de
    in the year 2021. Join, and help us!
Title:
#rC3 - Linux remixen - Ich back' mir eine Linux-Distro
Description:

more » « less
Video Language:
English
Duration:
23:06

English subtitles

Revisions