User:Needle

Meet me in libra.chat's gentoo IRC support channel.

etckeeper whitelist configuration
This example below shows how to save explicit files to the etckeeper repository. This is the reverse approach, compared to the default etckeeper configuration, which

The first entry  ignores ALL files in the /etc directory, following   negated entries mark the interesting files that will be saved to the repository.

Configuration example for saving these 3 files:



Configuration example for directory:

Configuration example for directories containing subdirectcories with interesting files:



Automated rebuild of portage packages
This solution relies on the and the usage of anacron USE flag.

What does that anacron USE flag do, verify using the euse tool:

it is a added feature or function to cronie. The anacron USE flag re-schedules missed cron jobs for machines that are not 24/7 online, like f.e. laptops, workstations. Apart from that it is working like an usual cron scheduler. This feature does not rely on the separate anacron package.

Install cronie:

Schedule daily rebuild by adding following file in the directory:

Make the file executable by adding the +x flag:

This will schedule run the eix-sync and ebuild jobs, at ~03:00 AM. And if the job has been missed because host was turned off, the job gets scheduled after a the host has been turned on again.

Now it would be nice to see, what has been rebuild and how it worked out without using any complex commands. Add a bash script to the ~/bin directory of the root user. The script runs 2 qlop commands showing the results from beginning of the day. qlop is part of ebuild.

Make the file executable by adding the +x flag:

Because I am even to tazy to run that command manually, I add following lines to the file, this calls the upper, each time the root user authenticates to this host. Additionally this lists the last 8 lines of the file:

And this is the prompt how it looks like after successful authentication:

This is not a mandatory step, but could be useful on always on systems. For the update routine to be sane. The daemons that have changed libriaries would need a restart. Install following:

Default configuration needs to be adjusted to the own system. Do not rely on defaults. needstart needs further configuration. The list of all configuration files:

Now this solution works 99% of the time. If packages fail to build, this needs to be resolved manually by doing a world rebuild, and inspecting what has gone wrong.

Additional software
These packages are all needed to get it to run:
 * - with enabled USE flag netifrc
 * - Brings up/down ethernet ports automatically with cable detection
 * - Linux kernel laptop_mode user-space utilities
 * - Linux kernel laptop_mode user-space utilities
 * - Linux kernel laptop_mode user-space utilities

OpenRC
Managing daemon status and interfaces reflecting the current powerlevel AC or running on battery. This can be accomplished by using. OpenRC configuration and management is more complex compared to the configuration approach, but also much more flexible. A simplified openrc configuration is needed. Dynamic services are handled by laptop-mode-tools. Overview of running daemons handled by openrc runlevel default, note laptop_mode daemon is started here:

Following daemons need to be managed by laptop-tools:

Remove the daemons from the openrc default startup level

Verify the default startup of openrc:

Laptop-mode-tools
The laptop_mode tools dynamic configuration relies on default 2 ACPI levels:


 * laptop is running on AC power
 * laptop is running on battery

laptop-mode tools has 2 according ACPI states named batt and lm-ac:


 * batt
 * lm-ac
 * nolm-ac

The 3-rd state nolm-ac (laptop-mode tools daemon NOT running) is not used.

Get an overview of the laptop-mode directory:

Each of the 3 predefined states batt lm-ac and nolm-ac have a -start and -stop suffix in the directory structure. There is also a conf.d directory for services configuration that would be handled by laptop-mode and a modules directory for modules to be used explicitelly.

The goal is reached when the laptop automatically determines which daemons need to be started and which need to be stopped depending on the ACPI battery level.

There are 2 states in which the laptop is working:


 * laptop is docked, ac connected, wired access, printing available, ssh daemon running
 * laptop is not docked, battery, wireless access, no priting available, no ssh daemon runni

Adjust the previosly removed daemons to laptop-mode. Change to the battery level. wlan is the only one service needed while running on battery.

Change to the directory:

Create a symlink to daemons to be run while on battery:

Change to the directory /etc/laptop-mode/batt-stop/:

Create a symlink to deamons to be stopped while on battery:

Start and Stop daemons handled by the battery status after configuration:

Start and Stop daemons handled by the battery status:

Verification
Docked laptop and service status:

Undocked status:

This is a ready, easy to use, running configuration.

Enable IPv6 privacy extensions (RFC4941)
IPv6 privacy extensions are disabled by default on GNU/linux, they lead to problems if users are not aware of this. To enable privacy extensions on gentoo permanently add following lines and reboot the system:

The setting net.ipv6.conf.all.use_tempaddr is used to propagate its value to all interfaces currently attached to the system. This setting might not work reliably for all interfaces. At least not on my own tested gentoo installations up to kernel 4.14.

There are two old bugs in the Linux kernel bugtracker for this issue:
 * https://bugzilla.kernel.org/show_bug.cgi?id=11655
 * https://bugzilla.kernel.org/show_bug.cgi?id=9224

Wiki templates for templates

 * Category:Templates_for_templates

Command sequence for old gentoo boxes to update after a long time
This is a basic sequence of commands for updating older gentoo boxes.

Divide and conquer: Update the toolchain first, then resolve the blocks manually afterwards.

Sync portage tree:

Update the portage application:

Sync portage again:

Emerge GCC first:

Show availabe GCC compilers:

Set the latest available GCC compiler in the list:

Check if the desired GCC has been set, apply portage postinstall hint:

Emerge latest glibc

Check the latest gentoo related toolchain changes on the wiki, bugs, etc: Project:Toolchain

Emerge latest linux kernel:

Show available kernel sources:

Set the latest linux kernel version:

Emerge latest binutils:

Show current available binutils:

Set the latest binutils version:

Verify binutils setting:

Emerge latest python

Emerge latest perl:

Emerge latest iproute2

Update the system with following command, resolve dependency errors:

Update the system with following command, resolve dependency errors:

Now it is done.