Moving to CentOS 7

CentOS is a nice and stable distribution, suitable for the strategy described below. Debian stable could be an alternative, but a nice thing about CentOS is that it has stable system-critical software in its base repositories, but additional (and distinct) packages are available from epel, while in Debian everything's mixed.

OpenSUSE might be a nice alternative as well, and that's what I was using before, but collected some unpleasant experience during that time, so moving to another system in hope that it'd be nicer here.

Also, I don't like to spend days on configuration (or use a non-configured system), so relatively long lifetime of CentOS releases is a good thing for me.

Update (June 2016): perhaps it was a mistake, Debian seems to be generally nicer.

1 Preparation

  1. Prepare some space in the beginning of one of disks, or prepare to reconfigure the existing loader.
  2. Export GPG keys: I forgot to do this, but never actually used them, except for letters to myself, so generated new ones; though probably it'd work to just copy .gnupg.
  3. Save playlist in some easily editable format (e.g., xspf; though xspf will lose .cue information, but I haven't found a way to preserve it).

2 Initial installation

It's pretty simple and intuitive:

  1. Download CentOS: I've downloaded the "LiveGNOME" version, to poke it before installation, and to have a "rescue USB stick", just in case.
  2. dd if=CentOS-7-x86_64-LiveGNOME-1503.iso of=/dev/sde; sde is a USB stick, obviously.
  3. Reboot, boot from the stick.
  4. Poke it, install.
  5. Reboot, boot from the target disk (or set it in an old loader).

There's a nice graphical tool for partitioning during installation, where Btrfs and encryption are supported. The installer itself is very nice and simple to use.

3 Fixing

3.1 Sound

The first problem I've noticed was sound: apparently it was because of a glitchy jack detection (described better here), and solved by changing HD to AC97 in BIOS settings.

When using Clementine, sometimes Firefox will mute it. The only way I've found to fix it is to restart Firefox. If it becomes very silent, the problem may be in GNOME per-application sound settings.

Pulseaudio is used in the default installation, so some things should be fixed there – like disabling flat volumes in /etc/pulse/daemon.conf.

3.2 Video

Don't Buy From ATI - enemy of your freedom – RMS

Nvidia, Fuck You! – Linus Torvalds

I have GeForce GTX 660 here, so it's about Nvidia. Initially I was going to try nouveau (it gets installed by default), but then I had to reset the computer a few times, because of very strange and visual glitches; turned out that they were caused by nouveau. Installing the proprietary driver helped, here's an instruction (and there's also more on CentOS 7, pretty nice guides; and other things, too).

Warning: once the kernel will be updated, it would be required to rebuild the driver as well; otherwise there will be the "oh no!" message after boot (update: apparently they happen randomly, even with a rebuilt driver), with related errors in the Xorg log. I'm finding it more handy to boot without X all the time, and recompile the driver when required (an updated kernel should be used on driver update, btw); here's how to boot without X.


3.3.1 Start menu

If you happen to use GNOME, its menu will die from time to time. It is a known bug (1, 2), but apparently it's not going to be fixed soon (it's there for 4 months now).

Updating line 77 in /usr/share/gnome-shell/extensions/apps-menu@gnome-shell-extensions.gcampax.github.com/extension.js by replacing event.get_time() with -1, and then Alt+F2 and "restart" to restart gnome shell and reload that extension. Though probably it's not a good idea to use a DE that relies on buggy JS at all.

3.3.2 Keyboard layouts (update, June 2016)

After the recent update, GNOME is quite unfriendly to alternative keyboard layouts: you either enjoy things like left arrow key, but give up on keyboard shortcuts in some programs (not sure why they work in some and don't in others), or set the layout with xmodmap and back to qwerty in GNOME. I'm not sure if the few features it provides are worth all the trouble; perhaps setting a tiling WM without any DE would be easier and nicer to use.

3.3.3 Tracker

Tracker is a weird thing that loads CPU and disk I/O, and is supposed to track your files. That alone is a good reason to avoid GNOME, but if you happen to use it already like I do, tracker-preferences is supposed to help to disable it. Alas, it gets killed with no error message when trying to remove indexes with it, but it can change some settings, at least, and mostly disable that horrid thing – though a bunch of processes would still hang. tracker-control -r helps to kill its currently running processes, and to cleanup the indexes (probably that's how tracker-preferences gets killed).

Apparently it runs via /etc/xdg/autostart/ (along with a bunch of other useless things), so it should be disabled using that autostart functionality.

3.3.4 GVfs

Nautilus is somewhat convenient in combination with GVfs if you don't bother to fill /etc/fstab manually and to mount USB sticks with mount, but apparently gvfs makes it to lag (or at least did in 2014; actually that solution doesn't seem to work on CentOS now). I don't know how to solve that, would have been easier to avoid GNOME altogether and to mount stuff manually.

3.3.5 Sound control

For a while I thought that it's one of the few things that work properly and nicely, but it's not. The fancy control that allows to change sound level with a mouse wheel would just jump sometimes if you are trying to control it with a wheel (and makes sounds when you click), making the sound very loud (or silent, but that's not that bad – unexpected loud sound is far worse). I guess the hardware equivalent of that would be giving random electric shocks to users. Or just catching fire, as actual hardware does nowadays.

I'm tired of debugging, just switched to alsamixer. Controls are poor there, but it works without such surprises.

3.3.6 Broken input

Once it ceased to pass input events to programs. I've ended up rebooting, didn't figure what it was.

3.4 DNS

Network worked fine out of the box here, but my default (ISP's) DNS are rather slow (or maybe it's a router issue; too lazy to debug). I'm generally trying to avoid Google DNS, so here is a list of "alternative" DNS. But it's not enough to write them in /etc/resolv.conf: NetworkManager would rewrite that. It helped to add those via GUI, in "Network Settings", and to turn "automatic" off.

A somewhat better approach, which I've started using later, is to set bind locally (yum install bind and systemctl enable named to enable it): by default it's caching (hence name resolution is often faster) and uses root name servers. And it's nice to have control over the DNS server you are using.

3.5 Boot errors

Right before a login screen, one may observe a pyudev error akin to RHEL #1263363. The issue of which it is a duplicate is hidden. It doesn't seem to be critical (if you don't care about the looks of it), and doesn't appear in logs: only shows up before a login prompt.

4 Strategy

There are stable versions, and there are fresh versions of software.

CentOS repositories provide stable versions (and a bit less stable from epel), releases provide recent versions, and DVCS (git/mercurial/etc) repositories provide latest versions.

I'm inclined to install stable versions of things I don't even follow changelogs of (e.g., music player – I don't really care which one to use, or libraries that I install only because of dependencies), recent versions of things I work with (emacs, language compilers/interpreters, texlive), and "HEAD" versions of the things I follow.

Another thing to decide is whether to install emacs/haskell/tex[/perl/python/etc] packages from system repositories, or from their own repositories. The former gives centralized updates and could be required in case if something else from those repositories depends on those packages, while the latter provides access to every package, and to fresh versions of those, so I'm usually picking the latter (and of course the latter, if the base program is installed manually). The former might be nicer if one doesn't actually use those languages (and language-specific packages), but needs them as dependencies.

Though one should also keep in mind things like this:

> @cpan
<centbot> Using CPAN on CentOS is a wonderful way to wreck your
system. CPAN does not play nicely with the packaging system. Please
use EPEL or other trusted repos to install packaged PERL
modules. Please see
http://wiki.centos.org/AdditionalResources/Repositories for more
information on 3rd-party repos.

5 Initial software and configuration

5.1 NTFS

ntfs-3g provides NTFS support, just installing it from the repositories.

5.2 Emacs

In order to complain in IRC during the installation, one of my first goals was to install Emacs. It's one of those programs which I'm building manually; most of the depedendencies (except for a gif library) are available from standard repos, so it's relatively easy – just requires to pick exact names of packages.

Not going to describe Emacs packages installation and configuration here, but nothing in the system appears to interfere.

5.3 Various other things

Git, bitlbee, and other common programs are in repositories, too (update: the git version is old, 1.8, while e.g. magit only works with 2+ nowadays – so that should be installed manually). In epel, if not in base.

I've used ktorrent before, but going to try transmission this time. It's available from epel. Update: it works, but doesn't behave perfectly (probably buggy, not sure), and doesn't provide much of information on what's going on..

It seems that not many music players support/handle .cue, but Clementine does. By the way, Clementine comes from the nux-dextop repository, and something goes wrong in dependencies (yum complains on update) if it's installed together with amarok (or maybe the problem is just in amarok + nux; anyway, it helps to remove amarok together with its dependencies: clean_requirements_on_remove=1 in /etc/yum.conf).

If static pages appear to move a little in Firefox, it might help to turn smooth scrolling off. If parts of pages blink after loading, and/or scroll jumps sometimes – there is a solution, too. Then FF just lags a bit, instead of that flickering; also, smooth scrolling can be enabled again with it.

5.4 Media

Here's a short tutorial; it's pretty simple (though have not tried to install the flash plugin, but audio/video codecs are fine).

6 Nix, Haskell, Idris

If you just want to get a running Haskell environment on NixOS quickly, give up now. Throw your computer in the garbage and go live in the woods. The following command is a lie and will not work, because the Nix developers are a bunch of special snowflakes that don't do anything in the standard way.

Nix wiki

I was going to try Nix here. Well, tried it before a bit, but was going to try it for Haskell development this time; usually using cabal sandboxes, but it's not that nice, and doesn't always work easily (e.g., Yesod is a pain to run on haskell-platform, which is one of the reasons why I tend to use snap framework for web).

After spending hours on failing to install Idris (git version) that way, as well as to use Nix for Haskell from Emacs, I gave up and tried to use it just to install programs (ghc, cabal, etc), and use them in the regular way (with sandboxes, that is). Took me a few more hours to give up on that as well (strange linking issues, which I had no idea how to debug). It seems it could be a very nice system for Haskell development, but I'm not patient (or motivated) enough, so just gave up on Nix, and installed The Haskell Platform manually. Idris installation (the git version) went smoothly as well, together with corresponding emacs modes from melpa.

Update: Tried Nix once again.

Update #2: Not using The Haskell Platform anymore (perhaps since early 2016): it's much nicer to just set GHC and cabal-install. Seems like it's a general pattern that the things that are supposed to make life easier actually do the opposite.

Update #3: And partially back to the minimal version of Haskell Platform, since it's a pain to install plain GHC on CentOS 7.

7 Xmonad, almost

One of the new things I was going to try is Xmonad: poked it a bit before, tiling WMs are nice, and it could be configured and extended in Haskell, which is neat.

So, another thing I gave up on – to build Xmonad in a sandbox, in a way that would allow to --recompile it. It should be possible, but, again, depends on familiarity + patience + motivation, none of which I had enough, and ended up installing it without a sandbox; probably will regret later.

7.1 GNOME 3

I have not used GNOME much before, just switched to it this time, after KDE's leaking kded4 and crashing plasma-desktop (many times I've heard, and keep hearing the words "plasma doesn't crash anymore", but it keeps doing that). It was possible to integrate Xmonad into GNOME before, reusing GNOME panels, but replacing its WM, but apparently isn't now. It also might be tricky to provide a "session" choice for xmonad, but here is a working solution I've found by trying different ones (the "alternatively" part). So, here's my /usr/share/xsessions/xmonad.desktop:

[Desktop Entry]
Comment=This session starts xmonad

Still have not found how to mount disks on access (e.g., from nautilus; though perhaps it's better to just use fstab). Maybe xmonad-contrib will help, but its build is broken right now, so postponed it.

7.2 Other programs

Installed xterm, dmenu, xorg-x11-apps from system repositories. Probably will install xmodbar after.

7.2.1 Xterm customization

Here's a nice theme. To set nicer fonts, add:

XTerm*faceName: DejaVu Sans Mono
XTerm*faceSize: 11

Update: I've put some things, including an xterm theme, into a dotfiles repository.

7.3 Postponing

A few weeks later, I had too many things open to kill the session, and switching to xmonad and back leads to glitches, so it's for some other time.

7.4 Update: i3

Using i3 on my netbook now, perhaps will use it on desktop someday. It's nice, and a working/usable WM is better than a nicely configurable but not used one. Though the colors are screwed there (apparently hardcoded RGB value for red, on black background in its bottom panel, i3-bar or something).

8 TeX Live

Manual installation is straightforward. An older version (2012, the current is 2014) is present in the repositories, but it's old and could lack some packages.

I'm using the minted package, which requires Pygments, and there's an old Pygments version in repositories. But I'm using Python for work anyway (update: yay, not using it anymore), so installed it manually, and then pip3 install Pygments.

Don't forget to cleanup old cache, if it is present, and then everything works.

8.1 Ghostscript

Somewhat related: for a while ghostscript (used in particular by auctex's preview-latex) worked fine, but then ceased to after another update. So, I've built it manually, too; it still reports version 9.07 (and I can't remove that one because too many things depend on it), but works, as well as preview-latex.

9 GPG keys

Just gpg --gen-key to generate a key, and it'll be available from e.g. mail clients at once. Then gpg --export --armor <email> to get a public key, and to give it to your imaginary friends.