Linux

Monit: empty config

Zum Thema "seltsame Fehlermeldungen, deren Inhalt nicht zur Lösung des Problems beitragen" habe ich heute morgen mit Monit etwas meinen Spaß gehabt.

Ich wollte eigentlich nur den Service neu starten, doch plötzlich – so beschwerte sich Monit – war mein Config-File leer?

rian@thiasos:~$ service monit restart
* Stopping daemon monitor monit                [ OK ]
* Starting daemon monitor monit
empty config, please edit /etc/monit/monitrc.

/etc/monit/monitrc mit dem Editor geöffnet, doch da sah alles normal aus.

Es folgte etwas Rätselraten und Fehlersuche. Dabei war die Lösung eigentlich sehr einfach, und im Nachhinein ärgert man sich fast, dass einem so ein Leichtsinnsfehler unterlaufen musste: sudo vergessen.

rian@thiasos:~$ sudo service monit restart
[sudo] password for rian:
* Stopping daemon monitor monit                [ OK ]
* Starting daemon monitor monit                [ OK ]

Na also, wer sagt's denn. Wäre die Fehlermeldung aber irgendwas mit "keine Berechtigung" gewesen, statt "leere Config", wäre man sicher schneller auf die Lösung gekommen ...

SSH Agent vs. Gnome Keyring ... und wie man es wieder zum Laufen kriegt

Seit ein paar Tagen bekam ich beim Versuch, meine private Keys dem SSH-Agent hinzuzufügen, eine Fehlermeldung, dass mein SSH-Agent damit irgendwie Probleme hat. Das ganze sieht in etwa so aus:

rian@thiasos:~$ ssh-add
Enter passphrase for /home/rian/.ssh/id_ecdsa: 
Error reading response length from authentication socket.
Could not add identity: /home/rian/.ssh/id_ecdsa

Ärgerlich, doch ich hoffte, im weiten Internet eine Lösung zu finden. Aber Lösungsvorschläge waren recht dünn gesäht, das einzige, was ich auf die Schnelle fand war ein (schlechter) Workaround, nämlich

eval `ssh-agent`

in der Konsole einzugeben. Das startet einen (weiteren (echten)) SSH-Agenten und setzt die nötigen Umgebungsvariablen. Dann funktioniert danach zwar das ssh-add, aber sobald man eine neue Konsole aufmacht sind diese Variablen natürlich nicht gesetzt und es funktioniert wieder nicht mehr. Nicht so toll.

Ein Kollege hat mich nun gestern im Gespräch darauf aufmerksam gemacht, dass dies wohl daran liegt, dass upstart beim Anmelden gnome-keyring startet (übrigens obwohl ich KDE benutze), das dann auch als SSH-Agent fungiert und den "echten" ssh-agent überschreibt. Und gnome-keyring kommt offenbar mit manchen Schlüsseln nicht klar.

Darauf hin habe ich in meinem System versucht rauszukriegen, warum seit kurzem gnome-keyring meint, auch als SSH-Agent einspringen zu müssen, und vor allem, wie man ihn daran hindert. Mit einem

rian@thiasos:~$ dpkg -L gnome-keyring | grep upstart | grep ssh
/usr/share/upstart/sessions/gnome-keyring-ssh.conf

wurde gleich klar, was ihn startet. Man kann die Datei nun entweder löschen, oder umbenennen (es reicht, wenn die Endung nicht mehr ".conf" ist), aber das finde ich nicht so sauber. In der Datei selber steht auch, wie man ihn sauberer daran hindern kann, was eigentlich ganz einfach ist. Man erstellt in seinem Home-Verzeichnis eine Datei mit dem Namen

~/.config/autostart/gnome-keyring-ssh.desktop

und folgendem Inhalt:

[Desktop Entry]
Type=Application
Name=SSH Key Agent
Comment=GNOME Keyring: SSH Agent
Exec=/usr/bin/gnome-keyring-daemon --start --components=ssh
OnlyShowIn=GNOME;Unity;MATE;
X-GNOME-Autostart-enabled=false

Wichtig ist vor allem die letzte Zeile.

Dann einfach einmal ausloggen und wieder einloggen, und der "echte" ssh-agent wird nicht mehr vom gnome-keyring-daemon überschrieben und alles funktioniert wieder wie gewohnt.

Wer es nicht nur für den eigenen Benutzer ändern will, sondern systemweit, der sollte in /etc/xdg/autostart/gnome-keyring-ssh.desktop schauen, dass X-GNOME-Autostart-enabled=false in der Datei enthalten ist (bzw. true auf false ändern).

Ist Windows fleißiger als Linux? Oder warum ein unbenutzter Computer sich zu Tode rechnet ...

Ich habe das "Glück", bei der Arbeit zwei Computer benutzen zu müssen dürfen. Einmal Windows, einmal Linux. Der Windowsrechner wird benötigt, um ins firmeneigene Intranet zu kommen und um meine Firmenmails zu lesen. An dem Linuxrechner wird gearbeitet und programmiert.

Das kuriose dabei ist nur, dass am Windows-Laptop ständig das Festplattenlichtlein flackert, Windows also ständig irgendetwas auf die Platte schreibt oder davon liest. Auch die Auslastung von 4 (vier!!!) Prozessorkernen im Ruhezustand ist äußerst beachtlich (siehe Abbildung oben). Als das Bild gemacht wurde, war der Computer seit einigen Stunden eingeschaltet, aber kein einziges (ich wiederhole: kein einziges) Anwendungsprogramm läuft. Kein Mailprogramm, kein Browser, kein Office, kein gar nichts - außer eben dem Prozessmonitor, aber der auch nur um es zu demonstrieren. Den Rechner habe ich seit 8 Tagen und als ich ihn bekam war er neu und hat nur das firmeneigene Standardimage. Keine Dienstleichen oder dergleichen vorhanden, da ich in den 8 Tagen außer Outlook und Internet Explodierer Explorer nichts gestartet habe.

Zur gleichen Zeit auf dem Linux-Laptop, während viele Programme gestartet sind und an denen gearbeitet wird: Firefox, Thunderbird, Skype, Eclipse und dazu noch ein laufender Amarok (MP3-Spieler), von eigenen Mailserverdiensten und Webserverdiensten ganz zu schweigen, dazu noch einige große Datenbankendienste:

Fast keine CPU-Auslastung.

Daher: Was um alles in der Welt macht Windows, wenn es eigentlich nichts macht???

Tethering from your Nikon to your Linux PC

If you're using Windows, you can buy some software from Nikon to have Photo Tethering (I guess it's called Tethering). I.e. you take a picture with your camera and it pops up on your computer screen. It's used in studio photography and very useful. I missed it very much during the last three days of product photography.

I wanted to have that on Linux as well. There is an excellent library called gphoto2, that can do half of the trick (i.e. it can download a picture right after the shot), but it can't display it. So I played around a little bit and wrote that script:

#!/bin/bash

case "$ACTION" in
    download)
        pkill qiv
        qiv -l -f -m "$ARGUMENT" &
        ;;
    "")
        me=$(cd ${0%/*} && echo $PWD/${0##*/})
        gphoto2 --capture-tethered --hook-script=$me
        ;;
esac

To "install" it, place it somewhere on your path.

To use it, connect your Nikon camera to your computer via USB. Go to an empty folder in a shell and just start it:

rian@thunder:~Pictures/example$ tether

Then take pictures. They will be displayed on your screen and stored in your current folder.

For this to work, you need the image-viewer qiv (or use any other viewer and adjust the script) in its most recent version (older versions don't support the -l switch which autorotates the image), if you're using ubuntu jaunty, you need to install qiv from karmic.

And you have to install gphoto2 to access the camera as well.

Solution found: nvidia 180 dkms build failed

I couldn't switch to 2.6.28-13-generic Kernel on jaunty because the nvidia graphics driver kernel modules couldn't be compiled by dkms:

Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/dkms
* Running DKMS auto installation service for kernel 2.6.28-13-generic
*  nvidia (180.44)...nvidia (180.44): Installing module.
.....(bad exit status: 6)
Build failed.  Installation skipped.


Today I finally had time to inspect the problem, and found out the reason, and a very simple fix as well. This happened because "patch" wasn't installed.

So, typing those two commands fixed all problems:

sudo apt-get install patch
sudo dpkg-reconfigure linux-image-2.6.28-13-generic


In case anyone is stuck in the same place, try it out and let me know if it worked ...


Using Linux. A resume.

It must have been around 1996 when I became very curious about that Linux thingy. Back then, computers at home where still quite uncommon, and Linux not as popular as it is today. I read some Linux magazines, and finally bought a Slackware Linux on (many) CDs and installed it.

I was quite experienced with using and installing Windows and even DOS, because I had my first computer when I was very young and Windows didn't even exist, neither did Linux. But all my experiences with DOS and Windows were useless while installing and using Slackware Linux. Some things didn't really work (my fault), and I was examining and messing around with everything without really knowing what I did, so I installed and destroyed it many times. But at that time it was just out of curiosity. I never used it productively or worked on it.

In 1997 I met Ray, and we rented a nice office together with two other friends, and we created custom-taylored software solutions for different companies. By the way, Ray is also the one who made me learn Perl. I'm thankful for all eternities he made me learn it, and thus becomming a very advanced perl guru. He also introduced me to SuSE Linux which we were using on all our computers at the office.

Then I bought my first laptop computer. It was a used one and it had Windows95 pre-installed when I got it. But at the office the first thing I did was installing a SuSE Linux as the sole operating system on it. It must have been version 5.2. Back then there was no OpenSUSE, and I bought some releases and spent some money on it. You know, back then there was no high speed internet at home, downloading a Linux CD would have lasted many hours or even days. You had to buy CDs. It was not that I used Linux because it doesn't cost anything like it does nowadays, I used it because I was curious and knew it is more powerful, and I was willing to spend some hundred dollars on SuSE releases and books. But my private desktop PC at home was still mainly running Windows.

Then I went to university and got a ReadHat release as a gift at a RedHat event. I installed it at home, but not really liked it. At the same time somewhere at the end of 1999 I got hold of a Debian GNU/Linux, and it was just amazing. Setting it up was more difficult than with SuSE or RedHat, but its structure was clearer, its package management is superior to all others, and the Debian community was really free. There wasn't a company in the backround that pulled the strings and wanted to earn some money out of it like with SuSE or RedHat. I also tried many other distributions since then (Mandrake, Caldera, Turbolinux, Gentoo, ...), but Debian was just the bestest (sic!).

During college on a side job as administrator at a boat cruise vacation company, I had the task to test if the 50 workstations in the office can be switched to GNU/Linux because it is free (as in free beer). For me there was no doubt, it has to be Debian, but I just found a brand new distribution called Ubuntu. I tried its current release, which was also the first Ubuntu ever released. I couldn't see a big difference to Debian, so I rather sticked to Debian and tested that. But my boss decided to stick with Windows and throwing his money down the drain.

However, I still had my old Laptop which only had GNU/Linux on it, and a dual boot PC at my desk at home which didn't boot into GNU/Linux often after I saw Windows XP, which I liked at that time. For all the years I had a dual boot with Debian, but hardly used it. All work was done on Windows, and in 2005 I removed the Debian partition to get more space. I was a Windows guy all over again. Well, not to mention the MacBook I also own that runs OS X.

But then there came Windows Vista (which I really hate(d), by the way), and a new job with a Ubuntu workstation. And Ubuntu is just great. Beeing an offspring of Debian, it has all the features that I loved in Debian, but doesn't have the issues I had with Debian (quite outdated software versions in the stable release).

September 2007 after bravely using Vista for 6 weeks on a new computer, which really sucked big time (Vista sucks, not the new computer), I decided to replace Vista with Kubuntu GNU/Linux and use it exclusively. It was easy to set up, actually much easier and faster than setting up windows. And also MUCH easier than setting up other Distros (believe me, I've been through many GNU/Linux installations before, but no other was remotely as smooth and painless as this). But it was the first time in my life where I really used GNU/Linux for everything, not having a Windows as a backup.

So, now it's been about 16 months with only GNU/Linux, both on my desktop PC and my new laptop PC (and even on my cell phone). The first few days after the cut were hard, I had to learn many things from scratch. And learning a lot about new applications for different tasks. But here's my resume for the last 16 months with GNU/Linux:

  • The first few days were difficult. I was on cold turkey. But I didn't regret switching to GNU/Linux for a single second. The only thing I'm regretting quite often is that it took me 10 years from my first contact with GNU/Linux to using it exclusively. I always knew it's the better thing, but I always found a fake reason for not switching.
  • If you're in the same situation like I was: Just do it. Switch to GNU/Linux. And never look back.
  • There are many people who want to make you believe that you have to be an computer expert to use GNU/Linux. Well, it might have been true a while ago, but currently any noob can install and use it. In fact, if I needed to set up a computer for granny who has never used a computer before, I would use GNU/Linux and tweak it for her. Yes, I can do it, I can make it suitable for retired old people. I can do it because GNU/Linux gives me the freedom and the opportunities, not because I'm uber-smart. And I would know it would be a loyal and indestructable companion for her. She couldn't destroy it by clicking on a wrong button, and I know she wouldn't catch a virus, a trojan horse, a dialer, or whatever. And I know it would just work.
  • When I sit at a Windows Computer now (at friends), I get angry very fast. I'm not used on to the restrictions and uncomplete functionality anymore. During everything I do I think "this task would be SOOO easy on a Linux box". I can't believe I was able to endure this immature and lame Windows for so many years. I can't believe anybody else can. Well, maybe every Windows user endures it because he doesn't know how easy it could be done otherwise...
  • GNU/Linux does many things different. And you need to learn a little bit about it before you can benefit from its advantages. But its worth the effort. Totally.
  • I like that everything just works without installing additional drivers. Since I use Kubuntu I have real plug'n'play. Printer, webcam, SLR, mass storage devices, cell phone, bluetooth sticks, ISDN fax, UMTS networking, whathaveyou. I stick it in and it just works. Period. I don't need the driver CDs anymore that come with every product. I know, not every hardware works with GNU/Linux. But I've been lucky so far--and I tried many different devices. They all just worked. Many of those didn't work on vista though. Not even after installing their drivers manually.
  • I love the package manager (apt). Installing and removing software has never been easier. And no matter what software I need, it's always the same way to install it and to remove it again. Couldn't be simpler. I love that my system keeps itself up to date with the package manager. It fixes all vulnerabilities automatically and usually just a very short little while after they become known. And by upgrading the software automatically I can be sure to have a recent system with all components working together without any problems. And all this for the operating system itself, and also for all applications that I've installed. I love it, love it, love it.
  • Don't expect GNU/Linux to be a substitute for Windows. GNU/Linux is another philosophy. GNU/Linux is all about freedom and choice. Many can't imagine or understand what this means. I didn't either. But now I know, I've seen the light. And I see restrictions and contraints in proprietary products everywhere. And I can't any longer understand how they're getting away with it. I can't understand why a company should decide what I can or can't do. Shouldn't this be my descision?

Back to stable

Do you know how it feels when you come home after a long time, when some of your friends got married recently, and the neighbors refurbished their house? It feels strangely familiar and yet unfamiliar at the same time. Well, I have that feeling with my computer right now.

I wrote in my last post that the days of Pearly Spencer VistaTM will soon be over. Too many times I had to reboot the entire thing. So, last weekend there was the showdown. This is my first post I'm writing on my Linux Computer.

Jebus, Linux has changed a lot since I last used it at home a while ago. I mean, my computer at work is a Linux PC, but it hasn't any cool features switched on, and our administrator configures everything. But at home, back then it took me days to get my sound card working. More days to get my printer working. Weeks to get my scanner working. You get the idea. In the beginning when I was a novice, each change in a system setting required lots of googling, reading, trying, praying, and confusion. And, to be honest, windows looked more beautiful.

Well, things have changed a lot since then. I had a running system (printer, webcam, soundcard, etc.) in less than an hour. It configured all devices itself, I didn't do anything. It looks cool, doesn't crash, is easy to maintain, fast, and much fun. And it feels like coming home after a long while.

Here's a video of how it looks. I'm amazed. I'm sure I will switch off some of the effects after a while. I think they will get annoying after a few days. But currently I enjoy them. Say hello to my new love...



I didn't create this video, I just found it on youtube to give you an impression how Linux looks today. By the way, the video calls the composition manager "CompComm" as this is a early preview. Now they found their real name, it's "Compiz Fusion".