Getting KVM/FUSE/loop/openvpn to work inside systemd-nspawn

Posted 2024-07-17 02:07 / Tags: Linux. / link

Motorola Edge 40 sucks

The good:

The bad:

Posted 2023-12-21 17:12 / Tags: Phones. / link

Rauchmelder und Batterien

Vermieter hat ursprünglich die ARGUS Merten 547019 Rauchmelder Basic mit “Premium”-Batterien (sowas für ca. 10 EUR das Stück, die angeblich 10 Jahre halten) ausgestattet. Nach 4 Jahren waren die leer, der RM meldete sich über sein Batterie-Niedrig-Signal. Danach hab ich nur die billigen 9V-Alkaline-Blöcke gekauft, deren Preis zwischen 0.79 EUR (K-Classic/Ja!) oder, falls mal keine da waren 2.99 (Varta oder so). Die halten nämlich auch 3 Jahre.

Eigennotiz am Ende: Nach Ausgabe des Low-Battery-Signal und Abklemmen wurden 7.30 Volt angezeigt. Ja, man soll nicht (nur) Spannung messen, und das ist auch richtig, denn wichtig ist die abrufbare Leistung.

Spannung nehmen ist aber auch nicht verkehrt. Nach 24h Rumliegen zeigte die Altbatterie 7.80 V, ein Grund mehr, zeitnah zu messen. Die anderen RM im Haushalt zeigen 7.78, 8.30, je nach Alter. Hier nährt sich wieder die 3-3½ Jahresmarke...

Posted 2021-06-24 06:06 / Tags: Home. / link

Fujitsu U7311 Bad Experience

Posted 2021-05-10 16:05 / Tags: Hardware. / link

Notes on photo sphere/panoramic EXIF metadata

Posted 2024-10-14 12:10 / Tags: Photo. / link

Filesystems, Kernel, Linux.

Current XFS status.

It does indeed seem like btrfs features are being retrofitted to XFS like I've heard.

Posted 2016-08-30 09:08 / link

Bookmark, Git, Software.

Separate an accidentally amended commit again.

$ git add -p
[...hack hack hack...]
$ git commit --amend
# oops! intended git commit rather than git commit --amend;
$ git stash (optional)
$ s=$(git rev-parse HEAD)
$ git reset --hard HEAD@{1}
$ git cherry-pick -e $s

Posted 2016-03-08 21:03 / link

Srcds.

The hard dependency on SSE3 instructions (FISTTPL) makes srcds_linux abort with “Illegal instruction” on certain CPUs. Version unknown since there is no logging or anything before it crashes, but here goes md5sum(libvstdlib.so) = 0b4720f7e307332fba3aed57d2e704e8. Is it too much to ask supporting slightly less-capable CPUs?

cs_go> ulimit -c unlimited
cs_go> ./srcds_run -game csgo -console -usercon +game_type 0 +game_mode 1 +mapgroup mg_bomb +map de_dust2 -ip 0.0.0.0 +hostname tester
Server will auto-restart if there is a crash.
LD_LIBRARY_PATH=/home/tomentor/gameserver/cs_go/bin:/home/tomentor/gameserver/cs_go:/home/tomentor/gameserver/cs_go/bin:
./srcds_run: Zeile 318:  3887 Illegal instruction  (core dumped) $HL_CMD
Add "-debug" to the ./srcds_run command line to generate a debug.log to help with solving this problem
Wed Oct  8 18:03:45 CEST 2014: Server restart in 10 seconds
^C
Wed Oct  8 18:03:47 CEST 2014: Server Quit

cs_go> gdb srcds_run core
GNU gdb (GDB; openSUSE 13.1) 7.6.50.20130731-cvs
[...]
Core was generated by `./srcds_linux -game csgo -console -usercon +game_type 0 +game_mode 1 +mapgroup'.
Program terminated with signal SIGILL, Illegal instruction.
#0  0xa7447613 in ConVar::Create(char const*, char const*, int, char const*, bool, float, bool, float, void (*)(IConVar*, char const*, float)) ()
   from /home/tomentor/gameserver/cs_go/bin/libvstdlib.so
(gdb) disas 0xa7447613,0xa7447623
Dump of assembler code from 0xa7447613 to 0xa7447623:
=> 0xa7447613 <_ZN6ConVar6CreateEPKcS1_iS1_bfbfPFvP7IConVarS1_fE+243>:  fisttpl 0x30(%ebx)
   0xa7447616 <_ZN6ConVar6CreateEPKcS1_iS1_bfbfPFvP7IConVarS1_fE+246>:  jmp    0xa74475c2 <_ZN6ConVar6CreateEPKcS1_iS1_bfbfPFvP7IConVarS1_fE+162>
   0xa7447618 <_ZN6ConVar6CreateEPKcS1_iS1_bfbfPFvP7IConVarS1_fE+248>:  nop
   0xa7447619 <_ZN6ConVar6CreateEPKcS1_iS1_bfbfPFvP7IConVarS1_fE+249>:  lea    0x0(%esi,%eiz,1),%esi
   0xa7447620 <_ZN6ConVar6CreateEPKcS1_iS1_bfbfPFvP7IConVarS1_fE+256>:  mov    0x24(%ebx),%eax
End of assembler dump.

# /proc/cpuinfo
processor       : 3
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 2.80GHz
stepping        : 7
microcode       : 0x38
cpu MHz         : 2791.010
cache size      : 512 KB
physical id     : 3
siblings        : 2
core id         : 0
cpu cores       : 1
apicid          : 7
initial apicid  : 7
fdiv_bug        : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pebs bts cid xtpr
bogomips        : 5580.52
clflush size    : 64
cache_alignment : 128
address sizes   : 36 bits physical, 32 bits virtual
power management:

Update 2016-12-20 18:40: More idiotic hard dependencies, games now requiring SSSE4 (German).

Posted 2014-10-08 16:10 / link

Compilers.

When -fpic is not enough, you need to switch to -fPIC. Error message:

[ 560s] /usr/include/bits/stdio2.h:97:(.text+0x10): relocation truncated to fit: R_SPARC_GOT13 against symbol "stderr@@GLIBC_2.2" defined in .data section in /lib64/libc.so.6

Posted 2014-03-25 23:03 / link

Thoughts. Preissteigerungen durch Reduzierung der Packungsgröße hat auch einen “guten” Nebeneffekt: psychologisch ist es dieselbe Menge, aber faktisch ist es weniger. Man isst (hoffentlich) automatisch weniger. Posted 2013-09-12 17:09 / link

Developers' Build Systems Choice

New statistics as for what build systems are popular and which are for the gutter. openSUSE Factory as of June 22 2013 has some 6444 packages in the OBS repository, of which 6197 contained a .spec file and thus packagable software. (The remainder are _link packages, and auxiliary packages for things like ISO generation.) Since this is a multiple-choice test, sums can add past 100%.

Amount In % of 6197 How tested? Some tools needed to run a rule
Packages inspected 6197    
autoconf without automake 323 5.2% presence of configure.ac/.in, absence of Makefile.am sh, sed, make
autoconf with automake 2320 37.4% presence of Makefile.am sh, sed, make
perl-like 866 14.0% Makefile.PL (ExtUtils::MakeMaker) or Build.PL (Module::Build) perl, make
python-like 669 10.8% setup.py python
cmake 514 8.3% CMakeLists.txt cmake, {make or ninja or VS or nmake or wmake or ...}
ant 193 3.1% build.xml java, ant
qmake 190 3.1% *.pro yielding a match qmake, ...?
php 184 3.0% package.xml ?
xmkmf 69 1.1% Imakefile xmkmf, cpp
maven 41 0.7% pom.xml java, maven, ...?
android 39 0.6% [Aa]ndroid.mk ?
scons 36 0.6% SConstruct scons
haskell 33 0.5%   ghc?
waf 30 0.5%   python
plain 560 9.0% Makefile* excluding Makefile.am make
none or unknown 706 11.4%   -

Since packages to rich scripting suites often use the “in-house” installation mechanism — Perl modules almost exclusively use ExtUtils::MakeMaker, for example — it might be worth interesting looking at the tally that excludes such modules. Or in fact, perhaps I should only look at C and C++ source code, since that is what most of the enlisted build systems target. (Another time, perhaps.) It would certainly mean that autoconf prevalence would reach 60%, or maybe more.

Personal remark: If I look at Samba's wscript, I can see why WAF is unpopular. It seems more like a plain Makefile written in Python rather than the “clever” use of prior modularized code.

Posted 2013-06-21 22:06 / Tags: Autotools, Development, Software. / link

Nokia phones turn off vibration alarm when connected to a charger

Some Nokia phones deactivate vibrato alarm when connected to a charger. This bug goes back to models as old as the 3330 and there are reports (see link) for others as well. Apparently, that is “Not A Bug, But A Feature”™ according to the linked forums, but it still means one has to remember changing the profile from vibra-only to one with ringtone enabled. If you are a sensible person, you turn your gadgets silent in public. But that probably had not been anticipated by Nokia back then. And now we have blaring ringtones everywhere—but that is a topic for another time.

Posted 2013-02-24 17:02 / Tags: Bugs, Nokia. / link

Doom, Heretic, Hexen, Thoughts. Speedrunning Heretic and Hexen: The presence of the Chaos Device and Wings Of Wrath artifacts open up significant shortcuts. The fact that these artifacts are also retained across maps means map designers need to be that much more careful if they want to forbid certain shortcuts. Posted 2012-10-27 19:10 / link

IPv6 at home: proto-50 instead of proto-41

SIXXS and HE (two tunnelbrokers I significantly used in the past) have certain limitations, so running IPv6 over a VPN tunnel to a dedicated server is something I considered. Root of the problem is of course the set of inert German ISPs that will not budge a quad in delivering IPv6, especially in light that RIPE's pool has now also reached the restricted giveaway mark.

SIXXS. Convoluted registering scheme. You need to deal with RIPE handles, wait for human approval, request a pointtopoint tunnel (though it is a /64, it only serves tun::2/128 to your end), wait for human approval, use the “aiccu” tool (maintenance is lacking), request a real /64 route (for e.g. virtual machines), wait for human approval, request nameserver delegation, wait for human approval. Oh, did I mention waiting for approval?

Hurricane Electric. Register. Create /64 routed tunnel. Set DNS delegation. Configure local end, done. One can set the tunnel parameters in a scripted fashion, but there seems to be no aiccu-like tool for users with dynamic addresses. But for servers with static addresses, this is just excellent and quick.

While both SIXXS and HE essentially use IP6-in-IP4 (SIT, sometimes called “proto-41”) transport, my approach sports a IP6-in-ESP4 (proto-50) connection. The upside is that you can use well-established, well-maintained tools (like StrongSWAN) to connect. They will deal with a dynamic endpoint address, NAT, let you choose between passwords and certificates, and encryption to the other endpoint if so desired. If you are running a dedicated server yourself, you will have full control of DNS records, addresses, routing and so on. The following was verified to work with kernel 3.4 and strongswan-4.5.3.

# client-side ipsec.conf
conn nakamura-seven
        left=%defaultroute
        leftsubnet=2001:db8:61:1fa::dead:beef/128
        leftid=@laptop-beef.company.de
        right=192.0.2.1
        rightsubnet=192.0.2.1/32,::/0
        rightid=@vpn.company.de

# server-side ipsec.conf
conn seven-nakamura
        left=192.0.2.1
        leftsubnet=192.0.2.1/32,::/0
        leftid=@vpn.company.de
        right=%any
        rightsubnet=2001:db8:61:1fa::dead:beef/128
        rightid=@laptop-beef.company.de

For the %default section, see an earlier post. You will also need to make sure that 2001:db8:61:1fa::dead:beef/128 is present on the client-side internet-facing interface — before the connection is established, or you will get a “no local address found in traffic selector 2001:db8:61:1fa::dead:beef/128” error. Having the address set may involve some work of your own at the distribution level, especially when the distro is set to use DHCP by default, or when things like NetworkManager make it all the more difficult. The leftupdown= variable cannot be used to add/delete the IPv6 address, as the script is executed too late and would get you in exactly that aforementioned error.

Posted 2012-09-15 08:09 / Tags: Ipsec, Ipv6, Linux, Networking. / link

Building Wanpipe from source

Sangoma's wanpipe is one of the absolutely worst maintained tarballs ever released, worse than nvidia, fglrx and vmware-ws combined. ./Setup is one humongous unreadable shell script that is unusable for chrooted package builds, and naturally, Kbuild is eschewed bigtime although not completely, leaving no way to get src/lip compiled without lots of frustrating guessing on what the required command line would be. With Sangoma support showing no signs of accepting even the simple patches to fix DESTDIR support, outlook for cure is more than dim.

Originall posted at G+

Posted 2012-09-12 16:09 / Tags: Rant, Software. / link

Rant, Software.

Sangoma's wanpipe is one of the absolutely worst maintained tarballs ever released, worse than nvidia, fglrx and vmware-ws combined. ./Setup is one humongous unreadable shell script that is unusable for chrooted package builds, and naturally, Kbuild is eschewed bigtime although not completely, leaving no way to get src/lip compiled without lots of frustrating guessing on what the required command line would be. With Sangoma support showing no signs of accepting even the simple patches to fix DESTDIR support, outlook for cure is more than dim.

Posted 2012-09-12 10:09 / link

LXDE not ready for multi-monitor setups

I have been using Xfce since about August 2010 (before that: icewm). I always kept on hearing the occassional occurrence of LXDE when topics of light window managers were raised, so I today I gave LXDE a spin, for completeness. In my home environment, I attach an external monitor to yield some extra space, but, as it seems, lxpanel-0.5.8 does not support placing the panel on a specific monitor (rather than the X screen), so LXDE just became irrelevant to me. FYI, the screen/display config is:

Screen 0: minimum 320 x 200, current 1280 x 1332, maximum 4096 x 4096
LVDS1 connected 1024x600+0+732 (normal left inverted right x axis y axis) 220mm x 129mm
   1024x600       60.0*+
   800x600        60.3     56.2
   640x480        59.9
VGA1 connected 1280x1024+0+0 (normal left inverted right x axis y axis) 376mm x 301mm
   1280x1024      60.0*+   75.0     72.0
   1152x864       75.0
   1024x768       75.1     70.1     60.0
   832x624        74.6
   800x600        72.2     75.0     60.3
   640x480        72.8     75.0     66.7     60.0
   720x400        70.1
   640x350        70.1

Posted 2012-08-11 19:08 / Tags: Linux, Window Managers. / link

The Ecodisc oblate

During the openSUSE Conference 2011, every participant got a bunch of free Linux-related magazines; among them: Linux User (2011/05 de_DE issue), Linux Magazin (2011/08 de_DE issue), Linux Magazine (2011/05 en_GB issue) and one other, which was probably easylinux, because they are all owned by Linux New Media.

Since such magazines way too often recycle topics, I almost never buy or even read them, so this is also the first time I noticed yet-unseen kinds of plastic discs that shipped in the magazines. An “EcoDisc” label was prominently placed on the disc, so there went today's Google search. Half the plastic, half thickness (good for slot-loading drives? I dare not try), supposedly half the CO2 emission (CO2 is so prominent that people seem to be forgetting about methane and CFCs), half the weight.

But, one of the Ecodiscs was already broken in more than two pieces, which might have occurred when the stack of magazines was hoisted to the conference, and later also to the homes of its participants. I had one more non-broken Ecodisc to try it out on against, whilst actually observing. Very easy to bend and likely to break akin to a round waffle wafer, known here as Oblate(-n). In order of increasing fragility: EcoDisc, CD-Rs, simple pressed discs, really stiff pressed discs.

Posted 2012-07-31 08:07 / Tags: Manufacturing,, Slice Of Life. / link

IPsec: IP*-in-ESP-in-IP6

The following snippet is for site-to-site encrypted connections, transporting both IPv4 and IPv6 in ESP over IPv6. Kernel 3.x and strongswan-4.5.3 are used. One important caveat remains: The IPv6 addresses in the leftsubnet= and rightsubnet= lines must come after the IPv4 ones. This is a known “bug” in the StrongSWAN config parser.

config setup
        plutostart=no

conn %default
        ikelifetime=600m
        keylife=200m
        rekeymargin=3m
        keyexchange=ikev2
        mobike=no
        keyingtries=%forever
        dpdaction=restart
        dpddelay=60
        auto=start

conn a-b
        left=2001:db8:61:1fa::1
        leftsubnet=192.0.2.1/32,10.10.7.0/24,2001:db8:61:1fa::/64
        leftid=@a.company.de
        right=2001:db8:50:1fb::1
        rightsubnet=192.0.2.254/32,10.10.4.0/24,2001:db8:50:1fb::/64
        rightid=@b.company.de

192.0.2.1 shall substitute in for the public IPv4 address of host A, 2001:db8:61:1fa::1 for the public IPv6 address of host A, 10.10.7.0 for a network connected A which also has 2001:db8:61:1fa::/64. In `ip addr` parlance:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 (internet-facing)
    inet 192.2.0.1/25 scope global eth0
    inet6 2001:db8:61:1fa::1/128 scope global
      valid_lft forever preferred_lft forever
3: tapvbox0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 500
    inet 10.10.7.1/24 scope global tapvbox0
    inet6 2001:db8:61:1fa::1/64 scope global
      valid_lft forever preferred_lft forever

Posted 2012-06-29 15:06 / Tags: Ipsec, Ipv6, Linux, Networking. / link

Hardware. Because manufacturers of hard disk technology (either drive or enclosures, converters and whatnot) just can't get it right, here is now the parkverbot daemon to keep your disks spinning nevertheless. Posted 2012-06-16 18:06 / link

Filesystems. The larger disks get, the longer you spend in reconstruction. I will formulate today's thesis: Eventually, as disks get larger, they fail before the RAID reconstruction is complete. That would set a practical limit for the maximum size of a single disk. Furthermore, As the data set grows larger, some part of it will fail before the filesystem check is done. So in essence, we will be hitting logistic barriers before physical ones. Neat. Posted 2012-06-07 22:06 / link

BBC commentator taunting ESC

As usual, the BBC radio commentator Ken Bruce has a good taunt ready for almost every other ESC participant.

A/B/C: local moderators, BBC: BBC commentator.

B: 26 finalists means that this is the biggest Eurovision grand final since the introduction of the semi-final shows. The number of participants in today's grand final equals the record from 2003 in Riga.
BBC: That means it going to be even longer than usual!

This year's show clocked in at about 3 hours 30 minutes.

A: Tonight, we share this arena with 20000 people in the hall. I want to hear 20000 people...
BBC: You don't need to hold your microphone up for them, I think we will hear them anyway.
A: And 120 million viewers all over Europe... I want to hear you again.
BBC: That will be more difficult.

Hungary is about to perform.
BBC: We have Hungary coming next, uh, a group called “Compact Disco” led by a man called Behnam Lotfi. He has been dressed apparently by World Of Leather, it is [...] a ¾-length coat, looks a bit like an off-cut from a DFS sofa.

Albania is about to perform.
BBC: [...] I will warn you, she starts cat-wailing halfway through it, really annoying sound. [...] You won't be singing this one on your way home from the pub — unless a bus parks on your foot.

Russia has finished their performance.
BBC: Now listen to the response to that. I had never have ever seen like it in Eurovision — I probably will never again.

Cyprus is about to perform.
BBC: The wind machine is back in use for this. Well, they paid for it for the weekend from HSS, so, might as well use it, I suppose.

France is about to perform.
BBC: And the wind machine is back — thank goodness, money is worth it at last.

Norway is about to perform.
BBC: They have had a checkered time at Eurovision: some great wins, some great losses. I think this is going to be one of the latter. So not be so I am be getting with some slightly flatulent electronic noises. [...] His name is Tooji [pronounces it like "2G"] — although I think he is probably going to be superseded by 3G.

Malta is about to perform.
BBC: Now, I have been doing Eurovision for many, many years now. I keep coming back on the promise that we might go to Malta [Malta doing the hosting] one year, and this is the Maltese entry. I sort of feel that we may not be going this year. [...] There is an active band there on the stage with some slightly silly footwork, but that does that matter at Eurovision? No, not at all.

Ukraine has finished their performance.
BBC: That tuneless trumpet sound that they had throughout that song, was quite intentional, it is a traditional instrument. At least that was always my excuse when I was learning to play as well.

Greece has submitted its points.
BBC: Still three countries to get any score at all: Iceland, Norway and Denmark. But they can probably vote for each other when the time comes.

And it occurred so later.

Switzerland is giving its points.
BBC: Well, Switzerland don't have neighbours they vote for; or friends particularly.

Denmark is giving its points.
C: Finally, the top 12 points go to our very nice neighbors in Sweden.
BBC: Our problem is that we [Great Britain] don't really have any neighbors [to get points from]

Posted 2012-05-27 00:05 / Tags: / link

Git, Postit Note, Software Development. Send with `git send-email ... --format-patch -M -M` to reduce the set to a reviewable size. Posted 2012-05-25 07:05 / link

Asana: sub-standard service

The Asana task management's web interface is visually convoluted, has kinda two or three layered windows, and is way too DOM-heavy. It is a PITA to load and use, because some 1st year programming student thought it was a good idea to hook an event to every goddamn keystroke, not to mention the automatic scrolling of the window once the <textarea> resizes. Seriously, wtf? And if you try to access it with an exotic browser, all you get is a "not supported" error and no way to continue entering the ticket system at your own risk.

It continues similarly bad when looking at the e-mail notifications. Useless top posting wheever you see. The mails one gets have a thread-like indenting even though tickets are flat by definition, given there is no threading view and/or threaded reply ("reply to this post") in the webinterface.

Asana also has some e-mail reception interface, which seems like a boon given the JS-overloaded webpage. Except, it does not work: mails sent are simply eaten (accepted) by the Asana mail system without posting the reponse to the ticket, or yielding an error message.

When pointed out to Asana support, their staff puts forward a sort of reality denial in their responses. Hey look, I just told you what mail (that I sent) was eaten by your system. I posted mail headers and relevant parts of /var/log/mail from my end, so you know the IDs and can look it up on your side. Why are you still asking about my MUA?

Posted 2012-05-01 18:05 / Tags: Rant, Software. / link

Gimp, Software. Inkscape is intuitive to use without reading a user manual. GIMP is not. Why is that? Because GIMP overthrew many common shortcuts. Count the applications where Ctrl+D is deselect — GIMP is not among them. Posted 2012-04-11 20:04 / link

Empirical Experiments, Film. There is a relation between series length and amount of plot-relevant dialogue per time unit, averaged over the entire series. The latter falls of exponentially with increasing number of episodes in a show. Or in simple terms: long-running shows are needlessy stretched. Conversely, it has shown itself that simple shows are potentially never-ending. As Wikipedia article authors propound, the “open-ended nature of the narrative, with stories spanning several episodes” is a key ingedrient to a soap opera.—Considering that, Bleach (360+), Pokémon (730+), etc., and even the WWE eps, follow such a soapy pattern, since the core pattern has been, and continues to be the same all along. Posted 2012-04-07 02:04 / link

Food. In two-layered fruit yoghurts (one layer fruit and one layer yg, that you have to mix yourself to get the desired result), just what is it that makes some manufacturers put the fruit layer on top, while others reverse it? Posted 2012-04-04 15:04 / link

Software. Finally — in 2012 — the memory usage patterns for KDE 4 and Firefox have come down to a level that is more pleasing. The static cost is still high, like when running only kdm (instead of the full DE) or Firefox with only a single tab rather than 10. Posted 2012-03-31 13:03 / link

Software Development. Every bug reporter / person seeking support should read it: “What Have You Tried?Posted 2012-03-29 15:03 / link

Games, Music. Just found: OpenJazz, reimplementation for Jazz Jackrabbit 1. Meanwhile, as for JJ2, a phat remix of the Labrat track by Allen KV. Posted 2012-03-24 02:03 / link

Linux. Until we have a fully-functional non-Schily CD recording suite that supports all contemporary formats of the day, the importance of writing to optical media by outside of the entertainment industry will have declined so much that it is not worth any longer pursuing creating a replacement suite in the first place. Posted 2012-03-01 11:03 / link

Error condition propagation in the Linux kernel source

At the request of Philip Fry on a comment posted by me on David Zeuthen's blog post “Writing a C library, part 3”, I am posting a short overview of error conveyance in the Linux kernel (source).

David Zeuthen wrote in his blog post about the integer variable errno: “For simple libraries just using libc's errno is often [the] simplest approach to handling run-time errors (since it's thread-safe and every C programmer knows it)”.

A global variable — is it simple? Yes, I could agree on that. Thread-safe? Yes, contemporary implementations of C-derived environments that support threads, in other words, POSIX, have redefined errno such that it has a per-thread-specific location. It may look something like:

extern int *errno_location(void);
#define errno (*errno_location())

Whereby errno_location is a function with deeper magic that just eventually returns a pointer to a thread-unique location. The indirection via the pointer is necessary because errno is supposed to be an lvalue that can be assigned to. Due to the new macro, I am reluctant to still call it a “variable” in this context, since it is not a named variable anymore, but a dereference of a function's return value.

Anyhow, it does retain errno's properties: it is, in essence, still a “global variable”, or to be more exact, an object with static storage duration with added global scope/visibility. The pro and contra for such objects I need not repeat here.

So my replying comment to David's posting was: “It may be safe from other threads due to TLS [thread-local storage], but it is still a object with global scope, which results in having to longwindingly save and restore errno across calls to other opaque library functions. The Linux kernel in contrast shows how to do without such a global.”. An example to the necessary save-and-restore cycle is this piece of common housekeeping done just before forking:

bool all_or_nothing(int *p)
{
        unsigned int i;

        for (i = 0; i < PIPE_PAIRS * 2; ++i)
                p[i] = -1;
        if (build_pipes(p) != 0) {
                saved_errno = errno;
                kill_pipes(p); /* calls close() */
                errno = saved_errno;
                return false;
        }
        return true;
}

The handling in the error path is somewhat cumbersome, because close can set errno. This prompted me to present the case of how the Linux kernel internally conveys error conditions. One code example:

int all_or_nothing(int *p)
{
        unsigned int i;
        int ret;

        for (i = 0; i < PIPE_PAIRS * 2; ++i)
                p[i] = -1;
        ret = build_pipes(p);
        if (ret < 0)
                kill_pipes(p);
        return ret;
}

Error conveyance in the Linux kernel generally follows this abstract ruleset:

Posted 2011-07-06 07:07 / Tags: Kernel, Linux. / link

Empirical Experiments. Have someone who is pessimistic about the topic of your questionnaire look over it to suggest missing possible answers. Especially, there might be missing “Never” options. Posted 2011-03-05 00:03 / link

Film, Memorable Quotes. JAG episode 2x01: Harm: “Don't judge an apartment by its elevator.” Mac: “Looks more like a storage facility to me.” Posted 2011-03-01 15:03 / link

Film, Memorable Quotes. A-Team episode 3x17: Murdock: “You can fool some of the poeple all the time, and all the people some of the time.” Posted 2011-03-01 15:03 / link

Encoding problems identified and corrected easily

So one customer's webpage showed odd characters in otherwise normal text, like “we’re”. No doubt this looked very much like an encoding error between ISO-8859-x/cp1252 and UTF-8; three characters and all being outside the ASCII plane is a hint to this.

Update 2016-02-05: I turned the fixing process into a program which speaks to me more than a full article: decode_mojibake_1252.c

Posted 2010-03-07 23:03 / Tags: Encoding, Sql. / link

A new system

[Updated May 7 2012]. (by hxtools sysinfo) [ares] Linux 3.1.1 sparc64 | 24-thr UltraSparc T1 (Niagara) 1000MHz | Load: 0.05 Tasks: 302 | Mem: 1824/7985MB | Disk: 11201/12835GB — has a nice ring to it, in the midst of an x86-filled world.

The CPU draws 72 W in idle (according to SC), eight RAM banks another 16.5 (SC), and another 5.5 for the rest of the system (disk), for a total of 94 W measured at the wall socket. Under load, the CPU goes up by ~20 W and the RAM banks 1–2 W.

It is always interesting to see what's in the Fujitsu SPARC Enterprise T1000 (6-core/24-thread configuration). The black Fujitsu front bevel also looks a lot more awesome than the silvery Sun/Oracle plating.

Posted 2009-11-21 11:11 / Tags: Hardware, Linux, Sparc. / link

Simple bandwith monitoring with iptables/xt_quota2

Add some iptables rules without a target:

iptables -t mangle -I PREROUTING -i ppp0 -m quota2 --grow --name incoming
iptables -t mangle -I POSTROUTING -o ppp0 -m quota2 --grow --name outgoing

The quota2 match counts traffic as packets pass this rule, and makes the value available through procfs. This makes it superior to everything that tries to grep and interpret the output of `iptables -L`.

This can easily be wired up with rrdtool to produce some graphs. The following snippet contains the script that should be run every 60 seconds from cron.

#!/bin/bash

q="/proc/net/xt_quota";
file="$HOME/internet.rrd";
if [[ ! -f "$file" ]]; then
    rrdtool create "$file" --step 60 \
        DS:incoming:COUNTER:120:0:U \
        DS:outgoing:CONUTER:120:0:U \
        RRA:AVERAGE:0.5:2:$[60*24*180] \
        RRA:MAX:0.5:2:$[60*24*180] \
        RRA:LAST:0.5:2:$[60*24*180]
fi;

now=$(date +%s);
in=$(cat "$q/incoming");
out=$(cat "$q/outgoing");
rrdtool update "$file" "$now:$in:$out";

The final graph picture can then be produced:

file="$HOME/internet.rrd";
type="AVERAGE";
rrdtool graph "$HOME/internet.png" --start -86400 \
    -a PNG -t "Interface ppp0" -v "Bytes/s" \
    -w 800 -h 400 -M \
    "DEF:x_incoming=$file:incoming:$type" \
    "DEF:x_outgoing=$file:outgoing:$type" \
    "CDEF:y_outgoing=x_outgoing,-1,*" \
    "AREA:x_incoming#008800:Received" \
    "AREA:y_outgoing#880000:Transmitted"

Posted 2009-02-24 01:02 / Tags: Iptables, Linux, Monitoring. / link

Unreal Tournament Key Bindings

There seems to be a bug in UT99 v451 in that the voice menu, as triggered with the “V” key by default, just retracts even while you hold the key. To counter this you can define key bindings.

To bind a key: (Yes, it's different from the quake-style bind command.)

set input key action

For example, set input F12 togglefullscreen is very useful, because the default binding for F12 is only to end fullscreen rather than also returning to fullscreen (kinda dull), so rebinding it to toggle is a nice bonus.

As for voice commands, there is an odd syntax I had to figure out. The actual console command for voice messages would be speech category message target. target designates the player who should receive the message, or -1 for everybody (it seems). Players start with integer 0, as evidenced by “Blue Leader, defend the base” when issuing speech 2 0 0. In UT99, category must be an integer, mnemonics do not seem to work.

Posted 2009-08-08 18:08 / Tags: Games, Unreal Tournament. / link

Linux Intern 03/2009 Interview, ungekürzte Version

In der Zeitschrift liegt nur eine gekürzte Version vor. Als Ergänzung dazu hier der volle Text wie er ursprünglich von mir entsendet wurde.

Originaldatum: 01. März 2009, Gekürzte Segmente sind leicht hervorgehoben.

Wie schätzt Du allgemein die Fähigkeiten von Suse als RT-Betriebsystem für Audio ein?

Generell gibt es keine unnötigen Barrieren, um ein Realtime-System zum Laufen zu bekommen. Ein Teil davon ist der Kernel, der andere sind die Programme. Hier kommt z.B. der Niedriglatenz-Audioserver JACK zum Einsatz. Die Integration von PulseAudio haben Distributionen vergeigt — auch wenn die Situation seit der Diskussion um Linux Audio: It's a mess” besser geworden sein mag — Benutzer haben zuweilen immer noch Probleme selbst damit.

Ist es besonders schwierig, Deinen Kernel zu integrieren?

Der Endbenutzer braucht lediglich das RPM-Kernelpaket zu installieren, evtl. noch Treiber wie NVIDIA, und kann nach Starten des Kernels schon loslegen. Die Installation kann man mittels `rpm -ihv` (für Vorsichtige), zypper oder yast durchführen, und Webpin biete[t] auch automatisch generierte One-Click-Metadaten an.

Du bietest Dein Repo auch für 64bit an: können Anwendungen wie Jack damit besser laufen, als mit dem 32bit-kern? Beobachtest Du selbst Performance-Vorteile?

Ich muss gestehen, ich verwende JACK selber nicht; da ich nicht professionell im Audio-Bereich arbeite, genügt mir ALSA. Mein täglich verwendeter Desktop ist auch noch eines Baujahrs, wo es die ersten 64bit-Opteron-CPUs nur als “AMD Engineering Sample” (so gesehen in /proc/cpuinfo) gab — 2003. Den 64-bit-Kernel setze ich selber daher bisher leider nur auf Servern ein, alles andere erfahre ich durch Userberichte.

Allerdings bietet ein 64-bit-Kernel die Möglichkeit, ein 64-bit-Userspace zu betreiben, was einige Vorteile bietet. Vorab sei gesagt, dass einige Multimediakomponenten, darunter ffmpeg, handoptimiert sind, und auch im 32-bit-Modus alle CPU-Features ausreizen, dies muss aber nicht bei allen Programmen so sein. Ohne besondere Anweisung nämlich produziert der Compiler im 32-bit-Modus nur Instruktionen, bei denen garantiert ist, dass sie vorhanden sind. Komponenten ohne Handoptimizerung, hier am Beispiel “libvorbis”, verzeichnet einen 17%igen Geschwindigkeitsgewinn durch Kompilierung mit SSE auf 32-bit. Da SSE fester Bestandteil von x86_64 ist, sind 64-bit-Distributionen im Vergleich zu ihrer 32-bit-Variante üblicherweise schneller. OpenSUSE bot darüber hinaus von Anfang an ein reichhaltiges Angebot an 32-bit-Bibliotheken für die x86_64-Releases an — leider traf das nicht auf alle Distributionen zu, und führte wohl mitunter zu dem Mythos, dass es “Probleme” mit 32-bit-Programmen unter 64-bit gäbe. [Schlechte Programmierung ist natürlich immer ein Problem.]

Wie siehst Du Deinen Kernel im Vergleich mit anderen RT-Varianten, etwa dem 64Studio-Kernel für Debian oder dem CCRMA-Kernel für Fedora? Gibt es große Unterschiede?

Der offensichtlichste Unterschied ist zunächst mal die Versionsnummer. Bis zum Erscheinen von 2.6.29-rt Ende Februar 2009 bot ich nur 2.6.25(-rt) an, während andere schon auf 2.6.26-rt gewechselt waren. Darüberhinaus versuche ich, meinen Kernel auf den von openSUSE aufzubauen — das muss aber nicht immer so sein, z.B. wenn Novell noch keinen neueren bereitstellt —, um von deren Patches Gebrauch zu machen. Bei anderen Distributionen finden sich hingegen viel öfter Vanilla-Kernel.

In den letzten Monaten hatten Entwickler von Audio/MIDI-Software massive Probleme mit der Kernelentwicklung. Paul Davis bezeichnete Version 2.6.27 als unbrauchbar für Audio, wie schätzt Du die Entwicklung ein — werden solche Probleme irgendwann ganz verschwinden?

2008 und Anfang 2009 gab es RT-Updates lange Zeit nur für Kernel 2.6.26. Nachfolgend hatten einige Interessenten, darunter das Kernelteam von Novell, versucht, die Patches auf 2.6.27 zu portieren, hatten damit aber nicht sonderlich viel Glück — mein erster und einziger Versuch eines Test-RPM-Paketes endete mit einem Panic beim Booten. Ich schließe daraus, dass es nur wenige Entwickler gibt, die sich mit RT-Code genügend auskennen, um die RT-Patches auf neuere Versionen aufzusetzen. Begabtere Endanwender versuchen derweil, mittels “Full Preemption”, also eine Stufe unter “Real-Time”, auszukommen, und mögen dabei wohl über audiophile Grenzen, wie z.B. Latenz treten, die für ihre Tätigkeit nicht mehr hinnehmbar ist.

Ende Februar ist dann RT für 2.6.29-rc erschienen, und nach den Worten Gleixners[3][4] sollen die RT-Patches einen hören Stellenwert bekommen, indem sie in das Repository der Entwickler eingepflegt werden sollen. So besteht die Hoffnung, dass die Patches fortschreiten und “mitgeschoben” werden, wenn das RT-Team ihren Entwicklerbaum mit dem von Linus Torvalds synchronisiert. In der Zukunft sollen die Patches dann auch mal nach Mainline übernommen werden. Man mag abwarten.

Wie “offiziell” ist Dein Repo? Wird es eher als interessantes Nischenprodukt geduldet oder als wichtiger Beitrag gefördert? Zeigen NOVELL oder OpenSuse Interesse an einem offiziellen RT-Kernel in offiziellen Suse-Repos?

Ein Nischendasein scheint es zu führen, bedingt durch eine Reihe von Faktoren. Die meisten Paketmanager entscheiden allein aufgrund einer höheren Versionsnummer, ob ein Paket upgradebar ist, und das hat Endbenutzer, insbesondere solchen mit Upgradewahn, oft Pakete eingespielt die sie gar nicht wollten — zurückzuführen darauf, dass sie mal das Repository hinzugefügt hatten, um an ein eigentlich anderes Paket heranzukommen. Naja, so hatte ich automatisch eine Gruppe (un)freiwilliger Kerneltestern ;-) Leider hat das Spuren hinterlassen, und man darf heute eigentlich nur froh darüber sein, dass es mit Zypper einen Paketmanager gibt, der standardmäßig keine Upgrades über Repositorygrenzen hinweg macht.

Novell hat bereits mit openSUSE 10.3 einen RT-Kernel auf Basis 2.6.22 herausgebracht. Da ich schon länger Kernels mit meinen eigenen Patches erweitere, war RT damals eher ein Nebenprodukt der Build-Software. Erst mit 2.6.23, wo der Scheduler im Kernel durch CFS ausgetauscht wurde, gingen mir die Latenzen bei der einfach Audiowiedergabe auf einem Kernel mit 10 ms Scheduling-Granularität (also HZ=100) durch die Decke und ich wechselte auf RT.

Posted 2009-08-01 19:08 / Tags: Articles, Magazines. / link

The woes with terminal emulators

Generally I use xterm because that is available on about every UNIX workstation, or where not, “derivates” (allow me to use this terminology even if it may not apply) like rxvt are available on, for example, MSYS (system around MinGW for Win32). However, I wanted to try something different, as xterms only seemed support bitmap fonts (I later found out that it can use freetype).

In the course of having tried all the terminal programs, a set of criteria seemed to have emerged:

libvte deserves a separate section here, because some terminals make use of it. Since libvte happens to have some bugs in the version I had installed (0.17.4), terminals making use of it are affected. Bug report is pending. Let's see where this goes. (Probably nowhere as usual.)

libvte suffers from a some cosmetic issues, making it hard to use my favorite editors because either the cursor suddenly disappears (blue-on-blue) or the background does not get painted thoroughly (read: correctly).

Both sakura and gnome-terminal which make use of libvte will cause a high CPU use. While the terminals hum along between 3–6%, the X server process rises up to as much as 52%. (Window size and font is the same as Xterm, for a fair comparison.)

Sakura was the first new terminal emulator to try; the reason for it being the first is probably because I had probably heard/read it some time back and it stuck in the head.

Since most of the job is done by libvte, there is not much to write, really. What was of note is that sakura (version 2.3.2) did not allow me to change the palette to custom colors and that there was a geometry (window size) related bug (said to be fixed in 2.3.3).

Over sakura, gnome-terminal allows changing to custom colors. Contrary to slowness warnings from people on IRC (outside #gnome), it is not any slower than anything else libvte-based.

Given the problems libvte currently has, I sought ought for a terminal that does not seem to use it, judging from ldd output. KDE came to mind...

Turns out you cannot even select non-monospace TTF fonts. And as it stands, Latin Modern Mono seems to not have classified itself as monospace, so I could not select it. Also, kde-konsole is horribly slow, the konsole process taking up 21% CPU, and X also its 52%.

I also tried roxterm; it was indistinguishable from gnome-terminal actually. Also uses as much CPU.

Conclusion: Xterm has so far been the most flawless terminal.

Color coherence is really needed when you want to write top-quality source code. If your cursor just disappears as it does with libvte, you need to relocate it using alternate methods, like row/col number of arrows on the side rulers (if such exist in the particular editor).

Xterm's speed is described by its CPU usage when scrolling through a text file — 1.3% to 3.7% according to `top` and, above all, the X server process stays calm during scrolling.

Remark 2011-Nov-23: repaint-ok means whether BCE is done (paint background with color on erase). BCE occurs on the VT console (among others) when you emit the sequence \e[44m\e[2J (set background to blue, and clear entire screen).

Name Unicode CJK free choice of
bitmap/ttf fonts
customize
colors
“repaint”
ok?
fast (term/X cpu%) glyph
spacing ok?
Xterm 236 , 3-6%/<3% (having to set it manually, but ok)
sakura 2.3.2 , 6-7%/60%
gnome-terminal 2.24.1.1 , 3-6%/52-55%
kde4-konsole 4.1.3 , 20%/50-55%
Eterm r38808

Fonts

Notes

“Rulers - if such exist in the particular editor”: the text editing tool “GFA DeskPlus” (1988) employed a ruler at the bottom of the screen, and I ported this feature to mcedit for my own convenience (and not because the cursor disappeared).

DeskPlus word
processor mcedit with
deskplus ruler

Posted 2009-02-14 01:02 / Tags: Linux. / link

Type-checking casts in (GNU) C

This is word to let the world know that I have found a way to make the C++ new-style casts, specifically static_cast<> and const_cast<>, in (GNU) C (that's right, not C++).

I had seen annotation-only “casts” in C projects (and not just my own) before. Just grepping -Pin '\w+_cast\(' in all .tar.gz/.tar.bz2 source tarballs that are contained within a bunch of .src.rpms ([gklmnop]*.src.rpm from OpenSUSE was my run) of the distro already reveal quite a bit. It looks like this:

/* The below macro is intended to be used for type casts. By using this
macro, type casts can be easily located in the source code with
tools like "grep". */
#define JAS_CAST(t, e) ((t) (e))

/* C++ style type casts */
#define const_cast(m_type, m_expr) ((m_type) (m_expr))

(These two examples from libjasper and Midnight Commander (mc))

Essentially, these developers just use the plain old cast, and it does not do much except the annotation. In fact, it can easily lead to warnings not appear, because it is essentially just the old reinterpreting cast. That is to say:

/* Former code */
static void foo(const char *y)
{
    char *x = const_cast(char *, y);
}

This can easily fall apart when forgetting to change half of the code (which is bound to happen at some point in larger codebases):

/* Former code */
static void foo(const int *y)
{
    char *x = const_cast(char *, y);
}

You do not get any warning for the apparent type mismatch. While that sucks, it is justified, because you actually used what is a reinterpret_cast, not an actual const_cast with a #define like that above. Comes along GNU C.

The presence of the ARRAY_SIZE/BUILD_BUG_ON macros in the Linux kernel source inspired me to try something similarly freaky with GCC's extensions, for fun and profit.

The result are some macros that actually do type-checking instead of an annotation that has a reinterpret-pitfall in it. I am not aware of this macro setup having been done before, as it is pretty impossible to grep or google for such without turning up lots of C++ code. It is further my assumption that since the GNU C compiler itself only carries annotating “CONST_CAST” macros, that my approach is indeed novel.

The reference implementation for the discovered macros is present in libHX starting from 2.0. Linux distro packages will be doing an update soon. Interested parties are encouraged to use of libHX/defs.h.

Using these new macros, const_cast1(char *, y); (note the '1' in “const_cast1”) will not allow y to be something other than char * or const char *!

Keywords: signed_cast const_cast static_cast reinterpret_cast GNU C

Posted 2008-12-24 11:12 / Tags: Compilers. / link

Three steps to a basic IPsec tunnel

Sometimes, the solution is so simple that you miss the wood for the trees.

1. Install StrongSWAN on both sides.

2. Edit /etc/ipsec.conf on each side:

conn foo
        left=fd00::31:1
        right=fd00::32:2
        auto=start
        authby=psk

3. Edit the ipsec.secrets on each side.

fd00::31:1 fd00::32:2: PSK "our happy shared key"

Certificate-based

Generate a certificate plus key for both left and right side (give them appropriate names, left/right is just a filler here):

openssl req -x509 -nodes -key /etc/ipsec.d/certs/leftside.pem -keyout /etc/ipsec.d/private/leftside.pem.key

This is just a self-signed certificate, but should fit the bill for "simple". Each side needs to have their own certificate and key, plus the right side's certificate. (The left side needs to have leftside.pem, leftside.pem.key, and rightside.pem, the right side needs to have rightside.pem, rightside.pem.key and leftside.pem.)

/etc/ipsec.conf for the left side:

conn foo
        left=1.1.1.1
        right=2.2.2.2
        auto=start
        keyexchange=ikev2
        leftcert="/etc/ipsec.d/certs/leftside.pem"
        rightcert="/etc/ipsec.d/certs/rightside.pem"

/etc/ipsec.secrets for the left side:

1.1.1.1 2.2.2.2 : RSA "leftside.pem.key"

Right side should be obviously mirrored. You can also use the %any variant in ipsec.secrets, if needed.

Posted 2008-02-24 07:02 / Tags: Ipsec, Linux. / link

ifconfig sucks

On Linux, ifconfig is an archaic network interface configuration command. The implementation commonly encountered, "net-tools", has a number of problems which make it more and more unsuitable. The list of replacements is below.

1. Makes secondary addresses look like separate interfaces

People often get the impression that labeled secondary addresses are a separate interface (thanks to the dumb output of ifconfig, as a result of ioctl limitations), which in fact is not the case. You cannot use eth0:1 in iptables nor iproute2, so do not even think of eth0:1 being an interface on its own.

Similarly, you cannot set flags on these “interfaces”.

# ifconfig dummy0:1 1.2.3.4 up
# ifconfig dummy0
dummy0    Link encap:Ethernet  HWaddr FE:50:31:E6:14:17
          BROADCAST NOARP  MTU:1500  Metric:1
[...]

Still down. Obviously, since it is not an interface.

2. Overrides colon

Linux does allow interfaces to be composed of any characters, except the slash (to make it fit for filesystem exposure, cf. sysfs) and the NUL byte (obvious string terminator in C). As such, you could indeed have an interface called "eth0:foo", and properly interact with it with iproute2. But it would be inaccessible from ifconfig.

3. Cannot handle same-label addresses

Now that we have established that ifconfig essentially uses interface labels for lookups (when one is defined), one can notice that it does not — or more specifically, can not, because it uses an ancient BSD interface — deal with non-unique labels. In fact, it will miss out on the first result's label.

# modprobe dummy
# ip addr add 10.0.0.1/32 dev dummy0 label eth0:A
# ip addr add 10.0.0.2/32 dev dummy0 label eth0:A
# ip addr add 10.0.0.3/32 dev dummy0 label eth0:C

4. Locale-specific behavior

The output of ifconfig is localized, which means you get it in your preferred language. This for example breaks when other tools are used to parse its output, like grep in the simplest case. Writing a grep formula to automatically catch this is error prone. The use of resetting the environment LC_MESSAGES or LANG in every call is not that nice either.

5. Does not support non-labeled secondary addresses

The title speaks for itself. Execute the following with an IP address of your choice (given that eth0 already has an address), and it will not show up in ifconfig.

ip addr add 192.168.1.2/24 brd + dev eth0

6. Does not display peer address

You can set up a peer binding on Ethernet, but eventually, ifconfig will not show the peer that was just set.

# ip addr add 192.168.13.37/32 peer 192.168.13.38 dev eth0
# ifconfig eth0 192.168.13.37

7. Does not support nor use CIDR notation

ifconfig still operates with the old-fashioned netmasks (for IPv4).

8. Strange hardware address for tun tunnels and wmaster0 interfaces

`ifconfig tun0` gives lots of zeroes for the hardware address, but what for please?

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.0.254.6  P-t-P:10.0.254.5  Mask:255.255.255.255

Additionally, this is where parsers might choke on, since the hardware address does not match typical 48-bit MAC Ethernet format.

I hear InfiniBand addresses are 20 bytes in size, but ifconfig would only show 16.

9. Not developed anymore

Except for the patch mass that some distros accumulated, the net-tools package (the variant used in Linux distributions, at least) has not seen any significant upstream development after version 1.60, released sometime about April 15 2001.

Conclusions

Given that we have the successor ip from the iproute2 package with the features (including newer things like policy routing), there is just no need to continue using ifconfig. Consider to be ridiculed at when posting traces of utilizing it.

State of Linux distributions: openSUSE is known to exclusively use iproute2 for setting up networking during boot and installation. Debian and its offsprings are known to exclusively go the archaic way, and (as of 2008), things don't look brighter in Fedora either. (Update 2015-01: Once systemd-networkd gains hold in Fedora, one can be reasonably sure ifconfig is gone for boot.)

New equivalents

net-tools iproute2
ifconfig ip addr, ip link
ifconfig (interface stats) ip -s link
route ip route
arp ip neigh
netstat ss
netstat -M conntrack -L
netstat -g ip maddr
netstat -i ip -s link
netstat -r ip route
iptunnel ip tunnel
ipmaddr ip maddr
tunctl ip tuntap (since iproute-2.6.34)
(none) for interface rename ip link set dev OLDNAME name NEWNAME
brctl bridge (since iproute-3.5.0)

Posted 2008-02-19 21:02 / Tags: Linux. / link

cloneconfig/oldconfig/… considered harmful (orig.: “No cloneconfig needed!”)

Because a lot of articles, howtos, readmes and other sorts of text get it wrong, here's the stance:

It is often said to run

cd /usr/src/linux
make cloneconfig
make prepare

or something similar (like mrproper, oldconfig, prepare-all, etc.). This is not required for SUSE Linux (and perhaps other distros). When the binary kernel package and kernel-source is installed, the parts that would have to be configured are already present. A simple call to make (see below) is sufficient. Every external module package (that is sane) will do everything right automatically.

In fact, running `make cloneconfig` or any build operation inside /usr/src/linux will make it unclean so that (sane!) external modules' build process will abort with:

/usr/src/linux is not clean, please run 'make mrproper'
in the '/usr/src/linux' directory.

All of this is correct, since /usr/src/linux is ONLY a source directory, NOT the build directory. A few external module packages are, however, so broken that they fail to make this distinction and run into one of two problems: (1) they cannot find some header file, (2) says you have yet to configure your kernel (which is wrong of course).

Sanity...

There are however, some exceptions. The proprietary NVIDIA module is one of such a kind, which needs some undocumented extra options when calling `make`. (BAD BAD BAD).

make SYSSRC=/lib/modules/`uname -r`/source SYSOUT=/lib/modules/`uname -r`/build -f Makefile.kbuild

This one applies to the NVIDIA graphics driver kernel module only. Other packages might have even more braindead Makefiles that won't even let you set a SYSOUT directory.

For reference...

If you happen to write a kernel Makefile for an out-of-tree module, please, just do it the right way (i.e. with make -C objectdir):

MODULES_DIR := /lib/modules/$(shell uname -r)
KERNEL_DIR := ${MODULES_DIR}/build
all:
        make -C ${KERNEL_DIR} M=$${PWD};
modules modules_install clean:
        make -C ${KERNEL_DIR} M=$${PWD} $@;

Both $${PWD} or `pwd` work, the latter is slower due to the extra shell invocation.

About root

root is not needed for compilation, only for installing. Stick to it.

Posted 2007-04-12 10:04 / Tags: / link

The perfect Sun disklabel?

Disk /dev/sda (Sun disk label): 19 heads, 248 sectors, 7508 cylinders
Units = cylinders of 4712 * 512 bytes
 
   Device Flag    Start       End    Blocks   Id  System
/dev/sda1  u          0      7508  17688848    5  Whole disk
/dev/sda2             1        29     65968   83  Linux native
/dev/sda3  u          0      7508  17688848    5  Whole disk
/dev/sda4            30        58     65968   82  Linux swap
/dev/sda5            59      7508  17549844   83  Linux native

Explanation:

1. The first partition needs to start at cylinder 0. This is required for OpenBoot automatic booting. (You could otherwise boot by specifying a partition, e.g. boot disk0:c.) The /boot fs could also start at cyl 0 iff cylinder 0 is never touched (as is the case with ext2 and ufs) -- would not be the case with e.g. xfs. There is no other requirement, so I just made it a dummy partition marked as "Whole disk".

2. The /boot partition needs to be ext2, ext3, romfs or ufs, because that's the only thing SILO currently supports. There is no real reason it starts at cylinder 1, it could be anywhere. (Once upon a time, x86 BIOSes could only read from the first 1024 cylinders. But since this is neither x86 nor an old BIOS, so that's that.)

3. For compatibility reasons, I heard, the third partition should be "Whole disk".

4. The swap partition, if any, should be at the start (or near the beginning) of the disk because read speeds are higher there.

5. Finally the base filesystem.

Posted 2006-03-30 10:03 / Tags: / link