Gentoo – searching mail with notmuch

When setting up notmuch for use with mutt in Debian, I followed this guide
The macro setup there, didn’t work in the Gentoo installation, though.
I looked here and used the macro there:
macro index "unset wait_key\
read -p 'notmuch query: ' x; echo \$x >~/.cache/mutt_terms\ ~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms)\
| head -n 600 | perl -le '@a=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"" \
"show only messages matching a notmuch pattern"

Removing a web page from a server, but browser still displays it

I was playing around with with sites-enabled in apache, and removed an old web page (removing the file), but my browser would still display that page, even though I had removed it. It appeared that the browser cached that page. I opened the site in another web browser, and there, it displayed correctly.
Solution: I found out, you can open a new private window in firefox, and then, it will not show an old cached site.

Gentoo – mutt with sidebar (sidebar not showing)

I found, you need to enable the sidebar use flag, so I created the file /etc/portage/package.use/mutt with the contents:mail-client/mutt sidebar.
Still, no sidebar was displayed. Then, I found out, you need to set the width of sidebar in .muttrc, otherwise, it will probably have the width 0. So I set the width with the line set sidebar_width=20

A noobs guide to installing Gentoo on a core i5 2500K – cryptsetup

So, I use cryptsetup to encrypt a drive I have, so I would really like to continue using cryptsetup.
It is easy to emerge cryptsetup with emerge --ask sys-fs/cryptsetup.
Then, trying to run it, for example cryptsetup benchmark, I got the error:
Required kernel crypto interface not available.
Ensure you have algif_skcipher kernel module loaded.

I searched and found this thread. I extracted the parts I needed for it to work for me:
The following kernel configuration options needed to be enabled:
(If I recall correctly)
CONFIG_CRYPTO_XTS
CONFIG_CRYPTO_AES_X86_64
CONFIG_CRYPTO_AES_NI_INTEL

The first two are for my encryption algorithm xts-plain64. The Intel option is because I have an Intel CPU.
Still no go, I found I had to enable some hashes as well (logically):
CONFIG_CRYPTO_SHA1
CONFIG_CRYPTO_SHA1_SSSE3
CONFIG_CRYPTO_SHA256_SSSE3
CONFIG_CRYPTO_SHA512_SSSE3
CONFIG_CRYPTO_SHA1_MB
CONFIG_CRYPTO_SHA256
CONFIG_CRYPTO_SHA512

Still no go. Later in the thread I found that I needed these options as well (Yes, I am using it as a block device):
CONFIG_BLK_DEV_DM
CONFIG_DM_CRYPT

Still no go. I started to get really annoyed, because, I had chosen to include a lot of the options in the kernel, so for each new try, I had to reboot the kernel. So, I searched for ‘algif’ in the thread and found that these options might also be needed:
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_HASH
CONFIG_CRYPTO_USER_API_SKCIPHER
.
I chose these options to be modules, and could load that module in right away, without a reboot. That did the trick.
There was some debate in the thread, whether you needed to include options in the kernel, or not, to be able to boot if your root is encrypted. I don’t have it setup that way, so it didn’t bother me, but somebody said it should be able to boot with the crypto options as modules, because modules can be loaded during boot.

A noobs guide to installing Gentoo on a core i5 2500K part3 – Applications

So, what applications do I need. I think a lot.
I will start with a www-browser, and will install firefox.

In the Xfce guide, they simply say run the following command:
emerge --ask www-client/firefox
I tried that, and first ran into the message:
The following REQUIRED_USE flag constraints are unsatisfied:
cpu_flags_x86_sse? ( cpu-flags_x86_mmxext )

After searching, I found out, I needed to add the flag mmxext in the /etc/portage/make.conf file in the variable CPU_FLAGS_X86.
After this, there was another error message:
The following USE changes are necessary to proceed:
(see "package.use" in the portage(5) man page for more details)
# required by www-client/firefox-45.4.0::gentoo
# required by www-client/firefox (argument)
>=dev-lang/python-2.7.10-r1:2.7 sqlite

I used dispatch-conf to merge the files. (simply press ‘m’ to look at how the file looks after dispat-conf has merged it and use update (‘u’), to use the file it has merged).
After the use-files had been merged, firefox could be emerged.

I have not quite gotten the hang of searching with emerge --search yet. You search for a regexp, like apt-cache search. But, if there are many matches, you have to scroll back in the terminal with , or pipe the output through less.

A noobs guide to installing Gentoo on a core i5 2500K part2

So, now I have a bootable system, but starting in text mode is not very useful for normal day activity, so I continued following the guides final steps creating a user.

Then I emerged app-editors/vim (I really missed vim in the chroot system) and sys-apps/etckeeper to keep track of my changes in /etc.

Next is to install a desktop environment. I’m choosing XFCE, so I followed the guide here.

Using the instructions to start xfce didn’t work though, because I have apparently not installed xorg yet. I found the Gentoo guide for Xorg here. There, I determined that I need to find out the video card. I have a built in intel graphics card I am using. I found the Gentoo guide for this.
I added the debug and dri USE flags in /etc/portage/make.conf.

!!!Note:I later found out, that the USE flags are optional, and that you should choose the ones you want. So debug was really not useful for me, because all packages were recompiled with that flag.

There are some USE flags that are not showing in emerge --info that I added:
dri3 sna uxa xvmc
I added this line in the /etc/portage/package.use/intel:
x11-drivers/xf86-video-intel dri3 sna uxa xvmc
After running the command
emerge --ask --changed-use --deep @world
During that, I ran into some strange error complaining about “econf failed” and perl module not being found. From this forum question, I tried the solution perl-cleaner --all, and that did the trick.
I added my user to the video group.
I chose the classical way of configuring Xorg, and emerged the x11-drivers/xf86-video-intel package.
Now, startx works, and starts xfce4, as specified in the file ~/.xinitrc.

Next, I also want a login manager. So I installed slim according to the instructions in the Xfce guide.
When logging in, it didn’t work though. Only an empty black screen was displayed. I looked at the log in /var/log/slim.log/ and saw some complaints about dbus not running. So I looked in the Slim guide, and added dbus to the default run level with the command:
rc-update add dbus default
Now, I can log in and it starts up the Xfce-environment.
But, the keyboard layout is default, and I want a Swedish dvorak layout, so I searched and found this thread saying that you need to configure that in Xorg. I looked in the Xorg wiki and added the file /etc/X11/xorg.conf.d/00-keyboard.conf with the content
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "se"
Option "XkbModel" "kinesis"
Option "XkbVariant" "dvorak"
EndSection

Now, it works like a charm.
Next stop is installing some useful programs, like a web browser. I will cover this in the next part of my journey.

A noobs guide to installing Gentoo on a core i5 2500K part1

I think I heard about Gentoo first about 8 years ago, and maybe I should have had time to check it out before. I have used linux since 2006/2007, starting off with Ubuntu, since it was easy, and then switching to Debian around 2010-2011. Since Debian is moving to systemd, and I am not convinced about that, I should try out some other distributions. Time has come to test Gentoo. I tried installing it to a virtual machine on my workstation first, and I think I will be able to pull this off.

Hardware:All of my hardware is from 2011 or older.

CPU:Intel Core i5 2500K
Motherboard:Asus P8H61-M EVO

I will install it on a spare hard-drive, and will probably let it live parallel to my main Debian Jessie system, not even configuring the main boot-loader to have an option to start Gentoo, instead be forced to manually change the boot device to boot from the Gentoo disk. We will see what I am capable of doing before growing tired.

I will be following this guide:https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation

I have verified the installation medium on my Debian system, and burned a CD.

Network configuration: I have a local dhcp server running, so the network was configured automatically.

Partitioning the disks. I will try out using UEFI, since my motherboard seems to have that option.

I have three hard drives in my current system
/dev/sda - storage
/dev/sdb - Debian system
/dev/sdc - I will install to this disk

Partitions:
/dev/sdc1 - Bios boot partition
/dev/sdc2 - boot 300MB
/dev/sdc3 - swap 12GB (2*RAM)
/dev/sdc4 - root 50GB
/dev/sdc5 - home 50GB (may use the home from my Debian system later /dev/sdb6)

I used gparted to create my partition table.

Now create file systems.

I will use vfat for boot, ext4 for root and home partitions.

Then just mount the partitions on the mount points:
mount /dev/sdc4 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sdc2 /mnt/gentoo/boot
mkdir /mnt/gentoo/home
mount /dev/sdc5 /mnt/gentoo/home

Now, it is time to download the stage3-file. I downloaded the stage3-amd64-20161020.tar.bz2 file, since my installation medium was downloaded from here. I think it might be safest to not mix them, which means my installation medium will be useless in a couple of weeks.

I extracted the stage file.

Next stop, compile options. This is a bit exciting, since it will be the first kernel I compile.

I’m using the options stated in the handbook, and use MAKEOPTS="-j5", since I have 4 CPU-cores.

Configure repos as the hand book does.

Mount necessary file systems for chroot and chroot to the new system.

Install the portage snapshot and read the news items.

I set my profile to /default/linux/amd64/13.0/desktop.

Then I updated the world set. This took a long time, since I had 172 packages to emerge.

I configured time zone and locale.

Then I downloaded the kernel sources using the command in the hand book.

Now it is time to manually configure the kernel.

In menuconfig, I enabled EFI stub support under Processor type and features -----> and USB Serial Converter Support -----> in Device Drivers ----> / USB Support ----> since I got a USB serial converter I would like to use (maybe this is unimportant).

Note that you need to use a medium booted using EFI to be able to install grub in EFI-mode. Thus, using the minimal cd is not possible. Either use one of the live-cd or live-dvd, or use system rescue cd afterwards to install grub.

I compiled and installed the kernel.

Now configure the mount points in fstab. I am using the following:
<fs> <mountpoint> <type> <opts> <dump/pass>
/dev/sdc2 /boot vfat noauto,noatime 1 2
/dev/sdc4 / ext4 noatime 0 1
/dev/sdc5 /home ext4 noatime 0 1
/dev/sdc3 none swap sw 0 0

Options and dump/pass were taken from default values in the file from the stage3 file.

Then I configured host name and dns network.

Then, I configured the local wired ethernet to use dhcp in /etc/conf.d/net:

config_enp4s0="dhcp"

I created a symlink to this device and added it to the default runlevel.

I created a password for root.

Then, I edited /etc/conf.d/keymaps to use the "dvorak-sv-a1" keymap.

I installed sysklogd as system logger. Then I installed cron.

I installed e2fsprogs and dosfstools.

Then I installed dhclient.

I updated the make.conf to have EFI support, and then installed grub2 boot loader.

Next, I installed grub using the EFI instructions and generated a configuration.
Now it is time to reboot and see if it works.
When umounting the /mnt/gentoo/sys file system, it complained that it couldn’t. Strange.
Booting doesn’t seem to work =(.
Maybe my motherboard doesn’t support UEFI after all, but it says so in the specifications. Trying to “Launch EFI Shell from filesystem device” when having sdc as boot device reports “Not found”. So maybe something with the installation has failed. Maybe the hard drive has to be connected to one of the first SATA ports? No, it is not that.
So investigate further tomorrow.
So, continuing. I have booted the live cd again, and chrooted into my install. This time, I will verify the files generated by grub. First, I read the “Important” note in the handbook – “Make sure /boot is mounted before running the grub-install command”. I checked, and my /boot wasn’t mounted in my chrooted system, even though I did mount it before chrooting. Strange.
Running the grub install command for efi:
grub-install --target=x86_64-efi --efi-directory=/boot
I got the error message:
Installing for x86_64-efi platform.
efibootmgr: EFI variables are not supported on this system.
efibootmgr: EFI variables are not supported on this system.
Installation finished. No error reported.

Searching for this term lead to this thread. I think my cd was not started in EFI-mode, because it is the minimal install cd. The fallback instructions in the second answer says you should copy the grubx64.efi file from /boot/efi, but my installation only has a /boot/EFI folder, so I will test if it boots, then resort to other measures listed there.
When I the exit the chroot, I notice that the boot partition has two entries in mount. Strange. Unmounting /boot does remove one entry. One entry is still listed. Trying to unmount again fails – Strange.
Booting didn’t work. So, now I will copy the grubx64.efi file to the location specified in the forum answer. That didn’t work either.
I think I will fall back to normal mbr next time I try it.
I have created a systemrescuecd(download, and booted it in EFI-mode.
I tried the instructions in this link, but the efivars file system type wasn’t found.
I exited the chroot, looked at the kernel modules, then chrooted back again, and this time, the command
grub-install --target=x86_64-efi --efi-directory=/boot
worked. Strange. Now reboot and try it. It didn’t work. Next reboot, without choosing boot medium, it booted. Hooray. Maybe because choosing the hard drive as boot medium will boot non UEFI. I should choose the name of OS instead (It showed up as “Gentoo” in the menu).
Next is to install desktop environment etc. I will create a new post for that part.
But, no network card seems to be detected. Maybe I need to enable some modules in the kernel configuration.
So, reconfigure the kernel then.
I checked my network interfaces before on my running debian system, and found out that I have a Realtek RTL8111/8168B as a wired ethernet interface. So I enabled
Device Drivers -> Network device support -> Ethernet driver support “Realtek devices” in the kernel (*) and “Realtek 8169 gigabit ethernet support” in the kernel (*).
I have also a wireless interface which is a Atheros Wireless 802.11n. So I enabled Device Drivers -> Network device support -> Wireless LAN -> Atheros Wireless Cards and enabled the Atheros 802.11n wireless card support with all the sub options.
That did the trick for the wired ethernet at least. Will try the wireless when I have a desktop to start.