LWN: Comments on "Preparing for a merged /usr in Debian" https://lwn.net/Articles/670071/ This is a special feed containing comments posted to the individual LWN article titled "Preparing for a merged /usr in Debian". en-us Mon, 13 Oct 2025 15:22:49 +0000 Mon, 13 Oct 2025 15:22:49 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Preparing for a merged /usr in Debian https://lwn.net/Articles/707143/ https://lwn.net/Articles/707143/ raliscenda <div class="FormattedComment"> <font class="QuotedText">&gt;Unfortunately the result of symlinking things, causes developers who hard code paths to have portability problems, going to more traditionally laid out systems.</font><br> <p> Your assumptions are that GNU/Linux is only one favour of UNIX like system developers have to support. For sure all BSD based systems does not have plan to merge /usr in near future, so portability issue stay with us for a while.<br> </div> Wed, 23 Nov 2016 07:34:05 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/673226/ https://lwn.net/Articles/673226/ trenton <div class="FormattedComment"> That's why merging /usr in all popular distributions is particularly important. Only after that it will be possible to change shebangs in scripts from #!/bin/bash to #!/usr/bin/bash. After some (long) period of time it will be possible to remove /{bin,sbin,lib} top level directories, as shebangs will no longer point on them, reducing top-level clutter and achieving separation of concerns, as you proposed.<br> </div> Sat, 23 Jan 2016 19:06:59 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672565/ https://lwn.net/Articles/672565/ apoelstra <div class="FormattedComment"> I think it'd have been better to say "use &gt;" (which would indeed be better for readability than « or ») rather than "do what everyone else does". There are a bunch of quoting styles used on LWN, and my feeling is that «...» is easier to read than most of them, since these characters are distinctive and never used for anything but quoting.<br> <p> </div> Wed, 20 Jan 2016 17:27:57 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672509/ https://lwn.net/Articles/672509/ jond <div class="FormattedComment"> It's not a language issue, it's a website-issue. On LWN, people quote with "&gt;", because it gets marked up nicely. Anything else is harder to read (and the OP has not even been consistent in using U+00BB etc.)<br> </div> Wed, 20 Jan 2016 14:22:09 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672490/ https://lwn.net/Articles/672490/ anselm <blockquote><em>Linux kernel is booted mounting /dev/sda1 as /, which contains a fully functional but "vanilla" / filesystem.</em></blockquote> <p> This is essentially what happens with initramfs, except that the initramfs is loaded using the boot loader/system firmware, and can in principle come from anywhere (including a remote server). Your approach forces you to have the first-stage “/” available locally as an actual file system on a storage medium, which sucks if you want to have a diskless system. </p> <p> You still need to ensure that whatever is on the first-stage “/” matches the rest of the system, just like with an initramfs. The difference is that the process of making initramfses is fairly well-understood and there are good tools for it already. </p> <blockquote><em>Anyhow in the current practice GRUB's root (first-stage root) /boot is inside an unencrypted partition distinct from that containing / (second/third stage root) and someone could replace anyhow its contents with suitably "improved" kernel images or "initramfs" snapshot images. I know people who understand boot processes and who keep /boot (only) on a USB storage device they carry with them at all times because they reckon that an encrypted / with an unencrypted /boot is not giving them peace of mind.</em></blockquote> <p> Two points: </p> <ul> <li>Your approach doesn't help these people because your first-stage “/” can't be encrypted either, since the Linux kernel has no way of getting at a pass phrase to decrypt the first-stage “/”. They will have to put their first-stage “/” on a removable storage device just like they do now with “/boot”.</li> <li>It is quite possible for GRUB to use an encrypted “/boot” (see, e.g., <a href="http://michael-prokop.at/blog/2014/02/28/full-crypto-setup-with-grub2/">here</a>), although it is not what distributions do by default.</li> </ul> Wed, 20 Jan 2016 09:00:18 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672463/ https://lwn.net/Articles/672463/ mjg59 <div class="FormattedComment"> If /dev/sda1 is used only for boot and then gets dropped, it's actually identical to an initramfs except none of the tooling to keep it in sync with the rest of the system exists and you can't use it for netbooting so it's precisely as complicated but less flexible and nobody's written the software that you'd need to make it work. And you still don't have a way to choose a kernel unless you're using kexec, which isn't an option. The reason we do things the way we do is that it works better than what you're proposing.<br> </div> Tue, 19 Jan 2016 19:38:12 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672455/ https://lwn.net/Articles/672455/ walex <p>It seems that I need to explain again the basics of how the boot process works and how UNIX/Linux sytems wor k in repect of the <tt>mount</tt> and <tt>pivot_root</tt> system calls, I'll try to keep it short:</p> <ul> <li>It is impossible to avoid using a static kernel and a simple root filesystem to <em>boostrap</em> the process of getting to a complex-configuration <tt>/</tt> or <tt>/usr</tt> or anything else.</li> <li>The only choice is which "static kernel" and "simple root" to use.</li> <li>Currently the "static kernels" and "simple root" are the GRUB kernel (stage2) plus its root filesystem <tt>/boot</tt> and the Linux kernel it loads plus its stage 1 "simple root", the "initramfs" instantiated from the associated static snapshot loaded from <tt>/boot</tt>.</li> <li>They can both be replaced with the Linux kernel and a <tt>/</tt> filesystem.</li> <li>That <tt>/</tt> filesystem for stage 1 booting can be but does not need to be the stage 2 <tt>/</tt> filesystem anymore than the GRUB kernel <tt>/boot</tt> root needs to part of the stage 2 <tt>/</tt> or <tt>/usr</tt> filesystem or the "initramfs" snapshot image need to be stored on those stage 2 <tt>/</tt> or <tt>/usr</tt> filesystems.</li> </ul> <p>The outline boot sequence can therefore well be:</p> <ul> <li>Linux kernel is booted mounting <tt>/dev/sda1</tt> as <tt>/</tt>, which contains a fully functional but "vanilla" <tt>/</tt> filesystem.</li> <li>Linux kernel loads from it modules, runs scripts, does whatever it takes to unencrypt and prepare for mounting <tt>/dev/sda2</tt> which contains <tt>/etc</tt>, <tt>/bin</tt>, <tt>/var</tt>, <tt>/home</tt>, ... <tt>/usr</tt>.</li> <li>Then something like <tt>mount /dev/mapper/sda2 /newroot</tt> and <tt>pivot_root /newroot</tt>. In simpler times that would be instead something like <tt>mount /dev/mapper/sda2 /</tt>, and I have done something like that many times in the distant past. and occasionally in the recent past (e.g. after boot from live-CD)</li> <li>Linux kernel remounts the "vanilla" root in <tt>/dev/sda1</tt> as <tt>/boot</tt> :-).</li> </ul> <p>That the above, which seems to me basic system knowledge, needs explaining again and again in detail is quite frustrating; as I wrote a few times already, the first-stage boot <tt>/</tt> (or kernel) does not need to be the very same as the the second-stage <tt>/</tt> (or kernel), and indeed in the current arrangement there are another two.</p> <p>Plus there is <tt>mount --bind</tt> for an alternative option.</p> <p>Anyhow in the current practice GRUB's root (first-stage root) <tt>/boot</tt> is inside an unencrypted partition distinct from that containing <tt>/</tt> (second/third stage root) and someone could replace anyhow its contents with suitably "improved" kernel images or "initramfs" snapshot images. I know people who understand boot processes and who keep <tt>/boot</tt> (only) on a USB storage device they carry with them at all times because they reckon that an encrypted <tt>/</tt> with an unencrypted <tt>/boot</tt> is not giving them peace of mind.</p> Tue, 19 Jan 2016 19:25:35 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672448/ https://lwn.net/Articles/672448/ paulj <div class="FormattedComment"> Ah wikipedia has some more information: <a href="https://en.wikipedia.org/wiki/Quotation_mark">https://en.wikipedia.org/wiki/Quotation_mark</a> <br> <p> «This is common in France apparently»<br> </div> Tue, 19 Jan 2016 16:57:42 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672446/ https://lwn.net/Articles/672446/ paulj <div class="FormattedComment"> That's not bespoke at all, that's the normal way of quoting in some countries (Germany or France and a few others?). Also common is „This is a quote”, but I can't remember where, and probably lots more.<br> <p> Not all the world is anglo-phile.<br> </div> Tue, 19 Jan 2016 16:54:30 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672399/ https://lwn.net/Articles/672399/ nix <div class="FormattedComment"> Linked-in initramfses are a fragility *reduction*: even if your / is completely buggered, you still have a userspace running, and you can easily build in an emergency shell and recovery tools: all the bootloader needs is to be able to find the kernel image, and it's found the entirety of early userspace too. This has saved my bacon on multiple occasions, because among other things it means that the fsck used to fsck / and /usr is built in to the kernel image. This also means you can identify when changes in fsck, mount and the like have broken something critical by simply booting a known-working kernel, which will automatically contain a known-working fsck :)<br> <p> Now linked-in initramfses are, admittedly, not what distros use, but they still work (and if they stop working people like me will yell bloody murder so they should keep working!)<br> <p> Other benefits of using an initramfs include that the terrible hack whereby fsck has to work on mounted filesystems and then you sometimes have to crash-reboot is simply gone: fsck of filesystems needed by early boot, be that /, / and /usr, or whatever, is just like fsck of everything else. Plus, of course, it means that those of us using setups you consider intolerably unusual such as RAIDed / can use them without effort. Heck, I've suddenly switched an existing system from RAID to RAID-partially-over-NBD in the past when a sudden disk failure left me bereft on one machine but with a superfluity of storage on another: without an early userspace, this would have been an entirely hopeless quest without support in the *kernel* for such a baroque configuration, which is unlikely in the extreme.<br> <p> This was not something I did recently, either -- it was way back in 2005. This configuration has been useful for over a decade now. Recent architecture astronautics it is not.<br> <p> </div> Tue, 19 Jan 2016 12:39:38 +0000 Further history of Unix of /usr https://lwn.net/Articles/672397/ https://lwn.net/Articles/672397/ jond <div class="FormattedComment"> <font class="QuotedText">&gt; <a href="https://people.debian.org/~stapelberg/docs/systemd-dependencies.html">https://people.debian.org/~stapelberg/docs/systemd-depend...</a></font><br> <p> I'm not sure if you read that before you posted it, but it basically debunks the myth that systemd has too many dependencies.<br> </div> Tue, 19 Jan 2016 12:09:20 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672396/ https://lwn.net/Articles/672396/ jond <div class="FormattedComment"> Your bespoke quoting style «...» is quite hard to read. Please consider doing what everyone else does to keep the conversation easy to read.<br> </div> Tue, 19 Jan 2016 11:56:26 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672391/ https://lwn.net/Articles/672391/ anselm <blockquote><em>The only things that can be disputed is whether mounting in sequence '/boot', "initramfs", '/', '/usr' are all necessary, and if not whether one should drop from that sequence '/boot' and "initramfs" or "/".</em></blockquote> <p> The issue here isn't necessity as much as convenience. As I said earlier, the Linux community used to do initramfs-free boots based on LILO for quite some time in the 1990s. We've come off that idea not because it doesn't work (it does, at least for simple scenarios), but because on the whole it is inconvenient and restrictive. </p> <p> The initramfs-based approach, even though it looks more complicated at first sight, is vastly more powerful and convenient, and the added complexity is a price that most Linux distributions seem more than happy to pay. After all, Linux distribution makers are not in the business of making their life more complicated just for the sake of making it more complicated; they prefer approaches that work in a wide variety of cases and can be maintained. </p> <p> If you think you can come up with a method of booting Linux systems that is better than what we have now, feel free to implement it and show it off to distribution makers. If it really is superior to the current approach, they'll be more than happy to take it on. That method worked for systemd in the basic-plumbing arena, after all … </p> Tue, 19 Jan 2016 10:05:04 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672389/ https://lwn.net/Articles/672389/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; The solution that exists and has existed for decades and has worked well for decades is to mount am ordinary '/' filesystem at first-stage boot and use that to mount '/usr'</font><br> <p> That's certainly a thing you could do, but now you have two choices:<br> <p> 1) Have /var, /home and /etc be part of /, and so be unencrypted<br> 2) Have /var, /home and /etc be separate partitions, and introduce additional complexity (how do you know where /etc is if /etc isn't already there?)<br> <p> Both of these choices are bad, and so your solution is a bad solution and has not worked well for decades.<br> </div> Tue, 19 Jan 2016 09:02:35 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672388/ https://lwn.net/Articles/672388/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; In exactly the same way that currently GRUB gets its modules and scripts and the new kernel in the content of an encrypted "/boot" filesystem, which also contains «important stuff that you want to put on it». :-)</font><br> <p> The grub configuration and contents of /boot aren't secret and so don't need to be encrypted, so you're proposing copying much of the contents of / into /boot?<br> </div> Tue, 19 Jan 2016 08:57:26 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672387/ https://lwn.net/Articles/672387/ walex <div class="FormattedComment"> «Things that grub doesn't do. And nor does the kernel. But an initramfs does. So we use the solution that exists, and we'll continue doing so until somebody dislikes it enough to come up with an alternative that works better.»<br> <p> The solution that exists and has existed for decades and has worked well for decades is to mount am ordinary '/' filesystem at first-stage boot and use that to mount '/usr' (encrypted over iSCSI using TPM if necessary) for second stage boot. If you think that is more complicated and fragile than to mount first '/boot', then "initramfs", then '/', then '/usr', and that in such a sequence the clever move is to drop '/', good luck.<br> <p> </div> Tue, 19 Jan 2016 08:53:31 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672385/ https://lwn.net/Articles/672385/ walex <div class="FormattedComment"> «OK, so “/” is encrypted (it would after all be a very bad idea to leave it unencrypted, with all the important stuff that you want to put on it). Now how do you get at that trivial shell script in the mounted “/” file system when the kernel needs the pass phrase to mount “/” in the first place?»<br> <p> In exactly the same way that currently GRUB gets its modules and scripts and the new kernel in the content of an encrypted "/boot" filesystem, which also contains «important stuff that you want to put on it». :-)<br> <p> As I wrote several times, disputing that there must be a statically installed bootloader and kernel mounting a simple filesystem at the start of the boot sequence from which to load another kernel, drivers, configuration files and scripts to mount anything else, is just pointless and a really stupid debating trick. Because that's how boot sequences work by necessity (the second stage is necessary because of the flexibility requirements).<br> <p> The only things that can be disputed is whether mounting in sequence '/boot', "initramfs", '/', '/usr' are all necessary, and if not whether one should drop from that sequence '/boot' and "initramfs" or "/".<br> <p> </div> Tue, 19 Jan 2016 08:42:37 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672384/ https://lwn.net/Articles/672384/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; I may be wrong I don't think GRUB has block device drivers to access /boot</font><br> <p> It does, but they're not typically used in BIOS or UEFI environments. I point this out merely for precise technical accuracy rather than it altering your point in any way!<br> </div> Tue, 19 Jan 2016 07:55:11 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672383/ https://lwn.net/Articles/672383/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; UEFI, for instances, does contain file system code. And UEFI doesn't require GRUB to boot Linux from a filesystem. I'd bet two pennies that if we had UEFI from the start, GRUB would not be as popular and LILO would not held out so long, assuming all else being equal.</font><br> <p> To an extent. UEFI only (typically) has support for FAT, so your kernel and initramfs need to live on FAT, and the compromises around using FAT as a meaningful filesystem tend to result in it being difficult to make it /boot. Grub is, perhaps depressingly, less awful than some of the compromises you have to make to launch kernels from UEFI directly.<br> </div> Tue, 19 Jan 2016 07:47:37 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672374/ https://lwn.net/Articles/672374/ raven667 <div class="FormattedComment"> <font class="QuotedText">&gt; That objection is comically stupid ... people who actually understand booting sequences ...</font><br> <p> We can disagree without being insulting or dismissive here, some of the people here actually build distributions and know more about booting than either of us do combined.<br> <p> <font class="QuotedText">&gt; I think that this is the third time that I have explained this is detail for those who ignore how booting sequences work.</font><br> <p> I think we are going to disagree about how clear your ideas have been represented by your writing, the evidence is in how few people seem to have understood your intent. Let me see if I understand what you are proposing as another valid way to boot a system.<br> <p> If I understand correctly you are thinking that we should go back to a simple LILO or uEFI style boot loader that is capable of loading the kernel and passing parameters from the firmware but to disaggregate what is currently in the initramfs into /boot, presuming that the kernel will have built-in drivers equivalent to what the firmware provides to be able to access the block device that /boot lives on, or that the kernel will use the firmware APIs to read the block device. Once you can reliably access the /boot block device you can run your minimal userspace to do hardware setup and pivot into the "real" system.<br> <p> <font class="QuotedText">&gt; is to have a Linux kernel without needing any sorts of drivers compiled statically except those needed to mount the first-stage / filesystem from a local storage area, exactly as GRUB does it for boot,</font><br> <p> I may be wrong I don't think GRUB has block device drivers to access /boot, it relies on the firmware built-in services to access the block device, although it does have its own minimal filesystem driver modules (BIOS or uEFI or whatever), which are loaded LILO-style using static block lists, which has the same problems as LILO but GRUB modules are updated more infrequently than the kernel so is less of a problem in practice.<br> <p> <font class="QuotedText">&gt; plus optional kexec</font><br> <p> As mjg59 has said elsewhere, and he has more operational experience with this feature than I do, it is a neat feature and great when it works, it's not something that is so reliable that you'd want to depend on it for the common case of everyday booting. In any event, if you are going to boot a Linux kernel, it might as well be the "real" one.<br> <p> <p> <p> </div> Tue, 19 Jan 2016 01:52:04 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672373/ https://lwn.net/Articles/672373/ MattJD <div class="FormattedComment"> <font class="QuotedText">&gt; It comes as amazing news to me that the UNIX and Linux kernels didn't have «code in the system» to «to read filesystems». Try to imagine: before GRUB (or LILO) happened UNIX and Linux kernel could be easily booted, and mount /usr from encrypted filesystems, from iSCSI volumes, etc. How could this happen if GRUB «GRUB was necessary to read filesystems, as no other code in the system provided that»?</font><br> <p> I apologize for the confusion. I was talking about IBM compatible BIOS. BIOS doesn't have, afaik, filesystem code. It can only read from hard drives (and depending upon age, limited sized drives!). Even Microsoft has a bootloader that loads the windows kernel. Before LILO, Linux must have had a different bootloader. Or it embedded the command line and fit in the first sector of the hard drive. Other Unix either had their own bootloader, or ran on other platforms which I don't know and won't speak for their system setup code.<br> <p> UEFI, for instances, does contain file system code. And UEFI doesn't require GRUB to boot Linux from a filesystem. I'd bet two pennies that if we had UEFI from the start, GRUB would not be as popular and LILO would not held out so long, assuming all else being equal.<br> <p> <font class="QuotedText">&gt; GRUB (the bootloader) has exactly the same fault! Please read the manual: it can only ever boot one statically configured (with grub-install) GRUB kernel. If you upgrade the GRUB kernel you have to rerun its (static) installation.</font><br> <p> A rarer event for me, and a step required as part of my system upgrade. Countless times I'd forget to rerun LILO when testing a kernel, and break the system. GRUB is far more resilient, even when I upgrade it. Anyways, no matter what you do there is always a risk upgrading bootloaders. Many people find GRUB, even with its complexity over LILO, more robust. I also find it much easier to debug failures with GRUB and recover systems.<br> <p> <font class="QuotedText">&gt; &lt;snip&gt; dynamically selected "second stage" Linux kernel to boot with kexec.</font><br> Correct me if I'm wrong, but kexec wipes out the previous system state. To build such a system would require extra work to make kexec into a proper bootloader replacement. Considering GRUB has all the drivers I need to just boot my preferred kernel and reliably load an initial /, why would I replace the simpler GRUB with a more complex system?<br> <p> Also, some hardware is really unhappy about kexec. As a trivial example, my desktop GPU. It does not like being double initialized from the kernel, and I suspect it would take a lot of work to make it so for little gain (this is all on the official open source driver stack).<br> <p> <p> The boot process is always a pain on a system (my favourite example? The A20 line that needs to be dealt with in real mode). Everything is about trying to make it better. I won't argue the current system is the best thing possible (I know I'll be proven wrong eventually). I do think it's very good as is.<br> <p> If you want to remove GRUB, UEFI allows that. I do see the value in making cut down systems that match your current system, by initramfs (and I've manually created an initramfs, including initial boot scripts. Interesting, but not unreasonable process. I used it for several years on an encrypted LVM /).<br> <p> I'm willing to be shown that whole line of thought is wrong. I suggest you try creating your desired system, including all the necessary support structure. If it is better, I'd be happy to push it forward. As of right now, I just don't see how yours is better considering my experience with the Linux boot system.<br> </div> Tue, 19 Jan 2016 01:12:00 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672372/ https://lwn.net/Articles/672372/ mjg59 <div class="FormattedComment"> We currently have this:<br> <p> grub stage 1 loads grub stage 2. Scripts in grub stage 2 allow the choice of kernel and initramfs, loaded via firmware provided drivers. initramfs contains a subset of /. initramfs mounts the real /.<br> <p> What you're proposing is:<br> <p> lilo loads the boot kernel. Boot kernel mounts a / (we'll call it "boot /") that contains a subset of the real /. Scripts there allow the choice of kernel and /, loaded via boot kernel provided drivers. After kexecing a new kernel, the new kernel mounts "boot /" again and executes further scripts that mount the real /.<br> <p> In your proposal you end up mounting "boot /" twice, you have to keep "boot /" synchronised with the real /, your boot kernel is significantly more complicated than grub and can't make use of any firmware-provided functionality (making it less flexible), you're using lilo which doesn't work under UEFI (ie, modern systems) and you're relying on kexec which *doesn't work* in a number of real-world cases. Your solution is *more* complicated than what we have today.<br> </div> Tue, 19 Jan 2016 00:27:44 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672365/ https://lwn.net/Articles/672365/ walex <p>«<q>When BIOS was how x86 booted, GRUB was necessary to read filesystems, as no other code in the system provided that.</q>»</p> <p>It comes as amazing news to me that <em>the UNIX and Linux kernels</em> didn't have «<q>code in the system»</q> to «<q>to read filesystems</q>». Try to imagine: before GRUB (or LILO) happened UNIX and Linux kernel could be easily booted, and mount <tt>/usr</tt> from encrypted filesystems, from iSCSI volumes, etc. How could this happen if GRUB «<q>GRUB was necessary to read filesystems, as no other code in the system provided that</q>»?</p> <p>«<q>LILO was mentioned previously, but LILO had one large fault: if you upgraded your kernel you had to rerun LILO, or everything broke</q>»</p> <p>GRUB (the bootloader) has exactly the same fault! Please read the manual: it can only ever boot one statically configured (with <tt>grub-install</tt>) GRUB kernel. If you upgrade the GRUB kernel you have to rerun its (static) installation.</p> <p>It is the GRUB kernel that spawns its shell environment, loads perhaps dozens out of several hundred (most them entirely Linux specific) possible GRUB kernel modules from <tt>/boot</tt>, and run a system initialization script that loads a Linux kernel, a toy <tt>/</tt> snapshot in the "initramfs", and then passes control the Linux kernel. These are well described and documented booting steps, and I am astonished that so many people here seem to ignore them.</p> <p>This ridiculous and fragile complexity can be replaced by LILO replacing the GRUB bootloader, a "first stage" Linux kernel replacing the GRUB kernel, one that mounts a <tt>/</tt> directly instead of a pointless <tt>/boot</tt> or "initramfs", loads modules and scripts from it to mount <tt>/usr</tt> from anywhere, and load <em>optionally</em> a new kernel chosen dynamically by a user-interaction script, and <tt>kexec</tt> it.</p> <p>As I just wrote in another comment, it cannot be disputed that the booting sequence <em>must</em> involve: #1 a bootloader that can only load one statically configured kernel, #2 a simple filesystem mounted by that kernel using statically builtin drivers and configuration, and #3 a series of drivers, scripts and other executables run dynamically by the kernel loaded in #1 from the filesystem mounted in #2.</p> <p>There is simply no reason to have #1 as the GRUB stage1, #2, as the GRUB stage2 kernel, #3 as the <tt>/boot</tt> filesystem, then #2 again as a Linux kernel loaded from <tt>/boot</tt> with #3 again as the "initramfs".<p> <p>Like in traditional UNIX and Linux systems this can all be far more easily arranged with #1 as LILO, #2 as a "first stage" Linux kernel with just (for example!) the VESA, serial, SATA, "ext4" drivers built in, mounting <tt>/</tt> from which any further driver modules, initialization scripts, etc. can be run to support arbitrarily complex boot <em>configurations</em>, including <em>optionally</em> loading a dynamically selected "second stage" Linux kernel to boot with <tt>kexec</tt>.</p> <p>This may be the <em>fourth</em> time I try to explain how boot sequences actually work and how a traditional UNIX/Linux boot sequence works and is more robust and flexible than involving needlessly both <tt>/boot</tt> and "initramfs" as replacement for <tt>/</tt>....</p> <p>Note: as always, a completely storage-less system needs a RAM disk and to download a disk image into it to setup <tt>/</tt>, but that's then the job of the bootloader like PXE.</p> Mon, 18 Jan 2016 23:45:43 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672362/ https://lwn.net/Articles/672362/ anselm <blockquote><em>That objection is comically stupid, because I have proposed a setup where /usr gets mounted and the second stage kernel (if needed, and it will be rarely needed) gets booted by a full (if minimal) GNU/Linux system hosted inside a first stage / root filesystem</em></blockquote> <p> Right, so please explain how you load your kernel from your first-stage “/” if that is encrypted. Something must find and decrypt the kernel before it can run. (GRUB can do it but you don't want to use GRUB.) </p> <blockquote><em>The proposed setup, which is the historical UNIX setup plus optional kexec, is to have a Linux kernel without needing any sorts of drivers compiled statically except those needed to mount the first-stage / filesystem from a local storage area</em></blockquote> <p> Nobody disagrees that this is possible in principle. We all did it that way on Linux 1.x, 20 years ago. The main reasons we prefer not to do it that way anymore are that (a) using an initramfs is much less hassle than compiling a new custom kernel for every single machine that we want to run Linux on, and (b) an initramfs lets us do various things in a reasonably straightforward manner that in the traditional setup are very difficult or impossible to achieve at all. In any case, it turns out that the initramfs approach, in actual practice, is a lot less brittle than you seem to assume. </p> <blockquote><em>and prompting for passwords can be done by a trivial shell script in the mounted / filesystem, and does not need to be done by the UNIX/Linux kernel</em></blockquote> <p> OK, so “/” is encrypted (it would after all be a very bad idea to leave it unencrypted, with all the important stuff that you want to put on it). Now how do you get at that trivial shell script in the mounted “/” file system when the kernel needs the pass phrase to mount “/” in the first place? </p> Mon, 18 Jan 2016 23:37:09 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672367/ https://lwn.net/Articles/672367/ dirtyepic <div class="FormattedComment"> <font class="QuotedText">&gt;Because the Very Important People who have decided that merging is Just Like Microsoft Does It And Therefore Is Good have forgotten </font><br> <p> I always love it when the loonies preload their arguments like this and I know I can just skip the rest of the post and all the replies. Thanks big guy!<br> </div> Mon, 18 Jan 2016 23:32:25 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672366/ https://lwn.net/Articles/672366/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; In exactly the same way GRUB currently prompts for the passphrase to mount an encrypted /boot, the same way GRUB currently gets the network configuration to mount /boot over iSCSI, and using the same way GRUB uses to interact with the TPM to attest system state to the user.</font><br> <p> Things that grub doesn't do. And nor does the kernel. But an initramfs does. So we use the solution that exists, and we'll continue doing so until somebody dislikes it enough to come up with an alternative that works better.<br> </div> Mon, 18 Jan 2016 23:31:37 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672364/ https://lwn.net/Articles/672364/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt; just like it has been done for decades by people who actually understand booting sequences</font><br> I.e. not you?<br> <p> Please, desist from insulting people who actually do the work to make booting reliable and stable.<br> </div> Mon, 18 Jan 2016 23:17:16 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672361/ https://lwn.net/Articles/672361/ walex <p>«<q>How does the kernel obtain the passphrase to decrypt an encrypted /? The network configuration to mount a / over iscsi? Interact with the TPM in order to attest system state to the user?</q>»</p> <p>In exactly the same way GRUB currently prompts for the passphrase to mount an encrypted <tt>/boot</tt>, the same way GRUB currently gets the network configuration to mount <tt>/boot</tt> over iSCSI, and using the same way GRUB uses to interact with the TPM to attest system state to the user. Equivalently all the same ways all those things are currently done by the Linux kernel booted by GRUB to mount an encrypted "initramfs", to get the network configuration to mount an "initramfs" over iSCSI, and for the "init" processor in the "initramfs" to attest the system state to the user. <tt>:-)</tt>.</p> <p>Isn't that <strong>totally obvious</strong>? Didn't I write <strong>very clearly</strong> that «<q>I hope that there is no dispute that the starting point of the boot process must be a simple, limited configuration "container"/"filetree" of some sort like <tt>/boot</tt> or "initramfs"</q>»<p> <p>If you dispute that, this discussion is pointless like most discussions with the members of the poetteringista tendency, because evidently the understanding of how booting works and the role of the <tt>/</tt> filesystem in UNIX/Linux systems has been completely lost.</p> Mon, 18 Jan 2016 23:14:52 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672358/ https://lwn.net/Articles/672358/ walex <p>«<q>Can you have GRUB loading its kernel, configuration file and modules from a <tt>/boot</tt> being a BTRFS filesystem on an encrypted LVM volume on top of an MD RAID1 spanning 2 DRBD volumes?</q>»</p> <p>No, but in your proposed non-GRUB, non-initramfs setup you can't use LILO to get your initial kernel from there, either, so this is an obvious red herring. Try harder.</p> <p>That objection is comically stupid, because I have proposed a setup where <tt>/usr</tt> gets mounted and the second stage kernel (if needed, and it will be rarely needed) gets booted by <em>a full (if minimal) GNU/Linux system hosted inside a first stage <tt>/</tt> root filesystem</em>, just like it has been done for decades by people who actually understand booting sequences, and that LILO in that setup is equivalent not to the GRUB kernel but to the GRUB bootloader that loads the GRUB kernel from the GRUB root filesystem which is <tt>/boot</tt>. I think that this is the <em>third time</em> that I have explained this is detail for those who ignore how booting sequences work.<p> <p>«<q>An initramfs is reasonably easy to construct and keep current and, if you're providing a Linux distribution, makes it unnecessary to use a kernel that has all sorts of drivers compiled statically to ensure wide hardware coverage</q>»</p> The proposed setup, which is the historical UNIX setup plus optional <tt>kexec</tt>, is to have a Linux kernel without needing any <q>sorts of drivers compiled statically</q> except those needed to mount the first-stage <tt>/</tt> filesystem from a local storage area, exactly as GRUB does it for <tt>boot</tt>, but unnecessarily. Having mounted <tt>/</tt> the stripped down Linux kernel can then load whichever modules and run whichever scripts may be needed to mount the <tt>/usr</tt> filesystem, or to load a new dynamically selected kernel from any storage medium whatever, with <tt>kexec</tt> and reboot into it.</p> <p>«<q>an initramfs makes it straightforward to do various things – such as network configuration in case your actual root file system is on a remote iSCSI volume, or obtaining a pass phrase for an encrypted root file system – that the kernel isn't really set up to do. How to do this in user space in an initramfs is quite well understood</q>»</p> <p>People who understand how booting sequences work understand that doing all that with a stripped down UNIX/Linux kernel and a mounted <tt>/</tt> filesystem is much easier and less fragile than packing up every time a new static "initramfs", and prompting for passwords can be done by a trivial shell script in the mounted <tt>/</tt> filesystem, and does not need to be done by the UNIX/Linux kernel, and that there is no need to snapshot the <tt>/</tt> filesystem into an "initramfs" image unless there is a totally storage-less boot situation.</p> Mon, 18 Jan 2016 23:02:55 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672356/ https://lwn.net/Articles/672356/ Cyberax <div class="FormattedComment"> Personally, I always feel that / on Unix is somehow untidy. Too many top-level directories, not enough clear separation of concerns.<br> <p> Moving most of the / into /usr definitely helps to clean it up. Of course, we'll have to use compat symlinks for the next 10 years or so, but there's at least a hope of getting them removed eventually.<br> </div> Mon, 18 Jan 2016 22:45:28 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672354/ https://lwn.net/Articles/672354/ mcortese <p>After the merge, <tt>/usr</tt> will include all and only the data provided by the distribution, with one notable exception: <tt>/usr/local</tt>. Somebody will then advocate moving it to <tt>/</tt>. Just imagine the symmetry in having a <tt>/local</tt> hierarchy that mirrors <tt>/usr</tt>: for example <tt>/local/bin</tt> would be the locally-installed equivalent of distribution-installed <tt>/usr/bin</tt>, and so on...</p> Mon, 18 Jan 2016 22:35:39 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672237/ https://lwn.net/Articles/672237/ anselm <blockquote><em>Can you have GRUB loading its kernel, configuration file and modules from a /boot being a BTRFS filesystem on an encrypted LVM volume on top of an MD RAID1 spanning 2 DRBD volumes?</em></blockquote> <p> No, but in your proposed non-GRUB, non-initramfs setup you can't use LILO to get your initial kernel from there, either, so this is an obvious red herring. Try harder. </p> <blockquote><em>What is the case for the additional complexity and fragility for having an "initramfs" that is a statically built and customized snapshot of a large subset of / and then "pivot" to a full / or in the latter-day proposal to a full /usr?</em></blockquote> <p> An initramfs is reasonably easy to construct and keep current and, if you're providing a Linux distribution, makes it unnecessary to use a kernel that has all sorts of drivers compiled statically to ensure wide hardware coverage, most of which drivers are unnecessary for any particular system (because the hardware isn't there) but can't be removed other than by compiling a new, customised kernel. (Remember that that was a situation we used to have to deal with in the early years of Linux, and now that we no longer need to, pretty much everyone is a lot happier.) This sucks especially if you're running an enterprise-class Linux distribution like RHEL or SLES where tampering with the kernel will mean your system no longer qualifies for vendor support in case of problems. </p> <p> In addition, an initramfs makes it straightforward to do various things – such as network configuration in case your actual root file system is on a remote iSCSI volume, or obtaining a pass phrase for an encrypted root file system – that the kernel isn't really set up to do. How to do this in user space in an initramfs is quite well understood, and putting the required functionality into the kernel would only add unnecessary complexity and probably bugs. </p> Mon, 18 Jan 2016 00:13:08 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672202/ https://lwn.net/Articles/672202/ raven667 <div class="FormattedComment"> <font class="QuotedText">&gt; Keep the ability to have distinct block device containers for / and /usr but merge the /bin /lib directories into the /usr hierarchy and container. Leaving in the / hierarchy only /etc, /dev, /sys, ...; the main purpose of this would be to shorten the default $PATH and $LD_LIBRARY_PATH.</font><br> <p> Its not just to shorten the $PATH, it's also so that _all_ of the system binaries, which are interdependent due to shared library and data file dependencies, are mounted at the same time in a self-consistent way with the same mount options.<br> <p> <font class="QuotedText">&gt; Leave the / and /usr hierarchies as they are with distinct /bin etc. directories because what matters is mounting a single block device.</font><br> <p> If you require all the binaries to be on the root filesystem then when having many systems with a shared binary directory it precludes the host specific variable data from being on a single filesystem (etc, var,home) , unless you add bind mounts to the mix.<br> </div> Sat, 16 Jan 2016 22:55:10 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672206/ https://lwn.net/Articles/672206/ mjg59 <div class="FormattedComment"> <font class="QuotedText">&gt; go back to booting directly an initial Linux kernel that mounts an initial / filesystem</font><br> <p> How does the kernel obtain the passphrase to decrypt an encrypted /? The network configuration to mount a / over iscsi? Interact with the TPM in order to attest system state to the user?<br> </div> Sat, 16 Jan 2016 19:49:29 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672205/ https://lwn.net/Articles/672205/ mjg59 <div class="FormattedComment"> Any solution that depends on kexec is a solution that doesn't actually work. It's amazingly unreliable on real platforms.<br> </div> Sat, 16 Jan 2016 19:44:25 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672196/ https://lwn.net/Articles/672196/ MattJD <div class="FormattedComment"> The four stages you describe come because of other limitations of the interface available to the kernel to boot more complicated systems. When BIOS was how x86 booted, GRUB was necessary to read filesystems, as no other code in the system provided that. LILO was mentioned previously, but LILO had one large fault: if you upgraded your kernel you had to rerun LILO, or everything broke (and I did that to myself several times on and older laptop). UEFI provides what GRUB required, just like u-boot provides for ARM what GRUB does on x86 (though you can use GRUB in both cases afaik). That takes one stage out. I bet GRUB is still around because UEFI systems don't provide a common user interface for choosing what to boot, while GRUB does. Distributions go UEFI-&gt;GRUB so when there is a problem they can give instructions that are more likely to work across all machines.<br> <p> Regarding initramfs and /, initramfs provides what / used to provide. Now / can require several steps before it mounts (for instance, on my laptop I need to type in my encryption passphrase). An initramfs can also provide a complete recovery shell, that relies on minimal other parts of the system to work. So what you propose already basically exists. The only difference is that you want a / that comes from a partition, whereas initramfs provides a / that comes from memory. Either way they need to be maintained, and neither provide a full system.<br> <p> So I don't think there is a large gap between what both sides of this conversation want. It's just that we haven't done the cleanup to get closer to the desired simpler boot sequence.<br> </div> Sat, 16 Jan 2016 16:34:40 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672187/ https://lwn.net/Articles/672187/ walex <p><q>different people disagree on what constitutes a "minimal, streamlined" base.</q></p> <p>Indeeed and I think that we can all agree that having a 4 stage boot process with 4 different "root" filesystems (<tt>/boot</tt>, "initramfs" snapshot, <tt>/</tt>, <tt>/usr</tt>) is too complex and fragile.<p> <p>Given that the end goal is having <tt>/usr</tt> mounted, that cannot be removed, so the alternatives are:</p> <ul> <li>Drop <tt>/</tt> and keep both <tt>/boot</tt> and the "initramfs", then mount the final <tt>/usr</tt>.</li> <li>Drop <tt>/boot</tt> and the "initramfs" and go back to booting directly an initial Linux kernel that mounts an initial <tt>/</tt> filesystem, and then if needed <tt>kexec</tt> a final kernel, and then mount by whatever means the final <tt>/usr</tt>.</li> </ul> <p>To me dropping <tt>/</tt> and keeping the far more complex and fragile <tt>/boot</tt> and "initramfs" stages seems solving the wrong problem at best.</p> Sat, 16 Jan 2016 14:32:16 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672185/ https://lwn.net/Articles/672185/ walex <p><q>The reason why Unix systems in former times managed to get away with a much simpler boot structure</q></p> <p>That's a crazy starting point, because the assumed goal here is to cover a complex boot <em>configuration</em>, not to have a complex boot <em>structure</em> for its own sake. Complex <em>structures</em> don't bring any benefit in themselves, except the pride of a job poorly done <tt>:-)</tt>.<p> <p>There is no need to assume the that a complex boot configuration requires a complex, fragile, boot structure with 4 stages instead of a simple structure like "boot a stage one Linux kernel and <tt>/</tt> and then use that to do stage two of the boot process using the full power of a Linux system to boot a bigger kernel and mount a <tt>/usr</tt> filesystem". <p><q>is that the range of supported disk controller hardware, file systems, etc. was a lot smaller, and therefore it was reasonable for manufacturers to distribute kernels that had everything needed to get at “/” statically built into them.</q></p> <p>But GRUB in order to mount <tt>/boot</tt> makes very strong and limiting assumptions about the range of possibilities it can cope with. Can you have GRUB loading its kernel, configuration file and modules from a <tt>/boot</tt> being a BTRFS filesystem on an encrypted LVM volume on top of an MD RAID1 spanning 2 DRBD volumes? If not, why are GNU/Linux users being so limited to the range of drivers statically built into the distributed GRUB kernel? <tt>:-)</tt></p> <p>What is the case for the additional complexity and fragility of having GRUB + <tt>/boot</tt> replicating in complex yet limiting way a large part of the functionality of the Linux kernel and of <tt>/</tt>?</p> <p>What is the case for the additional complexity and fragility for having an "initramfs" that is a statically built and customized snapshot of a large subset of <tt>/</tt> and then "pivot" to a full <tt>/</tt> or in the latter-day proposal to a full <tt>/usr</tt>?</p> Sat, 16 Jan 2016 14:09:39 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672175/ https://lwn.net/Articles/672175/ anselm <p> The fallacy here is in assuming that because something worked in the 1980s it must work today and indefinitely into the future. (We see this a lot in people who question the need for something like systemd by claiming that System-V init is the solution to all problems because, you know, it runs shell scripts.) </p> <p> GRUB is the way it is because it supports a wide variety of use cases apart from simply booting a Linux kernel. Distributions like it because it covers pretty much all deployment scenarios one is likely to run into in Real Life™, and it is usually easier to maintain a single solution that does everything you need than a variety of specific solutions that are all designed to optimise a step in a system's life cycle that happens fairly rarely in the first place. (Most people don't boot their system several times per hour.) As we've mentioned, it is perfectly possible to get rid of GRUB on a UEFI-based system, because the UEFI boot loader can boot a Linux kernel directly, so this makes your “first-stage boot” that much simpler already. Mainstream Linux distributions, however, can't rely on everybody having UEFI, which is why they still use GRUB because that works everywhere. </p> <p> The reason why Unix systems in former times managed to get away with a much simpler boot structure is that the range of supported disk controller hardware, file systems, etc. was a lot smaller, and therefore it was reasonable for manufacturers to distribute kernels that had everything needed to get at “/” statically built into them. (As a matter of fact, traditional Unix kernels often didn't support the idea of loadable modules in the first place.) On contemporary Linux, there is no practical way of getting rid of “initramfs” that reliably supports things like encryption, RAID, or diskless systems and does not present a maintenance nightmare compared to which initramfs is really the simpler and more versatile solution. You end up trying to build distribution kernels that have everything in them statically on the off-chance (including stuff like a DHCP client that is better left to user space), and generally distributions are very happy to be past that, and to be able to use initramfs to offer modular, maintainable kernels. This means that you're unlikely to find anyone who actually deals with that sort of thing in actual practice who will agree with you that essentially going back to “pre-hipster” Linux is anything remotely like a good idea. In any case, the approach is fairly well-understood and rarely causes problems, so this is really a tempest in a teacup. </p> Sat, 16 Jan 2016 09:45:13 +0000 Preparing for a merged /usr in Debian https://lwn.net/Articles/672177/ https://lwn.net/Articles/672177/ walex <p><q>shoving the contents of /{s,}bin and /lib into /usr will, somewhat paradoxically, *decrease* the need for an initramfs:</q></p> <p>This and other comments make me suspect that a lot of the discussion above is based on some big misunderstanding of the situation, and possible changes, and in part because the article above seems a bit confusing to me, and I'll try to clarify:</p> <ul> <li>A "filesystem" is a tree of directories and files which is stored in its entirety in a container which is as a rule a "block device" (there are special cases but let's skip them).</li> <li>A "hierarchy" in UNIX is a tree of directories and files that have a conventional organization, for example one where at the top there are <tt>/bin</tt>, <tt>/etc</tt>, <tt>include</tt>, <tt>lib</tt>, <tt>doc</tt>, <tt>/src</tt> etc. subtrees, because the UNIX convention is to store files by type.</li> <li>Traditional UNIX had first one hierarchy under <tt>/</tt>, then a second one was added under <tt>/usr</tt>, and then a third one was added under <tt>/usr/local</tt>; the hierarchies were nested inside each other instead of being mounted alongside each other, as for example <tt>/core</tt>, <tt>/usr</tt>, <tt>/local</tt>.</li> <li>Eventually differently-shaped sub-hierarchies were added under <tt>/var</tt>, and at different points in time under <tt>/usr/X11</tt>, <tt>/usr/net</tt> etc.</li> <li>Traditionally the <tt>/</tt> and <tt>/usr</tt> hierarchy were independent filesystems, where the <tt>/</tt> hierarchy contained the core tools needed to get to the "block device" containing the <tt>/usr</tt> hierarchy and mount it.</li> </ul> <p>Now nearly all existing distributions still support having distinct block device containers for the <tt>/</tt> and <tt>/usr</tt> (and <tt>/usr/local</tt> and <tt>/var</tt>) hierarchies, even if some in that case mount <tt>/</tt> and <tt>/usr</tt> at the same time, which requires all the GRUB and Linux drivers needed to mount both <tt>/</tt> and <tt>/usr</tt> to be present in both GRUB's root filesystem <tt>/boot</tt> and in the Linux first-stage root filesystem the "initramfs".</p> <p>The "merged-<tt>usr</tt>" proposal can be interpreted in different ways:</p> <ul> <li>Keep the ability to have distinct block device containers for <tt>/</tt> and <tt>/usr</tt> but merge the <tt>/bin</tt> <tt>/lib</tt> directories into the <tt>/usr</tt> hierarchy <em>and container</em>. Leaving in the <tt>/</tt> hierarchy only <tt>/etc</tt>, <tt>/dev</tt>, <tt>/sys</tt>, ...; the main purpose of this would be to shorten the default <tt>$PATH</tt> and <tt>$LD_LIBRARY_PATH</tt>.</li> <li>Remove the ability to have distinct block device containers for <tt>/</tt> and <tt>/usr</tt> enforcing the assumption that whichever root block device is mounted at boot time contains both the <tt>/</tt> and <tt>/usr</tt> hierarchies. This can come in two flavours: <ul> <li>Leave the <tt>/</tt> and <tt>/usr</tt> hierarchies as they are with distinct <tt>/bin</tt> etc. directories because what matters is mounting a single block device.</li> <li>Also merge the <tt>/bin</tt> <tt>/lib</tt> etc. directories into the <tt>/usr</tt> hierarchy because if they enforced to be in the same container this is an opportunity to reduce the length of the default paths.</li> </ul> </li> </ul> Sat, 16 Jan 2016 09:27:46 +0000