selfjungle Just another WordPress weblog

20Apr/150

zfs and portage’s var directories

While /var is usually for non-crucial content, caches[3], pid files, etc, portage has a different idea [1]:

/var/db/pkg Portage stores the state of your system
/var/lib/portage The versions for the applications you have explicitly installed

These directories store the current tree state, there is no way recreating them if they are deleted.[2]

So if you plan to use ZFS with separate / and /var to take a snapshot of /, install some packages and then rollback the snapshot as you changed your mind, your / and /var will be out of sync!

/var/db/pkg and /var/lib/portage has to be on /.

mkdir /usr/var_db_pkg /usr/var_lib_portage
cp -r /var/lib/portage /usr/var_lib_portage
cp -r /var/db/pkg /usr/var_db_pkg
rm -rf /var/lib/portage /var/db/pkg
ln -s /usr/var_lib_portage /var/lib/portage
ln -s /usr/var_db_pkg /var/db/pkg

[1] https://wiki.gentoo.org/wiki/Directories
[2] Or at least it is painfull. To avoid the initial circular-dependency hell, issue:

emerge --nodeps dev-lang/perl dev-lang/python dev-libs/libxml2 dev-util/cmake dev-util/pkgconfig sys-apps/acl ys-apps/systemd sys-devel/automake sys-libs/glibc sys-libs/ncurses sys-libs/zlib virtual/libudev

[3] what you'd have to recreate: powertop's calibration measurements, gentoolkit's busybox and initramfs

Tagged as: , No Comments
10Mar/150

sytem information/monitoring

# sys-apps/pciutils
lspci -k

# app-admin/sysstat
iostat -dm 2

# sys-process/htop
htop

# sys-apps/util-linux
lsblk

# sys-apps/usbutils
lsusb -v

# sys-process/iotop
iotop -o

#sys-power/acpi
acpi

# app-admin/mcelog

emerge -avq sys-apps/pciutils app-admin/sysstat sys-process/htop sys-apps/util-linux sys-apps/usbutils sys-process/iotop sys-power/acpi
Tagged as: No Comments
2Mar/150

intel 7265 wifi, iwlwifi and systemd

compile your kernel to support:
CONFIG_IWLWIFI=y
CONFIG_IWLMVM=y

# check which firmware version suits your kernel [1]
emerge -av iwl7265-ucode iw wpa_supplicant
# or maybe not. If your kernel want's another version, (see dmesg) (3.19 wanded the D: iwlfiwi-7265D.12.ucode) just download the correct version, unpack and move the ucode file to /usr/lib/firmware

# iwconfig is deprecated, use iw to check the wifi iface
iw dev
# ... interface wlp2p0

# manual:
wpa_supplicant -B -i wlp2p0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd wlp2p0

# or by systemd. Do not enable wpa_supplicant, it will be started by dhcpcd
#systemctl enable wpa_supplicant@wlp2p0
cat "env wpa_supplicant_driver=nl80211" >> /etc/dhcpcd.conf
systemctl enable dhcpcp@wlp2p0

# my wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
update_config=1
network={
ssid="MY ESSID"
psk="MY PASS"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}

[1] https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi

Tagged as: No Comments
1Mar/150

update gentoo

emerge --update --newuse --deep --with-bdeps=y @world -av
emerge --depclean -av
emerge @preserved-rebuild -av
perl-cleaner --all
python-updater
revdep-rebuild -pv
rm -rf /usr/share/man/??
rm -rf /usr/share/man/??_*
eix-test-obsolete
glsa-check -t all

https://wiki.gentoo.org/wiki/Gentoo_Cheat_Sheet

Tagged as: No Comments
1Mar/150

migrating from openrc to systemd

# remove blocking package, systemd provides the functionality.
emerge -C sys-fs/udev openrc netifrc virtual/service-manager sysvinit
# comment out service manager and openrc from your @system set, defined in /usr/portage/profiles/base/packages 

# add systemd to use flags
emerge -av systemd
emerge -av virtual/udev virtual/libudev

# set kernel options& recompile
Gentoo Linux --->
  Support for init systems, system and service managers --->
    [*] systemd


# to kernel command line:
init=/usr/lib/systemd/systemd

hostnamectl set-hostname 
cat /etc/locale.conf
# LANG="en_US"
localectl set-locale LANG=en_US
localectl set-keymap us


http://wiki.gentoo.org/wiki/Systemd

http://forums.gentoo.org/viewtopic-p-7656898.html

Tagged as: No Comments
28Feb/150

install gentoo from liveCD

suppose we booted up for a liveCD/USB

#mount the destination device, DEV
mount DEV /mnt/gentoo
cd /mnt/gentoo
wget http://mirror.mdfnet.se/gentoo/releases/amd64/autobuilds/current-stage3-amd64-nomultilib/stage3-amd64-20150226.tar.bz2
tar xjpf stage3*

cd /
mkdir -p /mnt/{dev,proc,sys}
mount -t proc proc /mnt/gentoo/proc
mount --rbind /dev /mnt/gentoo/dev
mount --rbind /sys /mnt/gentoo/sys
cp -L /etc/resolv.conf /mnt/gentoo/etc/ 
chroot /mnt/gentoo /bin/bash
source /etc/profile
emerge-webrsync

eselect profile list
passwd

#timezone
cp /usr/share/zoneinfo/Europe/Oslo /etc/localtime
echo "Europe/Oslo" > /etc/timezone
emerge --config timezone-data

# glibc will generate lang files according to:
nano locale.gen
locale-gen
eselect locale list

# check /etc/fstab
Tagged as: No Comments
28Feb/150

gentoo gcc optimalization – make.conf

edit you /etc/portage/make.conf

# chost [4] 
# 64bit intel processors are AMD64 or x86_64, IA64 is for ithanium
CHOST="x86_64-gentoo-linux-gnu"

# CPU arch
# use gcc to detech your arch: gcc -c -Q -march=native --help=target | grep march
CFLAGS="-march=broadwell -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"

# emerge -1v app-portage/cpuinfo2cpuflags
# cpuinfo2cpuflags
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3"
USE="${CPU_FLAGS_X86} ..."

# N = #CPUs + 1 or just #CPUs, see link[3]
# interl 5y10 has 2 cores (x2 hyper threading):
MAKEOPTS="-j4"
ABI_X86="64"

# debug symbols stripped
FEATURES="splitdebug"

#misc:

# accept all unstable packages too
ACCEPT_KEYWORDS="~amd64"
# accept all licenses
ACCEPT_LICENSE="*"
# x11-base/xorg-drivers
VIDEO_CARDS="intel i965"
INPUT_DEVICES="evdev keyboard mouse mutouch virtualbox synaptics"
# pick the highest if possible
PYTHON_TARGETS="pypy python3_4"
RUBY_TARGETS="ruby22"

[1] Gentoo wiki: http://wiki.gentoo.org/wiki/GCC_optimization
[2] Look up your CPU architecture https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#i386-and-x86-64-Options
[3]https://blogs.gentoo.org/ago/2013/01/14/makeopts-jcore-1-is-not-the-best-optimization
[4]http://wiki.gentoo.org/wiki/CHOST

Tagged as: No Comments
25Apr/140

direct rendering without root

If as a non-root user even thou GLX module is loaded:

user $ cat /var/log/Xorg.0.log | grep -i glx
LoadModule: "glx"

you don't have direct rendering:

user $ glxinfo | grep direct
direct rendering: Yes

But you do have it as a root, you might want to add the user to the correct group:

root $ gpasswd -a [USERNAME] video

gentoo wiki

Tagged as: No Comments
27Mar/140

getting rid of consolekit and policykit

systemd makes them redundant, getting rid of them is pretty easy:

edit /etc/pam.d/system-auth and enable pam_systemd.so:

session         optional        pam_systemd.so

and re-emerge pambase

USE=-consolekit emerge  pambase

and sincle polkit is used by upower and udisks (automount) and these 2 is used by kdelibs, you may want ot rebuild kdelibs too:

USE="-upower -udisks" emerge  kdelibs

link: gentoo wiki

Tagged as: , No Comments
6Mar/140

update all packages under same category (for example KDE) with emerge

from eix --help:

 -#, --only-names       --pure-packages with format /
 -I, --installed       Next expression only matches installed packages.
 -C, --category          category

The emerge command:

emerge -av $(eix -I#C kde-base)
Tagged as: , No Comments