Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: Systemd migration: opinion and questions
Date: Sat, 23 May 2015 10:41:24
Message-Id: pan$44eac$70ace84e$177b2735$89b77d3f@cox.net
In Reply to: Re: [gentoo-amd64] Re: Systemd migration: opinion and questions by Marc Joliet
1 Marc Joliet posted on Sat, 23 May 2015 10:49:07 +0200 as excerpted:
2
3 > Am Thu, 21 May 2015 09:36:28 +0000 (UTC)
4 > schrieb Duncan <1i5t5.duncan@×××.net>:
5 >
6 > [...]
7 >> I decided to keep systemd, and ultimately, to unmerge openrc
8 > [...]
9 >
10 > I forgot to ask about this: how did you go about doing that? I'm still
11 > waiting for the following two bugs to be resolved:
12 >
13 > https://bugs.gentoo.org/show_bug.cgi?id=504116
14 > https://bugs.gentoo.org/show_bug.cgi?id=511500
15 >
16 > Do you have none of the affected packages installed, or...?
17
18 Good question!
19
20 Answer: "or..." Very definitely "or...", as you will see below. =:^)
21
22 functions.sh is easy enough to fix, if you're willing to create a single
23 symlink, manually.
24
25 $ equery belongs functions.sh
26 sys-apps/gentoo-functions-0.10 (/lib/gentoo/functions.sh)
27
28 The package gentoo-functions is /supposed/ to replace a couple gentoo-
29 specific files formerly found in openrc, thereby making openrc optional
30 for those using other init systems (like systemd). One of those files is
31 functions.sh[1].
32
33 But the old /etc/init.d/functions.sh location was hardcoded into a lot of
34 gentoo utilities over the years, some of which don't get updated very
35 often especially for stable, and the new /lib/gentoo/functions.sh
36 location, while more appropriate, still can't be found by some of these
37 apps. That's what the first bug is about.
38
39 Simple enough fix -- ensure the gentoo-functions package is installed (it
40 should be as it's a dependency of enough stuff, including current glibc
41 packages!), and do a manual symlink from the old location to the new
42 one. Viola! No openrc needed for THAT any more, and because the new
43 location's file is still packaged, any updates to it should occur
44 normally and will be simply picked up by anything still using the old
45 location, since it's a symlink! =:^)
46
47
48 The other bug deals with the base-profile placing openrc in @system,
49 since until the functions.sh bug is finally resolved, it really is a
50 system dependency of a sort as it provides the old-location functions.sh,
51 even if you're using something else as init system.
52
53 First let me caution that the below specific action is rather "out there"
54 and cannot be expected to be supported by gentoo, tho that said, it
55 hasn't caused /me/ any issues, running it for I'd guess a couple years
56 now... and for sufficiently experienced gentooers it's not really as
57 unreasonable as it might sound...
58
59 Warning out of the way...
60
61 What I've done here, actually quite some time before I switched to
62 systemd, is negate my entire @system, so it's entirely empty. I actually
63 get a pretty dire looking warning about the empty @system when I run
64 emerge --depclean, but when I negated @system, I did so one package at a
65 time, and added packages to my @world list as necessary, where I really
66 did need (or want) them and nothing else depended on them.
67
68 Of course this only works for gentooers with enough experience to tell
69 what @system packages that would be removed when it's empty, are really
70 needed after all. I obviously had the required experience as I've been
71 running @system-less for quite some time now, but it's obviously not for
72 everyone.
73
74 Obviously for things like virtual/editor, I already had my editor of
75 choice in @world, and thus could simply negate the virtual entirely. In
76 other cases, something else in @world has a dep on the @system package,
77 so I didn't need to put that package in @world when I took it out of
78 @system, at all.
79
80 And things like busybox... aren't really necessary at all. In fact, I've
81 actually never had it installed in the over a decade I've been on gentoo,
82 as for whatever reason it wouldn't build when I originally installed, so
83 I temporarily bypassed it as I knew it was an emergency thing, and that
84 temporary thing just got longer and longer, until I decided I didn't need
85 it at all.
86
87 Instead of something like busybox, I keep (at least) two root partitions
88 available, my working copy and my backup. The two partitions are the
89 same size, and contain pretty much everything installed by portage (with
90 a small exception for some state files in /var, since I keep root mounted
91 read-only by default and they need to be writable). Periodically, when
92 the system seems to be stable, I'll blow away the backup root with a
93 fresh mkfs, and then copy everything back onto it, creating a new backup
94 that's a copy of the same working system setup that I'm using at that
95 moment. Of course a good sysadmin never considers a backup done until
96 it's tested, so then I test-boot to it to ensure it works.
97
98 Meanwhile, in grub2, I have a menu entry that sets a variable used in the
99 root= entry on the kernel commandline. By default, that var points at
100 the working root, but if I invoke that menu entry, it changes the var to
101 point at the backup root instead, thus letting me boot either working or
102 backup root, by just selecting an entry in the grub2 menu before I load
103 the kernel, if I want to boot the backup.
104
105 So I don't need something like busybox, because in the event I screw up
106 the working root and can't boot it, I can boot the backup, which is a
107 copy of the very same working config I was using when I took it. So
108 while it might be a bit old if I haven't updated the backup in awhile,
109 it's tested to boot properly, when I made the backup.
110
111 And actually, my working system and primary backup are on dual SSDs in
112 btrfs raid1 mode, with a partition each for the working and primary
113 backup, and I have another backup on my old spinning rust drive as well,
114 on reiserfs in case btrfs bugs out on me and the working and primary
115 backup are thus unusable, with yet another grub menu entry to set it up
116 for boot. Meanwhile, I have a separate grub installation and separate
117 /boot, on all three drives, so as long as all three drives don't go out
118 at once...
119
120 And of course ssh, still part of @system altho people running local
121 systems really don't need it as part of @system, works just fine in
122 @world, if you actually do want/need it.
123
124 Just some examples...
125
126 OK, but how does this @system negation actually /work/?
127
128 Simple enough. The portage (5) manpage has the documentation, but
129 briefly, profiles dirs can have packages files. In these files are
130 entries like this:
131
132 *sys-apps/busybox
133 *>=sys-apps/baselayout-2
134
135 The * indicates that this package should be added to the @system set.
136 (In new enough portage and profiles there's also @profile set entries,
137 see the manpage, but they haven't bothered me yet, here.)
138
139 And critically, in cascading profiles, which pretty much all profiles are
140 these days, -* indicates a *REMOVAL* from the @system set.
141
142 Two additional missing pieces:
143
144 /etc/portage/profile/packages... is where you put your installation-
145 specific things, and where I put my negations.
146
147 Note the versioned baselayout-2 entry above. These versioned entries
148 must be negated with the identical version, or they don't end up
149 negated. So that baselayout entry would be negated like this:
150
151 -*>=sys-apps/baselayout-2
152
153
154 As I said, with a clean emerge --depclean --pretend, I negated one or a
155 small handful at a time, then did an emerge --depclean --pretend and
156 noted what the new @system removals had now cleared for removal as
157 nothing else depended on them. Some, such as virtual/editor, I already
158 had an appropriate editor in @world for and thus removal of the virtual
159 was fine. Others, such as sys-apps/busybox, I never had installed in the
160 first place. Others, including sys-apps/man-pages, I added to @world,
161 and still others, including sys-fs/e2fsprogs, were deps of something else
162 and thus didn't need a specific @world entry to keep depclean from
163 removing them.
164
165 And of course, the two that triggered the subthread, openrc and
166 baselayout. Openrc I originally kept in @world as I was using it for init
167 when I did the @system negation. Since it was then in @world, not in
168 @system, when I switched to systemd for init, it was easy enough to
169 unmerge it, just as I would anything else in @world.
170
171 Meanwhile, systemd itself depends on baselayout, and I'd guess openrc
172 does as well altho I don't remember for sure and am lazy to look ATM, so
173 it stays on the system even tho it's not in @system any longer.
174
175
176 Finally, one additional thing to note about @system, that's different
177 when you don't have it. If you try to unmerge a package in @system, you
178 get a dire warning. Obviously, if your @system is empty and the same
179 package is simply listed in @world or a dep of something in @world, you
180 won't get that same kind of dire warning trying to unmerge it. For
181 experienced gentooers that should be no big deal, as they wouldn't think
182 of trying to unmerge really critical stuff like glibc anyway. But for
183 less experienced gentooers, those dire warnings might save their *** once
184 in awhile, making them useful to have. If you're at all unsure whether
185 you need such "safety railings", emptying @system entirely probably isn't
186 something you should be considering.
187
188
189 But, just because you aren't emptying @system entirely, doesn't mean you
190 can't negate specific @system package entries, if you're sure you don't
191 need them. For systemd users who don't want/need the fallback to openrc
192 in case systemd fails to boot, or where the openrc config is getting
193 dangerously outdated due to lack of use such that even if systemd breaks,
194 they'd be afraid to simply set init to run openrc instead, lest it break
195 their system further with an unconfigured and untested boot, and who have
196 or will take care of that /etc/init.d/functions.sh file via manual
197 symlink, openrc may well be one such entry to consider negating.
198
199
200 ....
201
202 So you see why I said "or..." DEFINITELY "or...", above! =:^)
203
204 ---
205 [1] gentoo-functions file replacements: In addition to functions.sh, the
206 other is consoletype, executable and manpage, see the results of equery
207 files gentoo-functions.
208
209 --
210 Duncan - List replies preferred. No HTML msgs.
211 "Every nonfree program has a lord, a master --
212 and if you use the program, he is your master." Richard Stallman

Replies

Subject Author
Re: [gentoo-amd64] Re: Systemd migration: opinion and questions Marc Joliet <marcec@×××.de>