Skip to main content

Linux Related Tips

Computer programs are fun to write, and well written computer programs of fun to read. One of life's greatest pleasures can be the composition of a computer program that you know will be a pleasure for other people to read, and for yourself to read.
Computer programs can also to useful work. One of life's greatest sources of satisfaction is the knowledge that something you have created is contributing to the progress or welfare of society.
Some people even get paid for writing computer programs! Programming can therefore be triply rewarding - on aesthetic, humanitarian, and economic grounds.
Donald E. Knuth

Some Linux Related Tips

  • Migrating to UEFI
  • Using an Epson Multifunction Printer on OpenSuSE Leap
  • Installing the G'mic plugin for Gimp on OpenSuSE Leap
  • Installing the Resynthesizer plugin for Gimp on OpenSuSE Leap
  • Silencing the Windows key (EnduraPro keyboard)
  • Undoing Unzip
  • Correcting a TeX Type 1 Font Mess
  • Having NumLock switched on by default

Migrating to UEFI

After almost 19 years of repeatedly updating and occasionaly copying my (formerly SuSE, now) OpenSuSE Linux from one harddisk to another, the point arrived where switching to UEFI was unevitable.

I must admit that I failed in getting grub2 to properly install. As a last resort, I installed a current OpenSuSE on my new disk and discarded anything but the /boot directory – shame on me! Then I copied my old installation. The only thing left was to make an entry for the efi partition in /etc/fstab.

UUID=ABCD-1234 /boot/efi vfat umask=0002,utf8=true 0 0

What I learned afterwards: OpenSuSE places several large files into the efi partition, so if you have a chance, you should make it larger than the minimum 100 MB.

Using an Epson MFP on OpenSuSE Leap

Buying a printer for use with Linux ist unfortunately even in 2019 not a no-brainer. As if it was not hard enough to decide between distinct printing technologies and distinct vendors and to find a balance between printer costs and costs of consumables, you really have to look hard for compatibility. I chose an ink printer this time, and I did not want a device that comes with software that clutters my screen and shows nagging messages and phones home every time I print something, so the choice was somewhat limited.

Epson offers Linux software without support for its printers and multifunction devices. As the scanning software is partially proprietary and does not contain all the source code, you can not be sure that it will run on your next distribution. For printing, it helps to buy a more expensive device that emulates PCL and PostScript. Epson will charge you about a hundred bucks more for this than for its corresponding GDI devices (e.g. for a WF-C5790 instead of WF-C5190). Apparently, Epson uses GhostScript instead of real PostScript, but I did not discover any disadvantages.

For printing, I used the .ppd.gz file from Epson with CUPS. There was no need to tweak anything.

The scanning software for OpenSuSE comes as an RPM, so installation ist quite easy. There ist scan support in your favorite graphics software (GIMP) via SANE, and there comes a standalone tools that produces multi-page PDF. What did not work out of the box for me was changing the scanning resolution. Strange enough, the fix is easy:

Edit the Epson:...drc File for your scanner in the .sane/xsane subfolder of your home directory. Find the line post "resolution-bind" and change the 1 to 0. This is all there is.

Installing the G'MIC plugin for Gimp on OpenSuSE Leap

G'MIC features lots of fancy filters. You should perhaps not try them, it steals all of your spare time.

  • Download the Linux 64 Bit Zip file from gmic.eu. Note: I use KDE, so this is fine.
  • Unzip
  • Copy gmic_gimp_qt to your Gimp plugin folder (see here for finding out, where the folder is).
  • Run gmic_gimp_qt from the command line. If it complains about being a filter for Gimp, everything is fine. If instead it complains about missing libraries, you should install them. My machine lacked libfftw3_threads.so.3. I installed it with YaST.
  • Restart Gimp. G'MIC QT is the last entry in the Filter menu.

Installing the Resynthesizer plugin for Gimp on OpenSuSE Leap

This is probably too trivial to write about, but I'll do it anyway. The resynthesizer is an amazing tool for removing irregularities from pictures, e.g. people, skin defects and so on.

 

  •        Get the sources: git clone github.com/bootchk/resynthesizer
  • Enter the resynthesizer directory you have created and run autogen: ./autogen.sh
  • Take care for missing dependencies: I had to install gimp-devel with YaST and re-run autogen.
  • Run make: make
  • Become root and run make install.

You should be done, but I wasn't. I had to copy the Python scripts from the global Gimp plugin directory to my private Gimp plugin directory. You may lookup the plugin directories by editing settings within Gimp, clicking on the arrow at Folders (left, at the bottom), then plugins. My command was, at last:

cp /usr/local/lib64/gimp/2.0/plug-ins/* ~/.gimp2-8/plug-ins/

Then I had to restart Gimp. Oh, and before you ask: I had deleted pluginrc in my Gimp folder.

Undoing Unzip

Unzipping something into an already existing directory structure is not that easy to undo. Here is a way that works for me:

  • List the zip archive contents to a file:
    unzip -Z archive >remove.sh
  • Remove anything left of the file names from the file. I used emacs, marked the area and then used delete-rectangle. Alternatively, you may use a spreadsheat and the function Data/Text in Columns (I hope it is named like this in English, in german it is called Text in Spalten) with blank space as separator. Then you may delete the first columns.
  • Write rm to the left of the file names.
  • Invert the order of the lines. with emacs, you have to mark all the text and then say reverse-region. This leads to the directories being listed beneath the files contained therein.
  • Find lines ending with a slash. These are the directories. If you know that there will be nothing inside them except your unzipped files, you may change the rm at the beginning of the line to rmdir. If not, you will want to delete this line.
  • Save your file, make it executable and execute it.
    Spreadsheet users may save their file as csv with blanks as field separator.

Some words of caution:

  • Files overwritten by your unzip action are gone.
  • Making typos may have desastrous consequences
  • If you think that you may be still alive tomorrow, making an occasional backup of your data is a good idea, anyway.

Correcting a TeX Type 1 Font Mess

This article deals with complications with the use of unofficial fonts with TeX on OpenSuSE leap.

My System

I am using OpenSuSE (and its predecessor SuSE Linux) for several years. As it was never necessary to setup a fresh system even when mainboards and harddisks got changed (hello windows users, is there any envy on your side?), my system grew and aged. My TeX system now consists of three TDS trees:

  • /usr/share/texmf: The official TDS tree by SuSE
  • /usr/local/share/texmf: TDS tree width my own stuff, e.g. my private letter head, styles, fonts, and packages I use that don't come with OpenSuSE, like the Lucida fonts.
  • /var/lib/texmf: TDS tree for volatile things, e.g. TeX formats.

The transition to use these trees in this way took some time, years ago. If you do not bother to keep your TeX files separated like this: You really should.

Font trouble

Trouble started when I installed the Roboto fonts. It took me some time to have pdfTeX find them. When it finally did, Lucida support was broken, albeit in a strange way: mktexpk automatically generated pk fonts (bitmaps) in type 3 format and included them into the final PDF file. I did not want this. There are pixels visible at higher resolutions, file size bloats. Now to the resolution:

Having changed your TDS trees, you always should run mktexlsr or texconfig rehash in superuser mode to make your TeX system find the changed files. Having installed fonts, you have to use updmap. And this is where the trouble came from.

When you call updmap, updmap will list its config files. The order is quite important. Unless you do something special, updmap will always change the first listed config file. My list looks like this:

/etc/texmf/web2c/updmap.cfg
/usr/local/share/texmf/web2c/updmap.cfg
/usr/share/texmf/web2c/updmap.cfg

The first and third are identical, as OpenSuSE sets a link. updmap understands that the first file is system-wide, so it warns about hidden sys mode. If you see this warning, you may—like me—probably be tempted to run updmap-sys in superuser mode. Unfortunately, this will not help, as updmap-sys will not incorporate things from private TDS trees. The solution is to supply your own updmap.cfg in the command line to updmap and to run it in superuser mode, like this:

sudo updmap --cnffile /usr/local/share/texmf/web2c/updmap.cfg --force
  --enable Map lucida.map

By the way, Kpathsea offers valuable tools for debugging. kpsewhich shows which file will be used, while kpsewhere shows all files with the name you are looking for. Calling pdfTeX with kpathsea debugging (pdflatex --kpathsea-debug -1 >logname 2>&1 filename) shows all the efforts of kpathsea.

It looks so easy, in retrospect, but in fact there had been moments where I was in despair. But even then, I did not consider to edit the font maps by hand.

Having NumLock switched on by default

With OpenSuSE 42.2, you have to use KDE system settings to permanently enable NumLock, /etc/sddm.conf and /etc/sysconfig/keyboard are not working.

Fighting with Akonadi (Kontact/KMail)

For years I have been using Kontact, unfortunately my satisfaction diminished. Recently, Kontact often shows "retrieving folder contents" for a long time, getting duplicated mail headings is quite common, etc.

What I have done so far:

  • Increased cache settings in ~/.local/share/akonadi/mysql.conf, unfortunately with no obvious effect.
  • Did akonadictl restartakonadictl fsck, and akonadictl vacuum often. Sometimes Kontact would work for a while.
  • Ran akonadiselftest. This was helpful in discovering that I had to do mysql_upgrade on the akonadictl database (after all, I am upgrading my Linux installation since SuSe 7.3), as a system table was apparently missing.
  • Upgrading mysql did work the following way:
    • Find out the socket for mariadb. I found a link in ~/.local/share/akonadi/socket-gustav (gustav being my computer's name), following this link revealed the socket in the folder /tmp/akonadi-[...] with the name mysql.socket.
    •   Run mysql_upgrade on this socket: mysql_upgrade --socket=/tmp/akonadi-[...]/mysql.socket
    Unfortunately, this was not enough.
  • Exportes settings and Calendar, unistalled Akonadi, Kmail, Korganizer, Kontact. Wiped configuration files from the platter. Installed again. This seems to help.
    Drawback: PIM Exporter does not export your account settings or mail filters. You have to document and reproduce your work elsewhere.

Silencing the Windows key (EnduraPro keyboard)

My old IBM Model M keyboard finally ceased to work so I had to look for an adequate replacement. Besides the better Cherry models, e.g. G81-3000, there are yet more sophisticated keyboards from several vendors. To keep the original feeling, and as improvement leaves a better feeling than replacement I decided to buy an EnduraPro keyboard directly from Unicomp. The EnduraPro features a pointing stick. This should raise productivity as the right hand has not to leave the keyboard for mouse movements that often. For a few bucks more I could also get some special caps for the windows keys – see photograph. The keyboard arrived within five days. If you consider importing one for yourself, you should take customs duty into account, too.

During the first days, I often got annoyed because I hit the right windows key when AltGr was intended. I first thought it was because the Model M had had no windows keys at all. But looking at keyboards at work I found out that I was wrong: All keyboards I have to deal with have (left to right) space bar, AltGr, Windows key, menu key, the EnduraPro has Windows key, AltGr, menu key. Nasty. If you do some programming, you need the AltGr key over and over again. No wonder I kept hitting the windows key.

The windows and AltGr keys are not equally wide, so simply swapping them is not an option. So I decided to map the right windows key to something less distracting than calling the system menu. I had to learn that on my OpenSuSE Leap KDE desktop, tips for using xmodmap just do not work. KDE system settings did the trick. In KDE system settings, you can only choose between several common remappings, you are not as free as with xmodmap, so I mapped ‘compose’ onto the right windows key.

For MS Windows, there is a registry entry to remap keys – see here. This is not comfortable, but it works and you do not have to install any additional software. Besides, it works on any current windows version. I decided to make the right windows key useless there. This does not help against hitting the right windows key by accident, but at least focus is not lost.