[gentoo-dev] Re: Need design help/input for eclean-kernel

2016-06-30 Thread Duncan
Michał Górny posted on Thu, 30 Jun 2016 14:38:26 +0200 as excerpted:

> [P]lease reply to this thread with
> a specific /boot layout that you think needs to be handled, with as much
> helpful information as possible -- including possible distinctive
> features and pitfalls.

This is surely more info than you need, but I imagine it's one of the 
more unique and complex layouts you'll see and thus might need additional 
explanation for some bits.  Trouble is I don't know which bits, so...

I have never used eclean-kernel and probably won't as I have my own 
scripts to handle things (as I was doing even back over a decade ago on 
mandrake, before I switched to gentoo), but here's the layout, in case 
you find it useful (or a fun challenge? =:^) to support.

So what I have for boot:

/boot itself is a symlink, normally pointing at /bt, the mountpoint for 
my working boot partition, but setup with /boot as a symlink so I can 
point it at /bk/bt, where I can mount my backup boots on other devices, 
when I want to install grub to them.

/bt, LABEL=bt0238gcn1+35l0 : working boot mountpoint and filesystem when 
mounted, where the /boot symlink normally points.  Filesystem is btrfs 
mixed-blockgroup dup mode.  This is a partition on one of a pair of 238 
GiB (256 GB) Corsair Neutron SSDs.


/bk/bt: mountpoint for my backup boots.  The /boot symlink can be 
adjusted to point here when I want to install grub to one of the backup 
boots.

LABEL=bt0238gcn0+35l1 : primary backup boot filesystem, also btrfs mixed-
blockgroup dup, a partition on the other one of the pair of 238 GiB SSDs.

LABEL=bt0465gsg0+47f0 : secondary backup boot filesystem, reiserfs on a 
partition on a 465 GiB spinning rust seagate.

Various other removable drives and their labels for further backups...

All bootable storage (including removable) is GPT partitioned with both a 
legacy-BIOS partition to which grub2 is installed and an EFI partition 
reserved for future use.  Each installed grub points at the /bt boot 
partition on that device, so I can at least get both a grub prompt and a 
bootable kernel on any of them, even with all other storage 
disconnected.  From there it's up to where I point the kernel using root= 
on the kernel commandline, but FWIW, each grub is configured with a menu 
from which I can choose any of my working or primary or secondary backup 
root.

On each of these boot partitions the filesystem layout is:

amd64/
64-bit kernels, configs, system-maps, symlinks...

boot -> .

grub/

[x86/]
[when I had the 32-bit netbook, this was its kernels, etc.]

[A single zero-length file named working, backup, backup2, etc, so I can 
easily confirm which one I actually booted to when testing an updated 
grub install or the like.]


The kernel dirs are laid out as...

$$ ls -1 /bt/amd64

config@
config-4.5.0-dirty
config-4.6.0-dirty
config-4.6.0-rc7-00096-g685764b10-dirty
config.old@
config.stable@
System.map@
System.map-4.5.0-dirty
System.map-4.6.0-dirty
System.map-4.6.0-rc7-00096-g685764b10-dirty
System.map.old@
System.map.stable@
vmlinuz@
vmlinuz-4.5.0-dirty
vmlinuz-4.6.0-dirty
vmlinuz-4.6.0-rc7-00096-g685764b10-dirty
vmlinuz.old@
vmlinuz.stable@


That's three symlinks for each of the map, config and kernel.  They point 
to current, old (previous) and stable.  Since I often test/run and 
occasionally bisect git kernels, current and old often point to git and 
perhaps bisect-bad kernels, and during a bisect I may have nearly a dozen 
kernels and associated files, tho my scripts only maintain the current/
old symlinks.  I update the stable symlink manually, when I consider a 
released version tested well enough locally to be confident doing so.

Only the working boot gets the git kernels.  I update the primary backup 
with the new release-stables each kernel cycle, and only update the 
secondary backup every few kernel cycles.

The git kernel testing and bisects are why I prefer to do my own kernel 
cleanups.  That way I can keep the first git kernel I saw the problem in 
around until I get around to doing a bisect, if the problem hasn't been 
caught and fixed upstream by then, making the bisect easier than it would 
be if I kept updating to see if the problem was fixed, losing track of 
the first bad kernel I saw in the process and thus perhaps forcing 
another round or two of bisection to track down the problem.

And for sure I don't want anything touching the stable symlinks but me, 
manually, when I am sufficiently confident I can do so and won't be left 
in a hole without an easy way to dig myself out as a result.

I use a dracut-built initr*, compressed and appended as an initramfs to 
each kernel built and tested, so once I know the kernel/initramfs 
combination work, I don't have to worry about a buggy initr* update 
breaking older kernels as they have their initramfs builtin.  The dracut-
built initr* is kept on a different filesystem in ordered to leave more 
room in the boot and backups for kernels.


More 

[gentoo-dev] Re: Need design help/input for eclean-kernel

2016-06-30 Thread Jonathan Callen
On 06/30/2016 08:38 AM, Michał Górny wrote:
> Hello, everyone.
> 
> Back in 2011 I started a project called eclean-kernel. The idea was
> pretty simple -- to have a tool that would clean the old kernels for
> me since their install is not controlled by the package manager. This
> little project of mine seems to have gained a lot of popularity.
> 
> Sadly, over time a lot of people had trouble with it. Aside to minor
> Python problems, eclean-kernel proved too simple to handle multitude of
> user systems with varying /boot layouts. In fact, even I don't use it
> on all of my systems since it doesn't handle them properly.
> 
> After being buried in another set of bug reports, I'd like to
> officially ask Gentoo developers and users for help. I think it's
> impossible to solve most of the bugs reported so far in the current
> program design. Therefore, I'd like to rewrite it in a more flexible
> manner.
> 
> For this reason, I would like to ask you to provide me with
> different /boot layouts you may have, had or seen. Basically, the idea
> is to collect as many different layouts as necessary, and use that to
> design eclean-kernel in a way making it possible to easily configure it
> to handle proper variant -- or even possibly make it capable of
> autoconfiguration.
> 
> So if you have some time, please reply to this thread with
> a specific /boot layout that you think needs to be handled, with
> as much helpful information as possible -- including possible
> distinctive features and pitfalls.
> 
> Thanks in advance.
> 

https://wiki.freedesktop.org/www/Specifications/BootLoaderSpec/

${MACHINE_ID} is the contents of /etc/machine-id

Boot loader config:
/boot/loader/entries/${MACHINE_ID}-${KV}.conf

Kernel, initramfs, etc.:
/boot/${MACHINE_ID}/${KV}/linux
/boot/${MACHINE_ID}/${KV}/initrd
/boot/${MACHINE_ID}/${KV}/config
/boot/${MACHINE_ID}/${KV}/System.map

Can be generated by kernel-install(8) (part of systemd).

-- 
Jonathan Callen



signature.asc
Description: OpenPGP digital signature