Seeking the endgame for Debian's /usr merge
At its core, the /usr merge is the project to move files out of root-level directories like /bin and /lib into the equivalent directories under /usr. Most distributors took a "rip the bandage off quickly" approach to this change, causing it to simply happen over the course of a single major-version upgrade. It was an abrupt change and not without problems but, for the most part, distributors got through it quickly.
Debian has taken a slower approach, spreading the transition over a few releases. If one looks closely at a fresh Debian install, either the current Debian 11 ("bullseye") or the upcoming "bookworm" release, one will see that directories like /bin and /lib exist only as symbolic links into their equivalent directories under /usr. It would seem that the merge process is complete.
There are some rough edges, though. If one looks into the packages installed on even a bookworm release, one will see that many of them are still installing into the top-level /bin and /lib directories. If the release is called anything but "Debian" (if it is a derivative distribution, for example), the dpkg package manager will emit a scary warning about how the system is broken. And, if one looks at the project's mailing lists, one will find ongoing discussions about the remaining problems with the transition, along with comments like this one from Bdale Garbee, who has in the past served as both Debian project leader and Technical Committee chair:
Merged-/usr seems to me to have brought great pain with no discernible benefit to Debian so far, and I at least have completely lost the thread on what the point of doing it was supposed to be.
All of this reflects a couple of fundamental problems that the project has not, as yet, figured out how to resolve.
dpkg and aliases
One of these problems is that much of this transition has been effected outside of dpkg, with the result that the Debian package manager lacks a complete understanding of how the system is structured. Specifically, the use of symbolic links to replace the top-level directories creates "aliases" — multiple paths to files — that dpkg does not properly understand. As a result, there is a scenario — involving renaming a file within a package, then moving that file to a different package — that can cause dpkg to delete files belonging to an installed package, thus corrupting the system when those packages are installed.
Problems like this are the inspiration behind the warning that dpkg prints on merged-/usr systems. The specific failure mode may seem obscure, but it is aggravated by a couple of factors. The first of those is that the end game for this whole transition involves moving files into their expected locations; rather than installing bash into /bin, the package would be changed to put it into /usr/bin instead. That is a lot of file moves; add to that the fact that moving files between packages is reasonably common in Debian, and the chances of steering users into this bug look fairly high.
Corrupted systems after an upgrade is just not part of the image that the Debian project has for itself, so this bug is a significant problem. It is the reason why the project has maintained a moratorium on the movement of files to their new locations under /usr — a moratorium that was recently renewed by the Technical Committee.
It is not uncommon to see project members blaming dpkg maintainer Guillem Jover for this problem. Jover has not hidden his disdain for how the transition has been handled, and is seen by many as preferring the addition of scary warnings over actually addressing the problem. But a careful reading of the lists can yield a more nuanced view. An attempt to have the Technical Committee force the complete removal of the warning from dpkg (for derivatives as well as for Debian itself) has not gone anywhere, and a number of developers feel that the substance (if not the wording) of the warning is appropriate. As Helmut Grohne put it:
The present discussion clearly shows that dpkg's support for how Debian deals with merged /usr is lacking. We are dealing with multiple file-loss scenarios (something we otherwise consider grave) and issuing a warning about such behaviour seems fine to me.
Meanwhile, developers continue to seek a way to fix this problem. Grohne
recently posted an extended
proposal on how dpkg could gain some new options to inform it
of the existence of directories. There has been a variety of
responses. Luca Boccassi said
that he intended to simply force-move everything after the bookworm
release, ending the aliasing as seen by dpkg and thus avoiding the
problem; "That should bring the matter to an end, without needing to
modify dpkg
". Simon McVittie, though, worried
that this sort of move was particularly likely to trigger the lost-file bug
rather than avoid it. Grohne tried to
adapt Boccassi's plan to avoid a number of problems that he found, but
eventually decided
that his approach, too, had too many problems. "The amount of
complexity we are piling up here becomes non-trivial
".
Jover, meanwhile, responded
to the proposal while avoiding the main development list; he described it
as "conceptually wrong
" and provided his reasoning in detail. Among
other things, informing dpkg of these links using separate
commands adds a "source of truth
" about the installed system that is
not found in any of the packages installed there. Jover did put some
effort, in that response, into thinking about how the situation might be
improved, but did not contribute thereafter.
The end result of all this is that the problems with dpkg remain, with more likely to be discovered, and there is still no clear picture of how they will be addressed. Until that issue is resolved, this transition will continue to loom over the Debian project.
Bootstrapping and interpreters
Most readers will be familiar with the "shebang" lines at the beginning of scripts that specify which interpreter a script should be fed to:
#!/bin/sh
It may be a bit more surprising to learn that natively compiled programs also specify an interpreter — specifically, the program that will load the executable into memory, link in dynamic libraries, and prepare it to run. This interpreter is stashed into the ELF program header as the PT_INTERP variable, and will normally be set to: /lib64/ld-linux-x86-64.so.2 on 64-bit Linux systems.
Regardless of whether one is trying to run a script or a compiled binary, little joy will result if the specified interpreter cannot be found. This creates a bit of a problem given that, in a merged-/usr system, these interpreters should be moved into /usr/bin and /usr/lib64, turning all of those interpreter strings into dangling references. Most of the time, the symbolic links added to the root directory paper over this problem, everything works, and nobody notices. But there is an exception.
The creation of a new root disk image containing a Debian installation is done with a bootstrap tool, usually either debootstrap or mmdebstrap. The bootstrap tools install the "essential set" of packages that every Debian system needs, then run their configuration scripts (in a chroot setting) to set up a basic, functioning installation. If, however, the packages in that essential set are changed to install their files under /usr, the programs needed to finish the setup will not find their interpreters and the installation will fail; that tends to lead to another round of calls to give up on this transition entirely.
In theory, all that one needs to do is to ensure that the appropriate
symbolic links are in place early in the bootstrap process. In practice,
it is far from so simple; among other things, the presence of those links
can, once again, confuse dpkg. At one point, Boccassi suggested
that Debian could be built with a modified PT_INTERP value and
changed shebang lines to sidestep the problem, but that led to a flurry of
complaints about breaking the Linux ABI, breaking compatibility with older
Debian releases, and losing the ability to compile
programs that would run on different distributions. As Russ Allbery put it:
"breaking the ABI is a Really Big Deal
". So that idea did not get
far.
Grohne took the time to put together a detailed look at the problem that should be required reading for anybody who is interested in the bootstrapping challenges. He outlined four different ways in which bootstrapping could be fixed and discussed the difficulties with each. His recommendation is to leave a handful of files in their old location for now while, in the long term, changing the way bootstrapping works to ensure that the requisite symbolic links are present from the beginning, and that they do not complicate the installation thereafter.
Now what?
As of this writing, neither problem has a definitive solution identified for it. A combination of avoiding file moves and keeping the interpreters at their old locations may be enough to get the bookworm release out the door successfully, but leaves a number of problems in place. The transition cannot be said, by any stretch, to be complete.
Some of the participants in the discussion evidently feel that the remaining problems are easily solved and that this transition is essentially done. Others clearly worry that, not only are the problems difficult, but that problems are still being discovered and that there are more to come. The latter view seems likely to be the more accurate one. As Technical Committee chair Sean Whitten said:
I am far from being an expert on the details of merged-/usr. But one thing I've noticed is that among the people who have spent the most time looking into it, the majority think that simple fixes are not going to be sufficient. Only a few people who have spent a lot of time on it still think that the fixes that are required are relatively simple ones.
LWN last looked at this transition just over one year ago; at that time, many of those involved were describing it as a social failure, and possibly a technical failure as well. Since then, progress has been made, and many Debian users are running on systems that are, for all practical purposes, fully merged. But the technical and social challenges remain as intransigent as ever.
Former Technical Committee member Gunnar Wolf described the
/usr merge as "the point we most came back to
" during his
time there. Perhaps a new spirit of cooperation and new technical insights
will bring this episode to a close during the upcoming "trixie" development
cycle. But it also seems plausible that the Technical Committee will find
itself hearing arguments about the /usr merge for a while yet; the
Debian community may well have more opportunities to wonder whether it
would have been better to just rip the bandage off and be done with it
years ago.
Posted Jun 1, 2023 20:28 UTC (Thu)
by sagi (subscriber, #64671)
[Link] (10 responses)
One question that arose while reading the article relates to the ripping the bandage metafor. What did other distros do with respect to the interpreter issue? Perhaps this show my limited understanding of the fundamental issue, but is binary portability as a relevant consideration is unique to Debian?
Posted Jun 1, 2023 20:45 UTC (Thu)
by jengelh (guest, #33263)
[Link] (1 responses)
>What did other distros do with respect to the interpreter issue?
Just make the symlinks part of the essential file set that gets placed into the (ch)root directory before *any* configuration scripts are run.
Posted Jun 1, 2023 21:12 UTC (Thu)
by bluca (subscriber, #118303)
[Link]
'Ripping the bandaid' means doing a distro-wide change to canonicalize the _content_ of every package as well. Because of how Debian maintenance works, there was a non-trivial chance that even one or two people getting in the way would have been enough to derail the whole effort and delay everything for another release, so I did not want to risk going down that route. This way, the change is done from users and external developers point of view, and they largely don't have to care anymore, delta a couple of minor things to keep in mind if they ship third-party packages with files in the root directories (which they should not in the first place).
What's left to do is the internal clean up, which is annoying mostly for Debian Developers, but hey, if we create problems for ourselves then we got to solve them too.
So from roundabout next week, if you are an upstream developer, you can safely rip out any support for the legacy filesystem layout, and it won't have any effect on any of the major distributions.
Posted Jun 1, 2023 22:32 UTC (Thu)
by rgmoore (✭ supporter ✭, #75)
[Link]
I think one of the things Fedora does to help with this kind of thing is to boot into a dedicated system any time they're doing an upgrade. They recommend this any time you're updating system packages, but definitely when you're upgrading between releases. Everything they need is in an initramfs, so they can boot into that and then make any changes they need to the system without having to worry about the programs changing under them. They also version all the packages with the distribution, so they can force an update of all the packages when you upgrade to the new version of the distribution, even if the only change is that the RPM database thinks the file is in /usr/lib rather than /lib (which is a symlink to /usr/lib).
Posted Jun 2, 2023 3:32 UTC (Fri)
by flussence (guest, #85566)
[Link] (1 responses)
I believe (haven't actually done it on any of my systems) that Gentoo's usrmerge is only a shuffling around of file paths and added compatibility symlinks. The work to support it is considered done, but there are more things in the core system package set without explicit usrmerge handling than with, and notably none of the toolchain (gcc, glibc, binutils, bash, kernel headers) do anything special with it.
Posted Jun 2, 2023 10:45 UTC (Fri)
by Wol (subscriber, #4433)
[Link]
A *single* /usr location for everything that gets scattered all over several /.../usr in old systems, and then a bunch of symlinks so that everything that looks in the old locations doesn't get a nasty surprise to discover what it's looking for has disappeared.
Iirc it's already happened - by default - on all gentoo systemd machines (like my two).
Cheers,
Posted Jun 2, 2023 14:23 UTC (Fri)
by atnot (subscriber, #124910)
[Link] (4 responses)
> In Debian, packages are nudged in the right direction by a document called the Debian Policy, or its programmatic embodiment, lintian.
https://michael.stapelberg.ch/posts/2019-03-10-debian-win...
Posted Jun 2, 2023 18:06 UTC (Fri)
by ema (subscriber, #17750)
[Link] (3 responses)
Usually, the way things look like “at work” is that someone above decides what has to be done, and those below make it happen. Perhaps one of the best things about Debian is that it does not work like that.
Posted Jun 3, 2023 3:37 UTC (Sat)
by NYKevin (subscriber, #129325)
[Link] (1 responses)
More complicated changes are sometimes made in a top-down fashion, but this tends to be much slower and less efficient, and is usually only done for things that require a lot of subject-matter expertise and individualized judgment (often to the point where each individual team will be writing a separate design document about their transition process and all the weird pain points they ran into). There is also a degree of managerial discretion in terms of exactly who works on which projects, and in what order, so these mandates may not always be the top priority.
Posted Jun 5, 2023 6:41 UTC (Mon)
by patrakov (subscriber, #97174)
[Link]
Posted Jun 4, 2023 0:44 UTC (Sun)
by rjones (subscriber, #159862)
[Link]
In businesses, in a sane situation (which not all situations are sane), the goal is to serve their customers. The customers have what the business wants and to get it they need to convince the customer that it's worth it to give it to them. So they try to identify the needs of customers, which is not a easy task. Once they have some needs identified then they need to figure out what it is worth to the customers... how much customers are willing to spend on fulfilling that need. Which is even harder. It's nearly impossible to get that right every time. Lots of products fail because of this.
Once the business leaders have those things sussed out as well as possible then it is up to the engineers to try to make it a reality. They have to figure out a solution that costs low enough to be profitable. Not just in terms of money or capital investment, but in terms of time. Sometimes it's not realistic and sometimes it is. But that is how "in service of a customer" should work in most situations. Profit/loss is how you determine how good of a job you are doing.
In the case of The Debian Project their "customer" is The Debian Project. People join and work on the project for the sake of the project and themselves. The cost is mostly individual/personal investment of time and effort into the project. And profit is determined by how much individual/personal benefit/fulfillment they derive from the project. What second and third parties derive from the project is almost incidental in comparison to what the maintainers get out of it.
Since the costs and profits are so "squishy" in nature.. it makes proper accounting mostly impossible. So it is very difficult to figure out how well the project is doing at serving itself. It makes for a tight balancing act between how much the project needs to keep people happy versus how much work they impose on other people in the project all the while fulfilling the technical requirements.
It is a difficult thing to get right. And it is a testimony to the governance model of Debian that they get it close enough to being right to survive so long. It is quite remarkable.
Posted Jun 1, 2023 21:12 UTC (Thu)
by vstinner (subscriber, #42675)
[Link] (14 responses)
Fedora build system also uses a minimum base image. How is it different from Debian?
Fedora 17 change: https://fedoraproject.org/wiki/Features/UsrMove
> the use of symbolic links to replace the top-level directories creates "aliases" — multiple paths to files — that dpkg does not properly understand
It's unclear to me why dpkg cannot be fixed to handle /bin and /lib symlinks.
My feeling is that the social challenge in Debian is harder than in Fedora which is more driven by technical changes (good or bad, Wayland, Pulse Audio, Pipe Wire, systemd, merged /usr, etc.), rather than attempting to get a perfect consensus and please everybody. I already saw that with the debate about systemd and other init systems in Debian. The project wants everybody to feel welcome and provide them a way to have their bikeshedding color, even if it's expensive to support more than one color.
Posted Jun 1, 2023 23:18 UTC (Thu)
by geofft (subscriber, #59789)
[Link] (2 responses)
Debian tends to wait until something is clearly a good idea before going for it. Fedora, on the other hand, has a motto of four foundations, "Freedom, Friends, Features, and First." Both are defensible perspectives. (But I will say I'm happy that the thousands of machines I sysadmin at my day job are Debian, not Fedora!)
Posted Jun 2, 2023 12:03 UTC (Fri)
by rahulsundaram (subscriber, #21946)
[Link] (1 responses)
I am not sure what unilaterally means here. Changes like these go through the change proposal process as outlined in https://docs.fedoraproject.org/en-US/program_management/c... and that has to be voted by the Fedora engineering steering committee, an elected body.
Posted Jun 2, 2023 15:05 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
Posted Jun 2, 2023 17:18 UTC (Fri)
by amck (subscriber, #7270)
[Link] (10 responses)
Debian places a great value on continuous upgrades. IIRC other distros have done it by requiring a full fresh install. A lot of the technical issues Debian sees is because of changes while upgrading , especially breaking the resolver in apt,etc:
Posted Jun 2, 2023 18:09 UTC (Fri)
by zdzichu (subscriber, #17118)
[Link] (3 responses)
Posted Jun 2, 2023 18:16 UTC (Fri)
by james (subscriber, #1325)
[Link] (2 responses)
"Skipping two versions" would be (e.g.) starting on 35, skipping 36 and 37, and going directly to 38.
Posted Jun 2, 2023 21:50 UTC (Fri)
by bartoc (guest, #124262)
[Link]
In practice I find fedora upgrades even beyond the "supported versions" tend to go pretty smoothly, hell I've even successfully _downgraded_ fedora before, although this usually requires some "screwing around" and removal of packages.
Posted Jun 10, 2023 20:57 UTC (Sat)
by DemiMarie (subscriber, #164188)
[Link]
Posted Jun 2, 2023 19:39 UTC (Fri)
by mbunkus (subscriber, #87248)
[Link] (2 responses)
That being said, I'm not a Debian developer & don't remember the exact wording, so take what I wrote with a grain of salt.
Posted Jun 2, 2023 22:13 UTC (Fri)
by vstinner (subscriber, #42675)
[Link] (1 responses)
In Fedora, "dnf system-upgrade" is the command line too for that. I suppose that GNOME Software runs it internally for a system upgrade.
Posted Jun 4, 2023 7:21 UTC (Sun)
by pabs (subscriber, #43278)
[Link]
https://wiki.debian.org/DebianUpgrade
Posted Jun 18, 2023 18:55 UTC (Sun)
by birdie (guest, #114905)
[Link] (2 responses)
I've been upgrading Fedora continuously for almost two decades on one of my PCs.
I'm sorry but your assertion at least for Fedora/RHEL is patently false.
I'm quite sure you can upgrade RHEL 2.1 up to 9.0 without any issues as well.
Posted Jun 18, 2023 22:41 UTC (Sun)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
Posted Jun 19, 2023 11:33 UTC (Mon)
by farnz (subscriber, #17727)
[Link]
That's roughly the same level of support as you get from Debian, though - because you'll get the same response from the Debian volunteers, too (as they don't have unlimited time to spend fixing your systems for you).
Posted Jun 2, 2023 7:56 UTC (Fri)
by ema (subscriber, #17750)
[Link] (13 responses)
Posted Jun 2, 2023 10:07 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (2 responses)
Posted Jun 2, 2023 15:24 UTC (Fri)
by ballombe (subscriber, #9523)
[Link] (1 responses)
Posted Jun 2, 2023 23:05 UTC (Fri)
by bluca (subscriber, #118303)
[Link]
Posted Jun 2, 2023 10:20 UTC (Fri)
by corbet (editor, #1)
[Link] (9 responses)
Posted Jun 2, 2023 22:29 UTC (Fri)
by ballombe (subscriber, #9523)
[Link] (8 responses)
Posted Jun 2, 2023 23:20 UTC (Fri)
by pebolle (guest, #35204)
[Link] (6 responses)
All distributions decided that "/usr merge" should be done, even Debian. What this article is about is that Debian is being Debian so it discusses how that should be done for about a decade.
(It sometimes feels there's a tendency among the LWN readers to think they're more rational than people not into software. "MBAs", lawyers, "beancounters", politicians, whatever. They're too dumb to understand software. Ha, ha!
Guess what. The fact that LWN is still reporting on this /usr nonsense indicates that people writing software are prone to make the same mistakes that those that do not write software make. We're all the same! Or worse, perhaps the hubris of software developers makes them more likely to make mistakes.)
Posted Jun 5, 2023 22:10 UTC (Mon)
by jccleaver (guest, #127418)
[Link] (5 responses)
Few if any distributions decided that "'/usr merge' should be done;" they decided to stop fighting Lennart and the systemd "cabal" and relented. Big difference.
Posted Jun 11, 2023 11:07 UTC (Sun)
by anselm (subscriber, #2796)
[Link] (4 responses)
The main observation here is that once you've done the /usr merge, there are various advantages that result from this, but the main argument against it seems to be “it's not what we're used to, and we don't like it”. (Now where have we heard that before?) It's also not really a systemd thing; systemd doesn't care whether a system has been /usr-merged or not.
Why should the structure of today's systems be beholden to the fact that 50 years ago some guys couldn't fit all of their software on one hard disk?
Posted Jun 18, 2023 18:55 UTC (Sun)
by birdie (guest, #114905)
[Link] (3 responses)
Exactly.
I wonder what benefits the original divided system had. I cannot think of any. Yeah, 30 year ago or so /usr was too big and /bin /lib /sbin were necessary to boot the system. We've long migrated to initrd which made this division redundant. Modern disk are crazy spacious, so again this division is redundant.
Posted Jun 19, 2023 9:25 UTC (Mon)
by geert (subscriber, #98403)
[Link] (1 responses)
Posted Jun 19, 2023 12:57 UTC (Mon)
by anselm (subscriber, #2796)
[Link]
Yes, but all of these also apply to a post-/usr-merge system.
The root/usr split is an accident of history that is now finally getting fixed for good (in Debian GNU/Linux, anyway – as with. e.g., the init system, most other Unix-like systems including many other Linux distributions have addressed this ages ago). There's really no more to be said other than let's get it over with already.
Posted Jun 19, 2023 13:45 UTC (Mon)
by farnz (subscriber, #17727)
[Link]
Having the root directory be completely ephemeral (could be a tmpfs set up by the initramfs) is useful, because it makes it trivial to do quite major surgery on your installation.
If you have the virtual filesystems (/proc, /dev, /sys etc), a /tmp for "temporary files, may be deleted any time", a /system (could be named /usr) for the installed system, and a /user-data (could be named /home) for user data, you now have some nice properties. First, you can unmount the user data at any time, in order to protect it somewhat from mistakes. Second, you can do things like take a snapshot of the current system area, do major surgery (e.g. try to convert in place from x86-32 to x86-64), and just roll back cleanly if your major surgery goes wrong. Thirdly, you now don't treat any partition specially in a rescue situation - because / is an ephemeral tmpfs, you just create one, mount in all the FSes, and now you have your rescue layout to examine.
With 20/20 hindsight, putting things directly on the root FS was a bad decision. But it's often better to make a bad decision and get something working than to never get anything to run at all for fear of making a mistake.
Posted Jun 3, 2023 5:53 UTC (Sat)
by vasvir (subscriber, #92389)
[Link]
Path portability is not a cosmetic change and I have been bitten many time by it.
The second one to have the system under or directory /usr is tidier than the alternative. Everything can be done both ways albeit with minor difficulties. The question is if we never clean our home at which point it becomes intolerable? Maybe we get used to its quirks and its little foot guns here and there and even somebody depends on it xkcd style. But is this reason to never clean up? What are newcomers supposed to feel when everything feels so crufty and overloaded with history?
I understand that I am not the one that does the cleaning and tide up so my opinion doesn't carry any value here.
Posted Jun 2, 2023 10:23 UTC (Fri)
by KaiRo (subscriber, #1987)
[Link] (5 responses)
Posted Jun 2, 2023 11:12 UTC (Fri)
by bluca (subscriber, #118303)
[Link] (4 responses)
Posted Jun 2, 2023 13:02 UTC (Fri)
by dh (subscriber, #153)
[Link] (3 responses)
---
I was surprised myself when I discovered that some days ago - and totally unrelated to this discussion here.
Ciao, Dirk
Posted Jun 2, 2023 15:17 UTC (Fri)
by mbunkus (subscriber, #87248)
[Link] (2 responses)
/bin/sh → /usr/bin/sh
etc.
This was discussed as an alternative to symlinking _the directories_ (/bin → /usr/bin, /lib → /usr/lib etc).
Pretty much all distros that have actually gone the "symlink the directories" way; SuSE attempted "symlink entries inside the directories" but rolled that back as bluca said due to massive problems with that approach.
Posted Jun 6, 2023 12:50 UTC (Tue)
by KaiRo (subscriber, #1987)
[Link] (1 responses)
Posted Jun 6, 2023 14:18 UTC (Tue)
by bluca (subscriber, #118303)
[Link]
Posted Jun 2, 2023 11:21 UTC (Fri)
by timon (subscriber, #152974)
[Link] (15 responses)
AFAIU, the distinction between bin and sbin seems similarly fuzzy as the distinction between root-level and usr-level stuff, and is mainly kept for historical reasons. Every now and then, I search for discussion of this issue, but I'm not able to find much about it.
Posted Jun 2, 2023 11:55 UTC (Fri)
by Sesse (subscriber, #53779)
[Link] (3 responses)
Posted Jun 2, 2023 12:48 UTC (Fri)
by timon (subscriber, #152974)
[Link]
> this sounds potentially even more painful than merging /usr
When tinkering with a merged bin, the most annoying thing are duplicate names because of symlinks from bin to sbin and vice versa, e. g. sbin/ip links to bin/ip on my Debian machine, and both bin/lsmod and sbin/lsmod link to bin/kmod.
After resolving those by hand, I am able to rmdir /usr/sbin and symlink that to bin, without breaking anything. Of course, regular system updates may then break stuff in the same way as described in the article, and additionally by way of those duplicate entries overwriting each other.
Posted Jun 2, 2023 15:23 UTC (Fri)
by mbunkus (subscriber, #87248)
[Link] (1 responses)
Posted Jun 2, 2023 21:11 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
Posted Jun 2, 2023 14:02 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (8 responses)
The historic issue USED to be very important, as in "you can't recover a crashed system" important. Maybe even "the system won't boot without it" important. The "s" stands for "static".
Dynamic linking was a user-space thing, all system utilities had to be statically linked, and also had to live on the root partition. If "mount" relied on shared libraries that were stored in /lib on a separate partition, you have a problem ...
Actually, you probably could still justify /sbin, in that you need the contents in your initramfs, and you don't won't to load all of /bin in there! Is busybox the new sbin?
Cheers,
Posted Jun 2, 2023 15:29 UTC (Fri)
by intelfx (subscriber, #130118)
[Link] (7 responses)
I don't understand this. How is `mount` not "a user-space thing"? All utilities, system or otherwise, are user-space by definition.
Posted Jun 2, 2023 16:43 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (2 responses)
Mount is in the latter, but not the former. If either mount itself, or parts of mount as in dynamic libraries, are not on the root partition, then the system will not boot to a usable state.
Maybe I should have said single/multi user instead - the point is that - historically - the contents of /sbin were those system utilities needed to get the system into a usable state. And given that /bin might well be on a different partition of its own, you could not rely on anything in /bin being present in an emergency.
Cheers,
Posted Jun 2, 2023 16:46 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (1 responses)
/sbin is "not user space".
Cheers,
Posted Jun 15, 2023 19:01 UTC (Thu)
by fest3er (guest, #60379)
[Link]
Posted Jun 2, 2023 16:54 UTC (Fri)
by pwfxq (subscriber, #84695)
[Link] (3 responses)
Added to this, we didn't have boot ramdisks or fancy bootloaders: Your boot loader pointed to the disc partition where the kernel was[1]. So mount needed to be static and on the same filesystem/partition as the kernel.
[1] Is my memory misleading me, or did some boot loaders require the kernel to be the first directory entry on the root filesystem?
Posted Jun 2, 2023 19:43 UTC (Fri)
by intelfx (subscriber, #130118)
[Link] (2 responses)
Posted Jun 2, 2023 22:58 UTC (Fri)
by Wol (subscriber, #4433)
[Link] (1 responses)
Cheers,
Posted Jun 3, 2023 11:34 UTC (Sat)
by geert (subscriber, #98403)
[Link]
Posted Jun 2, 2023 17:27 UTC (Fri)
by farnz (subscriber, #17727)
[Link]
The historic distinction is that sbin only contained statically linked executables, which the kernel knows how to load and run without help, while bin was permitted to contain dynamically linked executables, which need (at least) the dynamic linker in /lib to assist the kernel loading and running the binary, and could further depend on libraries in /lib or /usr/lib.
Worse, it is possible to erroneously build a dynamically linked binary to go in /bin which depends on a library in /usr/lib. If you do this to a critical utility, like mount (needed to mount /usr so that you can get at /usr/lib), you've created a system that cannot boot.
Hence sbin, which in theory only contains statically linked executables; if this was followed as originally designed, then you could use the contents of /sbin to get access to /usr/sbin, and the combined contents of /sbin and /usr/sbin to recover from almost any disaster, even the accidental deletion of /lib.
Posted Jun 8, 2023 8:00 UTC (Thu)
by mezcalero (subscriber, #45103)
[Link]
But yeah, if Fedora would decide to merge the two I'd absolutely support that.
(Traditionally there were some ill-designed tools that installed into both dirs, and exposed different behaviour in the two dirs. Not sure how much that still matters)
Lennart
Posted Jun 2, 2023 18:02 UTC (Fri)
by rsidd (subscriber, #2582)
[Link]
I was introduced to Linux, and the BSDs, in the 1990s as a grad student. I always wondered why the system directory is called /usr and Landley explains why. As I recall, even at that time FreeBSD was paranoid about a system being bootable when /usr was not available, hence the separation, even though 99.999% of the time /usr would be a separate partition on the same disk as / and not a separate disk.
Posted Jun 2, 2023 20:45 UTC (Fri)
by ejr (subscriber, #51652)
[Link] (18 responses)
Posted Jun 2, 2023 20:47 UTC (Fri)
by mb (subscriber, #50428)
[Link] (2 responses)
Posted Jun 2, 2023 22:03 UTC (Fri)
by ejr (subscriber, #51652)
[Link] (1 responses)
Ye olde point to a separate /usr involved remote mounting. If that no longer is considered a useful case, then a simple bind mount should (hypothesizing) just make things work.
I have used systems where /usr was over the network, and having /bin was useful. That was more than 30 years ago. Storage sizes have changed somewhat. People are much slower to change.
Posted Jun 2, 2023 23:13 UTC (Fri)
by rra (subscriber, #99804)
[Link]
Posted Jun 2, 2023 21:57 UTC (Fri)
by mbunkus (subscriber, #87248)
[Link]
Additionally there are probably issues with containerization, chroots, privileges and whatnot.
Also I would really hate having to use rescue CDs with such a bind-mount-based setup; we already have to mount so many things from it before being able to chroot into it & reinstall grub (activate logical volumes; mount the root itself, /boot if on a separate FS, /boot/efi if UEFI, /dev, /proc, /run…).
Posted Jun 2, 2023 21:59 UTC (Fri)
by rra (subscriber, #99804)
[Link] (13 responses)
Posted Jun 2, 2023 22:12 UTC (Fri)
by pebolle (guest, #35204)
[Link] (12 responses)
This I don't get.
rpm packages declare which files they want to drop where. The rpm tool drops those files at those locations and updates its database. Any difference between what rpm registers and what is actually happening would be a severe bug.
Doesn't dpkg work like that?
Posted Jun 2, 2023 22:36 UTC (Fri)
by p2mate (guest, #51563)
[Link]
Posted Jun 2, 2023 22:46 UTC (Fri)
by rra (subscriber, #99804)
[Link] (10 responses)
1. Package A contains files in /bin or /lib
User upgrades package A to a step 3 package B.
dpkg knows nothing about /bin and /usr/bin being the same thing. So it installs package B, which puts files in /usr/bin and /usr/lib (which happen to also be /bin and /lib but it doesn't know that). Then it deletes the old, obsolete files from package A, which package B replaced. But the files in package A are the same as the files in package B, through a symlink, so dpkg has just deleted the files that were moved from A to B and then from /bin and /lib to /usr/bin and /usr/lib, but has no idea that it did this and appears to succeed.
I hope I have the details right. The precise scenarios are subjects of many-message threads and there are a lot of variations. But I think this is the basic idea, if not precisely correct in all the particulars.
Posted Jun 2, 2023 23:26 UTC (Fri)
by pebolle (guest, #35204)
[Link] (7 responses)
Come again?
Posted Jun 3, 2023 0:08 UTC (Sat)
by mjg59 (subscriber, #23239)
[Link] (1 responses)
Posted Jun 5, 2023 11:20 UTC (Mon)
by pmatilai (subscriber, #15420)
[Link]
Posted Jun 3, 2023 0:11 UTC (Sat)
by rra (subscriber, #99804)
[Link] (4 responses)
dpkg doesn't know that /bin has been aliased to /usr/bin. It has no mechanism to know this fact, and its internal architecture is fairly adverse to the whole idea, so it's proving quite difficult to add. The dpkg maintainer also believes the way /usr-merge was done is completely wrong from a technical perspective, as noted in the article, but even if they didn't feel that way, adding this understanding to dpkg is non-trivial.
There are a bunch of reasons why one cannot just ship those symlinks in a Debian package right now, but one of them is the transition from an unmerged to a merged system. This isn't something dpkg understands how to do.
As a result, /usr was merged in Debian via a separate package that manipulates the file system directly outside of the dpkg package installation process. This was an expedient approach to get the transition to happen (and is also what was done in Ubuntu), but now we're working through the consequences of creating this sort of fundamental inconsistency between the file system and dpkg's understanding of the file system.
Posted Jun 7, 2023 15:26 UTC (Wed)
by zuki (subscriber, #41808)
[Link] (3 responses)
Meh. I believe that a generic solution would be hard. But a one-off that does a hardcoded check for /bin and /usr/bin and /sbin and /usr/sbin/ and /lib and /usr/lib and the few other prefixes that matter could be implemented without any problem.
> The dpkg maintainer also believes the way /usr-merge was done is completely wrong from a technical perspective
This is the real problem. If there was will to solve the issue, dpkg could have done this approx. 10 years ago.
Posted Jun 7, 2023 16:02 UTC (Wed)
by rra (subscriber, #99804)
[Link] (2 responses)
You would think that, and of course we did think that, and various people tried, and failed. This turns out to create quite a lot of problems, even if you're willing to hard-code those specific exceptions, because there are complex interactions between package installation, diversions, alternatives, dpkg's existing file databases, existing features allowing directories to be symlinks to non-managed directories elsewhere on the system, and so forth.
Certainly if you think it's easy and we're all missing something, we'd love the help. But the most important part will be thorough testing of the edge cases to ensure that we didn't create new problems while trying to fix the old problem.
>> The dpkg maintainer also believes the way /usr-merge was done is completely wrong from a technical perspective
There was a time when I was wondering if that was the case, but the subsequent detailed analyses by people who are not the dpkg maintainer have convinced me that this is not true and the dpkg maintainer is indeed correct that this is a very invasive and non-trivial change.
Posted Jun 7, 2023 17:35 UTC (Wed)
by mathstuf (subscriber, #69389)
[Link] (1 responses)
Not that I'm volunteering, but are these edge cases at least captured as test cases in the relevant project(s)? Or just mused about on mailing lists?
Posted Jun 7, 2023 18:01 UTC (Wed)
by rra (subscriber, #99804)
[Link]
A lot of the work so far has been finding new edge cases that break and then estimating how prevalent they are in the archive.
Posted Jun 15, 2023 19:42 UTC (Thu)
by fest3er (guest, #60379)
[Link]
The old pkg is moved aside, but still usable. The new pkg is installed, prepared and configured. The old pkg is erased. This would eliminate the cornfusion of which files are old and which are new, which are gnarled and which are true. And would work after pkgs are split.
I encountered related problems as I attempted to build an initramfs for a small distro I manage. I found that if I made /bin a symlink to /usr/bin, at least some pkgs would, for example, replace the /bin symlink with a real dir. I finally gave up, let stuff install where it wanted to, then moved everything from /{bin,lib,etal} to /usr/..., and replaced those dirs in / with symlinks to those in /usr. (Or maybe I moved stuff from /usr to /; don't remember now, but it's the same problem.)
Whilst I only have about 200 pkgs to handle, many of them make it easy to change install locations, but enough of them seem to obfuscate how to change where they install as to make it more of a bother than it's worth.
Debian's /{bin,lib,etal} scheme is workable, but may still cause problems when someone builds and installs a pkg only to discover that the pkg replaces the /bin and /lib symlinks with real dirs, and then spends hours figuring out what went wrong. (Not everyone is an experienced admin or developer. And even if they are, the process of creating a .deb from scratch is so poorly documented that most people will just give up and install directly.)
Posted Sep 5, 2023 15:17 UTC (Tue)
by nix (subscriber, #2304)
[Link]
So maybe I'm just blinded by boredom (stuck in a hospital waiting room, typing on a phone) but there seems to be a trivial one-liner fix for this in dpkg: when considering whether an old file F should be removed due to package B replacing obsolete files in package A, see if the (dev, ino) pair of F is used by any of the files in package B (trivial to determine, just remember them as you unpack them in a hashtable or something). Only delete files for which their (dev, ino) is not also the (dev, ino) of any files in the new package.
Bingo, handles not only /bin -> /usr/bin replacements in a generic fashion but also people doing weird things like bind-mounting bits of the system into unusual places across a d-u. mount --bind/--move etc do exist and people will use them... it *does* rely on (dev, ino) reliably identifying file uniqueness within a single boot, but all sorts of things break if that's not true so Linux even makes it work, more or less, on FAT...
Posted Jun 4, 2023 14:24 UTC (Sun)
by mirabilos (subscriber, #84359)
[Link]
And the directory symlinks *have* to stay in place for things like #!/bin/sh precisely (the FHS even demands that, if ed(1) is installed, it’s reachable as /bin/ed, and I successfully defended this against a distro trying to move it to /usr/bin/ early).
Anyway, this systemdification of Debian is creepy.
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Wol
Seeking the endgame for Debian's /usr merge
> [When a change is made,] all packages become lint-unclean, all maintainers need to read up on what the new thing is, how it might break, whether/how it affects them, manually run some tests, and finally decide to opt in. This causes a lot of overhead and manually executed mechanical changes across packages.
> Notably, the cost of each change is distributed onto the package maintainers in the Debian model. At work, we have found that the opposite works better: if the team behind the change is put in power to do the change for as many users as possible, they can be significantly more efficient at it, which reduces the total cost and time a lot. [...]
> Granting so much personal freedom to individual maintainers prevents us as a project from raising the abstraction level for building Debian packages, which in turn makes tooling harder.
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
the combination of upgrade plus moving file from pkg to pkg, plus moving files within a package with other issues such as actions in postinst/postrm etc config scripts adds corner cases everywhere.
Seeking the endgame for Debian's /usr merge
Fedora even supports upgrades skipping 2 versions.
With Fedora, it's just "skipping one version":Seeking the endgame for Debian's /usr merge
System upgrade is only officially supported and tested over 2 releases at most (e.g. from 36 to 38).
— https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/
Seeking the endgame for Debian's /usr merge
Fedora in-place upgrades
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
https://wiki.debian.org/AutomatedUpgrade
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
The "discussion/energy" were not required per se, but the core purpose of Debian is having endless mailing list flame wars, packaging is just a side hustle, so what do we expect
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
I didn't manage to fit it into the article, but Sam Hartman (who, by his own admission, is not a big fan of the /usr move) put together a summary of the benefits that are expected to come from it.
Benefits
Benefits
Benefits
Benefits
Benefits
Benefits
Benefits
- less chance of it becoming corrupted, either due to manual errors or due to bugs,
- no need to wait for fsck to finish checking your huge /usr file system on every boot.
- You can share/clone /usr among multiple machines (compared to /var, which is machine-specific).
Benefits
Benefits
Benefits
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Do you have any actual example of a distribution doing that?
Seeking the endgame for Debian's /usr merge
dh@<Ubuntu-23.04-machine>:~$ ls -al /
[...]
lrwxrwxrwx 1 root root 7 Mai 17 09:15 bin -> usr/bin
[...]
lrwxrwxrwx 1 root root 7 Mai 17 09:15 lib -> usr/lib
lrwxrwxrwx 1 root root 9 Mai 17 09:15 lib32 -> usr/lib32
lrwxrwxrwx 1 root root 9 Mai 17 09:15 lib64 -> usr/lib64
lrwxrwxrwx 1 root root 10 Mai 17 09:15 libx32 -> usr/libx32
[...]
lrwxrwxrwx 1 root root 8 Mai 17 09:15 sbin -> usr/sbin
---
Seeking the endgame for Debian's /usr merge
/bin/ls → /usr/bin/ls
/lib/libc.so.6 → /usr/lib/libc.so.6
Seeking the endgame for Debian's /usr merge
Seeking the endgame for Debian's /usr merge
Merge /bin and /sbin
Merge /bin and /sbin
Merge /bin and /sbin
Merge /bin and /sbin
Merge /bin and /sbin
Merge /bin and /sbin
Wol
Merge /bin and /sbin
Merge /bin and /sbin
Wol
Merge /bin and /sbin
Wol
Merge /bin and /sbin
Merge /bin and /sbin
Merge /bin and /sbin
Merge /bin and /sbin
Wol
Merge /bin and /sbin
/usr/bin (and /usr/sbin, and /usr/local/... , opt/...) contains the binaries that are not needed to bring the system into working state.
Merge /bin and /sbin
Merge /bin and /sbin
Via a bit of netsurfing, the most illuminating explanation of why /usr arose historically, and why these distinctions between /, /usr, /home persisted, and why it really doesn't matter as of 30 years ago, is by Rob Landley here. Hilarious.
Why merge /usr?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
2. Those files move to a different package B, staying in the same location
3. Package B then moves those files into /usr/bin or /usr/lib
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
> This is the real problem. If there was will to solve the issue, dpkg could have done this approx. 10 years ago.
Erm, bind mounts?
Erm, bind mounts?
Erm, bind mounts?
- add /upg-root/{bin,lib,etal} to PATH (earlier in PATH so old-pkg is used until new-pkg is ready for use)
- move old-pkg's files to /upg-root/...
- install new-pkg
- upgrade old-pkg's config/etc. files to /....
- clear /upg-root
Erm, bind mounts?
Seeking the endgame for Debian's /usr merge