L'uso di questo sito
autorizza anche l'uso dei cookie
necessari al suo funzionamento.
(Altre informazioni)
Showing posts with label fedora. Show all posts
Showing posts with label fedora. Show all posts

Thursday, September 22, 2016

Building emacs 25.1 on Fedora Core 22

I am not (no longer) a big fan of OS updates (and the grueling work of picking up the pieces of broken stuff the usually comes after that. So it is not unusual, for me, to be lagging 2-3 major releases behind my distro of choice. I am currently at Fedora Core 22, while the world runs at FC24 speed.

Now, however, emacs 25.1 is out, and a birdy is telling me it won't be built for FC22. Few choices but to build it myself (I'd already done it back in FC15 days): it turns out that it is pretty staightforward on my main box:

    #  wget http://mirror2.hs-esslingen.de/fedora/linux/updates/24/SRPMS/e/emacs-25.1-0.3.rc2.fc24.src.rpm
    #  dnf builldep emacs
    #  dnf builddep emacs
    #  sudo dnf builddep emacs
    #  rpm --install emacs-25.1-0.3.rc2.fc24.src.rpm 
    #  cd ~/rpmbuild/RPMS/SPECS/
    #  dnf install webkitgtk3-devel
    #  rpmbuild -bb emacs.spec 
    #  cd ../RPMS/
    #  dnf update */*.rpm


Friday, October 18, 2013

Ooops! I did it again. I threw SELinux in the trashcan.

So, once again, I crashed head on into  SELinux's "user experience". And, once again, it sucked.

I keep SELinux enabled on my workstation in order to be, now and then, reminded of its existence and to see if it becomes by any chance usable, as I disable it on all production machines.

Yesterday,  I needed to test a milter that I am modifying for sendmail, and I needed to do it on my machine. It was a thoroughly joyless experience.(Note: I have been doing this kind of stuff for the last twenty years or so. Some would say I should know better by now).

As soon as I fired up the daemon and hooked it to sendmail, sendmail began spewing "Permission denied" messages all over the log file, complaining about being denied access to the socket that it should have used to communicate with the milter.

I entered Google frenzy, and after a while I began homing in on a SELinux problem.

I used yum to install a couple of other milter packages (which worked fine), and ran 'ls -Z' on the corresponding files to check their context (under SELinux, you can forget to get the whole permission story with ls -l. Ain't that nice.) I then used chcon on the files of my milter and  made the context identical to the ones of the working milters, as advised as a workaround by a smattering of bug reports peppering the net. Guess what? Didn't work. I eventually ran into a situation where SELinux was not allowing me to chcon the involved files anymore. This means that you (as root) are not allowed to change the permissions/context of a file (which you may well have created and own)  because of the context it has (context which you may well have set on it). What one has to do in that situation, beats me - I also no longer care, as it will be clearer later.

But wait! Why did I have to google my problem in the first place? Surely SELinux provides plenty of logging help to its hapless victims. NOT. (And if you believed that, would you be interested in some Florida real estate?)

SELinux writes bubke to log files, any log file. And the permission errors it causes are indistinguishable from the regular garden variety. What would signal that something is wrong with SELinux is a separate daemon, called auditd, which is endowed with the following properties:

  1. It requires you to be aware of its existence. SELinux is very happy to run stealthily without it. 
  2. Of course, auditd won't write in a mundane place like /var/log/messages. It writes in its own private log, which - in my distro, Fedora 18 - is also whisked away under /var/log/audit/. God forbid that you 'grep' it by mistake and be overwhelmed by information.  
  3. It has to be running. Which it would be, by default, except the latest upgrade somehow disabled it (sheesh).
  4. It runs an advice wizard that sort of tells you how to get a fix. Which is nice, but it requires you to be logged into a graphical shell (AND to be running the appropriate applet). So it is less than ideal if you plan to deploy SELinux on a server, but hey, that is a loony idea in itself, right?

I turned the auditd machinery on,ran the applet, noted its advice, applied it. So after four hours of  "development" I found myself  as good as when I started. All I had achieved to this point was changing this message: 

Milter (smf-sav): open /var/run/smfs/smf-sav.sock failed: Permission denied

into this pair of messages:


NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line 1693: Xsmf-sav: local socket name /var/run/smfs/smf-sav.sock unsafe: Permission denied
/etc/mail/sendmail.cf: line 1693: Xsmf-sav: local socket name /var/run/smfs/smf-sav.sock unsafe: Permission denied


What fun.

So, in order to preserve my sanity, I set SELINUX=disabled in /etc/sysconfig/selinux and reebooted.  When the machine rebooted, I was staring at the same messages as above. However, while I was looking for a suitable sledgehammer to take to the monitor, I  suddenly remembered that "local socket name is unsafe" is a profoundly brain damaged  diagnostic that sendmail issues in several circumstances. For instance, the message is issued when the file does not exist. I started the milter, it created the file and I was sort of back in business (I actually went home).

So, what had (probably) happened, was that the fix suggested by auditd had worked, but by that time the milter had for wahtever reason gone awy and the relevant files had been removed (I may be to blame on both counts, God knows I wasn't completely lucid at that point).

So once again SELinux is off my workstation, and I don't seeit coming back any time soon.

I am sure that SELinux apologists will point out several flaws in my behaviour and conclude it's all my fault.
Off the top of my head:
  1. I was dabbling with things of which I have limited and insufficient understanding
  2. I was'nt running auditd
  3. I am running sendmail 
  4. Had I  been more systematic, the fix would have worked.
To which I will reply that: 
  1. True enough. But (remember?) my main task was mail related. I can use the standard Unix permission system without qualified knowledge of most of the innards of the kernel. The closest I would get to gain a similar insight in SELinux is by digesting a couple of ponderous tomes, then get extremely well acquainted with how SELinux   is used in my distribution, because the way it actually works is embedded in the security policy (as opposed to simply depending on ownership and permissions of the source and target files). To which my reaction is "Come again?"
  2. I surely did not turn off auditd; a quirk of the distro upgrade did. But even if I had been inclined to turn auditd off, if it is such a critical piece of armory when running SELinux, then it should be a requirement - which it is not.
  3. This is not the place for me to defend sendmail. Suffice it to say that milters are used also by qmail  and postfix in much the same way, so 99.9% I would have run into the same walls with other MTAs. Also, braindead diagnostics are by  no means a sendmail exclusive.
  4. That's true. Maybe it would have worked. Maybe not. To find out I'd have to reactivate SELinux, relabel the file system and then check. Guess what? I'm not doing it.
But even if it did work, consider this. At the beginning of the story, I did not set out to become a SELinux expert. I just needed to make a system daemon able to read a file. All of a sudden, I had to try to make sense of security contexts, system_u:var_run_t, ls -Z and god knows what else.

Besides, the suggested 'fix':

# grep sendmail /var/log/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


which might have worked, is far from perfect. It needs a wizard to figure out, it's highly cryptic, it performs its magic through binary files which disappear in SELinux's guts, and gives me no obvious way to find out that it has been applied. So now I have borked my machine's security policy in a way I will not be ever able to replicate by other means; as a boon I have no way to ascertain that the fix is there, should I forget about it, unless I turn myself into a SELinux specialist. Also, the only useful  insight I have gained in the process is "Turn off SELinux if you value your time". Tell me about "Learn by doing"

All this is a madness on par with the Windows permission system, but without the GUIs  - 'nuff said.

TL;DR: After  more than 10 years, SELInux is still a giant stinking, fuming pile of crap. Avoid like the plague.

Tuesday, July 9, 2013

If I wanna search, I'll ask for it (or, disabling search engines in Fedora)

I recently upgraded my my work machine from (linux) Fedora Core 15 to Fedora Core 18 (going through FC17,, not that you asked). It was smooth enough- rather amazingly, considering the jumble my machine is.
Even sound was working without intervention at the end, and that's a major feat.

My only bone: I had to locate and disable six (yes: 6, six, sei, sechs, ses, exa) separate desktop indexing/search services which I did not ask for in the first place. Not only that, each one has its personale quirky way of being stopped. I admit I always install both gnome, kde and xfce, though I use almost exclusively kde sessions - my bad. That is not reason, in my view, to have my machine floored by six indexing daemons that manage to be more annoying than the infamous Windows Indexing Service they are trying to copy.

Every one of them gathers thousands of Google hits when coupled with "disable" as in "disable tracker". I wonder if the authors know, or care?

And here they are in their collective hideousness:


  1. tracker: disable by gnome-session-properties (I did not even know this command existed)
  2. nepomuk: kde's semantic desktop, disable through  the system settings visual app
  3. strigi: see above
  4. akonadi: see above
  5. zeitgeist: this aptly named "activity tracker" can be disabled through a custom hack or (perhaps) through gnome session
  6. jetty: not technically an indexing engine, this servlet engine(!!!) was installed as a dependency and enabled by default.
Need I say more? Sheesh.

Thursday, June 13, 2013

Building (GNU) Emacs 24.2 on Fedora Core 15, using rpm

So yes, it is possible to repackage the FC18 source rpm of emacs 24.2 for Fedora 15 - Here is how.

# yum -y install yum-utils
# yum-builddep emacs
# yum install gnutls-devel ImageMagick-devel liblockfile-devel gtk3-devel
#  wget http://mirror.datacenter.by/pub/fedoraproject.org/linux/updates/18/SRPMS/emacs-24.2-18.fc18.src.rpm
# rpm -qi  emacs-24.2-18.fc18.src.rpm
# cd ~/rpmbuild/SPECS

Now, from emacs.spec comment references to

#Patch11: emacs-bell-dont-work.patch
...
#%patch11 -p1 -b .bell-dont-work.patch

If you don't do this, the %build step will blow up thusly:

[ -r "/home/alf/rpmbuild/BUILD/emacs-24.2/src/config.in" ] || ( cd /home/alf/rpmbuild/BUILD/emacs-24.2 && autoheader )
config.status: executing gdbinit commands
./config.status: line 2113: syntax error near unexpected token `done'
./config.status: line 2113: `done # for ac_tag'
error: Bad exit status from /var/tmp/rpm-tmp.FlYxb2 (%build)



Commenting the patch is a bit crude, but all your loss (from my understanding) is some form of audible bell when emacs runs in an xterm - big deal.

Then:

# rpmbuild -ba emacs.spec


As usual, and your shiny new .rpms will be in the ../RPMS subdirs.

Thursday, February 3, 2011

Virtualbox and USB on Fedora 14 (FC14)

Briefly: with the indicaetd setup, all the usb devices appear to be unavailable,
as seen in:

$ VboxManage list usbhost

(they are also greyed out in all the pesky dialog boxens).

[...time passes...] Having spent several hours in the fascinating process of pulling hair out of my head, i found that you have to:
  1. add yourself to the vboxusers group that VirtualBOx creates
  2. disregard notices abour mounting usbfs and whatnot (that's for old systems apparently)
  3. run
    $ sg vboxusers VirtualBox
    or
    $ newgrp vboxusers
    $ VirtualBox

It appears that VirtualBox sets everything for the vboxusers group to work, however, it does not bother to newgrp into it. How's that for great fun.