A(nother) Windows vs Linux rant

Today I had to format a PC and install Windows XP on a new disk for a guy I know. The PC was pretty old but I would never guess what I would find out inside it.
Check these two pics:

Yeap…there are peanuts inside!

Anyway, I installed the new hard disk inside, inserted the Windows XP installation disc (SP2 included) and my torture began. The PC specs were P4 1.6GHz with 256Mb RAM. The installation process took around 70 minutes including the 20 minute NTFS format of the new hard disk. I thought it was wiser not to quick format it and select the normal format method. Why is NTFS so slow when it comes to formatting ? 20 minutes for an 80Gb hard disk is an overkill….I formatted a new 800Gb ext3 (software) raid partition on linux, one month ago, in less than 10 minutes…

After those boring 70 minutes the installation was finally over. I rebooted the PC and faced a crawling machine. Responsiveness came back only after I disabled all visual enhancements and made it look like win2k. Still I had a huge problem though … drivers. I didn’t know the model name of the motherboard and the soundcard was onboard. Since the machine will be put someplace in order to only play some MP3s, I had to at least make the soundcard work. I took another look at the pictures (posted above) and I saw the motherboard model number sticker. I googled it and found some AGP and sound drivers and I was finally able to make it play some music.

My first question/rant is this…In Linux I have the lspci command that comes in every (as far as I know) installation and shows you the output of your PCs’ contents, what would I do in a default Windows installation if I hadn’t opened the PC and checked on the motherboards’ model number ? Is there a way to find out what’s inside the PC (with a default install) ? Oh well…in Linux I don’t even need to know my soundcard’s name because the linux kernel autodetects the proper module (aka driver for the windows readers of this post) and loads it. That simple.

And the second question/rant that comes to my mind… I read in many forums that people are really “mad” at Linux not being able to play their DVDs on the default installation. I wasn’t even able to make Windows see the onboard soundcard on the default installation and I had to download drivers from another pc (no network), would it play DVDs ? I guess not. So either most people use pirated Windows installation CDs/DVDs with programs like powerdvd pre-installed or they are just lying.

I hope Vista does not need to download drivers just to recognize an onboard soundcard…

How is a windows user benefited by the fact that Windows can (illegally) play MP3s while Linux needs to legally download the codecs, when Windows cannot even recognize the soundcard and play _any_ sound at all ?


Φυλακές Ζώων

Η αλήθεια...


Ύστερα από 2 μήνες δοκιμών και αλλαγών με την βοήθεια των agorf, cdimakop, Charmed[], Fuzz, mikeg, Rad, tasosos που είτε έκαναν beta testing είτε δάνεισαν εξοπλισμό, το νέο iloog LiveCD 7.02 είναι έτοιμο με πάρα πολλές αλλαγές σε σχέση με την παλαιότερη version 6.12.1.

Εκτός από τις καθιερωμένες ανανεώσεις πακέτων υπάρχουν πάνω από 80 καινούργια πακέτα σε σχέση με την έκδοση 6.12.1. Πολύ προσοχή δώθηκε στην καλύτερη υποστήριξη laptops με έμφαση στο power management. Πλέον o kernel υποστηρίζει ρυθμίσεις για cpu frequency και υπάρχουν μέσα utilities για την διευκόλυνση αυτών των ρυθμίσεων (cpufreq-set,κτλ). Προστέθηκαν επίσης αρκετά firmware για wireless κάρτες (Intel,broadcom,atmel,κτλ), modems (Sagem Fast 800) ώστε να μην χρειάζεται να τα κατεβάζετε από τις εταιρίες. Ο kernel υποστηρίζει πια πολύ περισσότερο hardware σε σχέση με προηγούμενες εκδόσεις.

Επίσης στο menu του fluxbox έχει προστεθέι μια μικρή περιγραφή για το κάθε πρόγραμμα, ώστε ακόμα και κάποιος που δεν ξέρει τις ονομασίες από τα προγράμματα να μπορεί να βρει αυτό που θέλει.

Για όσους διαθέτουν 16:9 οθόνες μπορούν ανοίγωντας το /etc/X11/xorg.conf να κάνουν μια μικρή αλλαγή στην 3η γραμμή και να υποστηρίζονται καλύτερα οι οθόνες τους (η αλλαγή περιγράφεται στα σχόλια της 3ης γραμμής του /etx/X11/xorg.conf). Για όσους αντιμετωπίζουν δυσκολίες με τον X server, και δεν ξέρουν πως να πειράξουν το /etc/X11/xorg.conf μπορούν να γράψουν: “vesachange.sh” και να αλλάξει ο driver αυτόματα σε “vesa”.

Μικρές αλλαγές υπάρχουν επίσης και στο backup/restore script (filetool.sh) το οποίο πλέον σώζει μόνο τις αλλαγές που γίνονται στο home directory, και δεν το σώζει ολόκληρο όπως παλιά, ώστε το backup να καταλαμβάνει λιγότερο χώρο.

Περισσότερες αλλαγές περιγράφονται στο αρχείο /etc/iloog/changelog μέσα στο LiveCD

Το νέο iso μπορείτε να το κατεβάσετε από την διεύθυνση http://ilug.void.gr/iloog/ . Στην ίδια σελίδα θα βρείτε και ένα μικρότερο delta αρχείο με το οποίο μπορείτε να μεταβείτε από την παλιότερη έκδοση 6.12.1 στην τελευταία 7.02.

Screenshots υπάρχουν στη σελίδα του iloog καθώς και στο flickr: http://www.flickr.com/photos/tags/iloog/

Δοκιμάστε το και πείτε μας την γνώμη σας στο forum του Ioannina Linux User Group 🙂

Cherry Cymotion Master Linux with Fluxbox

Some tips in getting Cherry Cymotion Master Linux (german layout image) to work with fluxbox (with Gentoo of course). This keyboard’s keys have a great feeling and a great “clickety click” sound. The 20% extra surface on the keys makes typing a lot easier but you need a couple of hours to get used to them. It’s worth it though.

First of all, don’t try to use the keyman software that Cherry provides. Just DON’T. Unless you ‘ve got LOTS of patience and some skills to fix the horrible configure/make scripts that it comes with. It’s horrible to set it up and you need to patch your kernel for it to work properly. What do you lose ? Just the K-key next to your Penguin Key (bye bye Windows Key) and the combinations that you can with the K-Key. This keyboard has SO many extra keys that you won’t need it (yet).

0) Create /etc/init.d/cherry with the following contents:
start() {
ebegin "Setting up Cherry Keyboard CyMotion Master on PS/2"
# Search Eject Home An Aus Media
# Up/Right Down/left Cut Paste Copy Desktop1
# Desktop2 Desktop3 Redo Undo
#setkeycodes e065 136 e070 161 e032 172 e05f 143 e063 145 e06d 171 \
# e00b 177 e012 178 e017 137 e00a 135 e018 133 e071 148 \
# e02c 149 e072 202 e007 129 e008 131 e05b 200
setkeycodes e065 136 e070 161 e032 172 e05f 143 e063 145 e06d 171 \
e00b 177 e012 178 e017 137 e00a 135 e018 133 e071 148 \
e02c 149 e072 202 e007 129 e008 131
eend $?
stop() {
ebegin "Restoring defaults for PS/2 keyboard"
# Search Eject Home An Aus Media
# Up/Right Down/left Cut Paste Copy Desktop1
# Desktop2 Desktop3 Redo Undo
setkeycodes e065 217 e070 000 e032 150 e05f 142 e063 143 e06d 226 \
e00b 000 e012 000 e017 000 e00a 000 e018 000 e071 000 \
e02c 000 e072 000 e007 000 e008 000 e05b 125
eend $?

Make it executable: chmod +x /etc/init.d/cherry
Start it: /etc/init.d/cherry
and add it to your default runlevel: rc-update add cherry default (on gentoo)

1) Take a look at your /usr/share/X11/XKeysymDB. This file includes all the available keyboard mappings you can have.

2) Change your Keyboard Inputdevice in /etc/X11/xorg.conf to include these (works in my current Xorg 7.1):
Option "XkbModel" "cymotionlinux"
Option "XkbVariant" "nodeadkeys"

Restart your X server.

3) Create a .Xmodmap file in your home dir and fill it with mappings from /usr/share/X11/XKeysymDB. Mine looks like this:
! Internet-Keys (Back, Forward, Stop, Reload, Search)
keycode 234 = XF86Back
keycode 233 = XF86Forward
keycode 232 = XF86Stop
keycode 231 = XF86Refresh
keycode 122 = XF86Search
! Multimedia-Keys (Play/Pause, Stop, Back, Forward, Eject)
keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext
keycode 204 = XF86Eject
! XPress-Keys left (Up, Down, Cut, Paste, Copy)
keycode 220 = XF86ScrollUp
keycode 143 = XF86ScrollDown
keycode 188 = XF86Cut
keycode 192 = XF86Paste
keycode 248 = XF86Copy
! XPress-Keys right (List 1, List 2, List 3, Redo, Undo)
!keycode 159 = XF86Launch0
!keycode 151 = XF86Launch1
!keycode 171 = XF86Launch2
!keycode 138 = XF86Launch3
!keycode 135 = XF86Launch4
! Premium-Keys (Calculator, Email, Browser, On/Off)
keycode 161 = XF86Calculator
keycode 236 = XF86Mail
keycode 130 = XF86HomePage
keycode 199 = XF86LogOff
! Main-Keys (-, +, Mute, Media-Player)
keycode 174 = XF86AudioLowerVolume
keycode 176 = XF86AudioRaiseVolume
keycode 160 = XF86AudioMute
keycode 129 = XF86AudioMedia
! @-Key
keycode 116 = XF86Terminal

Do a:
xmodmap ~/.Xmodmap

You can test your multimedia keys using xev.
If you want fluxbox to automatically load these binding each time you logon, put “xmodmap ~/.Xmodmap” somewhere (NOT in the end) inside your ~/.fluxbox/startup

4) Edit your ~/.fluxbox/keys and map the new keys to actions like that:
None XF86Launch1 :Workspace 1
None XF86Launch2 :Workspace 2
None XF86Launch3 :Workspace 3
None XF86AudioPrev :ExecCommand audacious--rew
None XF86AudioPlay :ExecCommand audacious --play-pause
None XF86AudioNext :ExecCommand audacious --fwd
None XF86AudioStop :ExecCommand audacious --stop
None XF86Eject :ExecCommand audacious -j
None XF86AudioLowerVolume :ExecCommand amixer sset PCM 2-
None XF86AudioMute :ExecCommand amixer sset "Audigy Analog/Digital Output Jack" toggle
None XF86AudioRaiseVolume :ExecCommand amixer sset PCM 2+
None XF86AudioMedia :ExecCommand gmplayer
None XF86Calculator :ExecCommand gcalctool
None XF86Mail :ExecCommand /usr/bin/thunderbird
None XF86HomePage :ExecCommand /usr/bin/firefox
None XF86Terminal :ExecCommand mrxvt --loginShell

Restart Fluxbox. You should now be able to start applications using your multimedia keys on top and on the bottom. If you are using Gnome or KDE you can do all this with their own programs. I think the proper program in KDE is called khotkeys.

5) In order to use the side keys for more advanced functions like copy,paste,unde,redo,etc do the following:
Create /usr/share/X11/xkb/compat/cymotion with what you like. Mine looks like:
// $XFree86$
// XFree86 special keysyms
default partial xkb_compatibility "basic" {
interpret.repeat= True;
// Ctrl+C for Copy
interpret XF86Copy {
action = Redirect(Key=<AB03>, modifiers=Control);
// Ctrl+V for Paste
interpret XF86Paste {
action = Redirect(Key=<AB04>, modifiers=Control);
// Ctrl+X for Cut
interpret XF86Cut {
action = Redirect(Key=<AB02>, modifiers=Control);
// Ctrl+Pos1 for ScrollUp
interpret XF86ScrollUp {
action = Redirect(Key=<HOME>, modifiers=Control);
// Ctrl+End for ScrollDown
interpret XF86ScrollDown {
action = Redirect(Key=<END>, modifiers=Control);
// Ctrl+Shift+Z for Redo
interpret Redo {
action = Redirect(Key=<AB01>, modifiers=Shift+Control);
// Ctrl+Z for Undo
interpret Undo {
action = Redirect(Key=<AB01>, modifiers=Control);
// Backspace for Back (Firefox)
interpret XF86Back {
action = Redirect(Key=<BKSP>);
// Shift+Backspace for Forward (Firefox)
interpret XF86Forward {
action = Redirect(Key=<BKSP>, modifiers=Shift);
// ESC for Stop (Firefox)
interpret XF86Stop {
action = Redirect(Key=<ESC>);
// Ctrl+R for Reload (Firefox)
interpret XF86Reload {
action = Redirect(Key=<AD04>, modifiers=Control);
// Ctrl+F for Search Page (Firefox and most other applications)
interpret XF86Search {
action = Redirect(Key=<AC04>, modifiers=Control);

6) Edit /usr/share/X11/xkb/compat/complete and add inside it:
augment "cymotion"

Restart X.

And you should be done.

The process is a bit complicated but the result is very rewarding. The Cut/Copy/Paste with just one click is amazing, especially for Greek users because when someone with another keyboard switches the keyboard language to greek, “ctrl+c” becomes “ctrl+ψ” (ctrl+greek_psi) and copy/paste does not work any more (ctrl+insert and shift+insert are not very efficient shortcuts) . You can easily program Cymotion Master Linux keyboard though to send the keystrokes you want (that was what I did in /usr/share/X11/xkb/compat/cymotion) because there are so many extra keys to use 🙂

Here comes the result of all these (click to maximize):

a) http://forums.gentoo.org/viewtopic-t-261126-highlight-cymotion.html
b) http://www.ubuntu-forum.de/thread.php?threadid=11319
c) http://my.opera.com/netzpirat/blog/show.dml/505978

Zenwalk vs iloog on an ancient Compaq laptop

Testing Zenwalk version 4.2 on an ancient Compaq Presario 1260 Laptop (AMD K6@333 with 64Mb RAM).

0) Install CD Boots pretty fast
1) Autopartition does not work, or it did not work for me. I’ve tried it two times both giving me an empty partition table thus being unable to continue the installation.By the way, why does it need at least 1Gb of swap space ?
2) Why can’t netpkg use more than one mirror concurrently since they’ve got different packages ? I’ve tried to select 2 mirrors from the menu but I didn’t work. Am I doing something wrong ?
3) XFCE was not light enough for this ancient laptop. I tried disabling various stuff from the panels…but it was still very slow to work with. So I used netpkg (from the command line) to add Fluxbox. Fluxbox was a lot faster than XFCE but still applications were pretty slow to start.
4) There was no APM support on the kernel. No battery status for the laptop 🙁

Overall I think that zenwalk is an “ok” distro but it’s still pretty rough around the edges. It still need some slackware-ish hacks to behave like it should.

The good part about Zenwalk testing was that it made me “install” iloog on a hard disk for the first time, so I could compare the two. Zenwalk and iloog.

I booted the iloog livecd,
a) rsynced /(root) to /mnt/hda2,
b) mount /proc, /sys to /mnt/hda2 and chrooted to it,
c) changed /etc/fstab to suit the laptop’s hard disk (beware to remove some of the noexec, nosuid options),
d) created a /etc/lilo.conf from /etc/lilo.conf.example and ran “lilo”
e) disabled some init scripts needed by the livecd for autoconfiguration
f) rebooted

and … the result was very very good. Applications start in a lot less time than they start with zenwalk and are generally more responsive. Firefox, for example, is actually usable in iloog in contrast with zenwalk where there was no way to use it…it took around 1 minute just to start it! I didn’t expect to see such a difference because zenwalk is supposed to be a “light” distro specifically for old machines (ok, maybe not as old as mine :P)
The bad thing is that since iloog is based on gentoo, it is almost impossible to emerge new applications on that laptop while it is very easy to do so with zenwalk using netpkg. It may be possible to install new application on iloog with a) distcc but it requires another strong PC to act as the “compiler PC” , b) by getting binary packages from another user’s repo (that sounds more like science fiction) debianizing the gentoo/iloog.

If anyone has an ancient laptop, like the one I have, he/she might want to give iloog a shot. It may revive it…

P.S. All that may be a bit biased towards iloog since I am the one developing it. I still think though that iloog is more suited as a livecd for educational/scientific purposes than as an installable meta-meta-distro (since gentoo is already a meta-distro). Once you actually install it to your hard disk it’s not iloog any more…but gentoo.

P.S.2. The latest iloog beta is here: . If anyone tests iloog livecd please leave a comment.

ATI-8.32.5 blank screen fix

I’ve just upgraded my ATI drivers from 8.29.6 to 8.32.5, restarted my X and was greeted with a very beautiful blank/black screen. Playing a bit with my ModeLine in xorg.conf though I was able to make it work again.

I just needed to change:
Modeline "1280x1024_75.00" 138.54 1280 1368 1504 1728 1024 1025 1028 1069 -HSync +Vsync

Modeline "1280x1024_75.00" 138.54 1280 1368 1504 1728 1024 1025 1028 1069

This Modeline created by gft makes my monitor work at 75Hz instead of the 60Hz that ddc provides to xorg.

I don’t know why but it looks like the new drivers don’t like the polarity options that the previous drivers had no problem with…

Anyway, here’s the part of my xorg.conf referring to my Monitor and Graphics Driver that currently works:

Section "Monitor"
Identifier "Monitor0"
VendorName "LG"
ModelName "L1970H"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 75.0
# 1280x1024 @ 75.00 Hz (GTF) hsync: 80.17 kHz; pclk: 138.54 MHz
Modeline "1280x1024_75.00" 138.54 1280 1368 1504 1728 1024 1025 1028 1069
Option "DPMS"
Section "Device"
Identifier "ATI 9500 Pro"
Driver "fglrx"
Option "no_accel" "no"
Option "no_dri" "no"
# === misc DRI settings ===
Option "mtrr" "off" # disable DRI mtrr mapper, driver has its own code for mtrr
Option "DesktopSetup" "Single"
Option "HSync2" "unspecified"
Option "VRefresh2" "unspecified"
Option "ScreenOverlap" "0"
# === TV-out Management ===
Option "ForceMonitors" "tmds1,notv"
Option "TVStandard" "NTSC-M"
Option "TVHSizeAdj" "0"
Option "TVVSizeAdj" "0"
Option "TVHPosAdj" "0"
Option "TVVPosAdj" "0"
Option "TVHStartAdj" "0"
Option "TVColorAdj" "0"
Option "GammaCorrectionI" "0x06419064"
Option "GammaCorrectionII" "0x00b0000b"
# === OpenGL specific profiles/settings ===
Option "VideoOverlay" "on"
# === OpenGL Overlay ===
Option "OpenGLOverlay" "off"
# === Center Mode (Laptops only) ===
Option "CenterMode" "off"
# === Pseudo Color Visuals (8-bit visuals) ===
Option "PseudoColorVisuals" "off"
# === QBS Management ===
Option "Stereo" "off"
Option "StereoSyncEnable" "off"
# === FSAA Management ===
Option "UseFastTLS" "1"
Option "UseInternalAGPGART" "yes"
Option "FSAAEnable" "on"
Option "FSAAScale" "2"
BusID "PCI:1:0:0"

And the glxgears result:
17418 frames in 5.0 seconds = 3483.523 FPS
17341 frames in 5.0 seconds = 3468.088 FPS
17428 frames in 5.0 seconds = 3485.311 FPS
17548 frames in 5.0 seconds = 3509.505 FPS

Vivodi Full LLU και Packet Filtering ?

Χθες προσπαθούσα να βοηθήσω κάποιον στο IRC να βάλει gentoo (δεν χρειάζονται σχόλια 😛 ). Είχε διαβάσει το gentoo handbook φτάσει στο σημείο που πρέπει να κατεβάσει το stage3 tarball (Παράγραφος 5a του handbook). Αρχίζει να κατεβάζει όλο χαρά το stage3 tarball από το mirror του ntua (http://ftp.ntua.gr/pub/linux/gentoo/releases/x86/current/stages/stage3-i686-2006.1.tar.bz2) και ξαφνικά κολλάει στο 72%. Το ξαναβάζει…τα ίδια. Δοκιμάζει με ftp αντί http….τα ίδια. Του δείχνω το wget -c ώστε να κάνει resume…τίποτα…δεν γινόταν resume. Του λέω ότι εγώ στο σπίτι μου το κατεβάζω κανονικά (Vivodi με γραμμή ΟΤΕ)…και του δίνω το mirror του uoi. Αρχίζει το download από την αρχή, στο 72% πάλι κόψιμο. Δοκιμάζει να κατεβάσει το αρχείο από windows ώστε να το περάσει μετά με usb flash στο gentoo, πάλι κόλλημα στο 72%. Δοκιμάζει mirror από την Γερμανία, τα ίδια…ενώ εγώ να το κατεβάζω κανονικότατα σε 2-3 διαφορετικές dsl. Του λέω δεν γίνεται…κάποιο δικτυακό πρόβλημα έχεις. Του ζητάω να μου ανοίξει ssh πάνω στο PC που θα γινόταν το install, δοκιμάζω και εγώ να το κατεβάσω…τίποτα…ούτε με links ούτε με wget, πάντα κόλλημα στο 72%. H κάρτα δικύου έπαιζε κανονικά…collisions, errors όλα μηδενικά.

Λέω…δεν γίνεται, το modem σου πρέπει να έχει πρόβλημα, κάποιο time-out γίνεται…δεν βγάζω άκρη. Τον ρωτάω αν έχει 2ο adsl modem, μου απαντάει θετικά και το αλλάζει κατευθείαν. Αρχίζει πάλι το download, στο 72% πάλι τα ίδια. Η κατάσταση ήταν πλέον για κλάμματα.
Τον ρωτάω τη σύνδεση έχει και μου απαντάει Vivodi Full LLU στην Πάτρα. Τον ρωτάω έπειτα αν έχει κανένα άλλο φίλο/γνωστό με full LLU στην Πάτρα και μου απαντάει θετικά. Βάζει το γνωστό του να κατεβάσει το ίδιο αρχείο…και ναι…κολλάει στο 72% !!!! Παράλληλα ο γνωστός του αυτός του αναφέρει πως ακούγεται πως η Vivodi έχει στήσει filtering σε κάποια σημεία του δικτύου της…
Η τελευταία ελπίδα ήταν να πειράξω το mirror του uoi ώστε να απαντάει και σε https ώστε τα πακέτα να είναι encrypted και να μην μπορούν να τα πιάσουν τα οποιαδήποτε φίλτρα. Δοκιμάζει να το κατεβάσει με https…και όντως δούλεψε! Πέρασε το 72% και ολοκληρώθηκε χωρίς κανένα πρόβλημα…

Το συμπέρασμα είναι πως σίγουρα το dslam της Vivodi στην Πάτρα είναι προβληματικό. Πολύ πιθανό η Vivodi να εφαρμόζει κάποιο packet filtering, και το συγκεκριμένο αρχείο στο “72%” να κάνει trigger ένα από τα filtra της vivodi και να γίνεται corrupt ύστερα. Εγώ δεν μπορώ να το εξηγήσω διαφορετικά. Αν κάποιος μπορεί και έχει μια άλλη εξήγηση…ευχαρίστως να την ακούσουμε…Αν επίσης κάποιος με full LLU από Vivodi έχει λίγο χρόνο ας δοκιμάσει να κατεβάσει το αρχείο:


και να μας πει αν κολλάει στο 72%. Αν ναι ας πει και σε ποια πόλη/περιοχή μένει…μήπως και βγει κάποια άκρη…

Εννοείται πως σήμερα όταν ο άνθρωπος αυτός πήρε τηλέφωνο στην Vivodi να ρωτήσει πως και γιατί…δεν είχαν να του πουν τίποτα. Ποιος όμως θα τον αποζημιώσει για τις 4-5 και παραπάνω ώρες που έχασε και κόντεψαν να τον φέρουν σε κατάσταση υστερίας ?

Thoughts on the evolution of Operating Systems

Linux is a multiuser operating system “designed to be secure by design”. Each user has it’s own home directory and can only execute applications that the Administrator (root) of the system has allowed him to. That means that users that want to run priviledged applications must either have root’s permission to do so or are asked for a password to escalate their priviledges. So every linux user not only knows the difference of a simple user and the “root of all evil”, but is well aware of where/when to use passwords, what are file permissions and so on and so on. A linux user has (or had, until recently) given up pretty graphics in favor of a more stable, more secure and more “free” operating system.

Windows is a (multiuser?) operating system with emphasis on usability. Since the first windows versions, the users of windows got used to being able to do almost everything without ever being asked for another password than the one at the login screen. Sometimes there wasn’t even such a login screen. A windows user is used to doing administrative tasks with his every day account. Most windows users don’t even know about file permissions and how to use them on their system. That makes life both easier and riskier.

Until broadband came to our lives at the very end of the 20th century, when Windows 98 and ME ruled the IT universe, windows users had very little to fear. While they only exchanged files with their friends on floppies and cdroms, and their computers were not 24/7 online, remote exploits, internet worms and trojans were unknown words to them. A decent antivirus was the only thing required. Windows 98/ME did not even have “services” running on them by default (apart from shared folders). During that time Microsoft only had to worry about making their users’ OS easier and more beautiful. And they were pretty successful in that.
Their server (NT) version though had tons of problems. It was very incompatible with a lot of software and was easily attacked by internet worms. The number of service packs for NT reached a ridiculous number, and still Microsoft couldn’t handle all the problems. Their enhanced server edition, Windows 2000 was a lot better than NT, but the security weaknesses remained. What made Windows NT and Windows 2000 so insecure was that they were supposed to be 24/7 online. The bad guys attacked WinNT and Win2K because they could then use them for their own purposes. A hacked win98 box behind a dialup was useless compared to an always online windows server. While more and more windows 2000 servers were getting online and worms hammered them, more and more people started bitching Microsoft about it. Microsoft tried to fix problems those problems with numerous service packs, but that wasn’t enough.
Then came Windows XP, the first Microsoft OS for users that had various services enabled by default. At the same time more and more people started having broadband at their homes. Now the bad guys had something new and more powerful to fiddle, and it wasn’t long until the first remotely exploitable problems appeared. The bad guys created worms and trojans that attacked WinXP, the OS of millions users. Users’ machines are millions more than server machines, and they were all probable targets/victims for those worms. If a remotely exploitable vulnerability was somehow found for Win98, the impact would be a lot smaller because the number of online PCs was a lot smaller back then . Every remotely exploitable hole found for XP drove users crazy. XP was not designed to be secure, it was to designed to be a _lot_ more beautiful than 98/ME. It was designed with multimedia, games, office work, etc in mind. People started asking for more than an antivirus for their PCs and a new word came to every windows user life, “Firewall”. Then came service pack 1, then service pack 2…and problems still existed and will exist even if a service pack 3 is launched sometime in the future. One of the basic problems with Microsoft XP is that it doesn’t help users understand how and when to use the Administrator account. Most users create a user with Administrator privileges during XP’s installation process and then run their machines with that admin account. This is _plain_ wrong. Every windows XP user feels that he can do everything he wants with his PC without ever being asked for a single password. So when something infects their PC and runs with their user’s privileges, it actually runs as the administrator of the machine. This leads to total destruction.

Vista is said to have a different approach to security though. It has supposedly been built from scratch with security in mind. Users are now ‘just users’ and their default account does not have administrative privileges. So every time they want to do an administrative task dozens of warnings appear before them. That supposedly ensures that nothing can run with administrative privilege unless the user explicitly wants it to be that way. Someone I know who used Vista told me that Vista makes you think that it’s for more advanced users than XP was. All these notifications that pop up asking you for permission to do this and that, makes you feel a bit uncomfortable. New users of computers, that first stumble upon Vista will feel much more uncomfortable with that OS than they would feel if their first OS was XP. And that’s bad for a “Windows OS”, every version until Vista was easier to use than the previous one, apart from Vista…which is harder.
Microsoft with Vista acts as parent who has spoiled their children for a veeeery long time, giving them free chocolates and candies even though they knew that by doing this they hurt their children’s health, and are now trying to put them on a diet. And this just can’t be done. Windows have spoiled users for more than 10-15 years and it’s too late to start telling people, “Hey mind your security!”. “Your account is now on a diet, no more candies for you”.

When Vista starts spreading among users (maybe in 1 year from now?), users themselves will eventually understand more and more about security concepts. They will start to understand why it is so important that the administrative account is something completely different than theirs and why they should only “touch” it occasionally. Vista might be a lot more beautiful as an OS but it will be a lot more difficult for users to “manage”. Nag screens will be all over the place. Passwords might be frequently asked to change something fundamental for the system.

Where does this lead ? Users will get more and more acquainted with the whole administrator’s rights idea and Linux will not look so much like an alien OS to them. The transition from Windows to Linux for users will get easier and easier as linux becomes (slowly and painfully) more good looking and windows becomes (slowly and painfully) more secure.

Every OS has a different beginning and a different approach on evolution, but they tend to meet at some place in the future. They have just taken different roads to reach their goal. Windows prefers user-friendliness over security and stability and linux prefers it the other way around.

Traffic shaping TorrentFlux

*Update on peers supporting encryption at the end of the post*

TorrentFlux is a great program/interface to download your torrents remotely on a linux machine. It is based on php and it uses a modified bittornado client to download the torrents.

The problem: The bittornado client is able to put specific limits on a per torrent basis. That means that you can put a 100kb/sec download and 50kb/sec upload limit per torrent through torrentflux’s web interface. If you have 20 torrents though, this easily becomes 20*50=1Mb/sec upload “limit”. There are cases that you don’t want this to happen and you want both a per torrent limit (eg 50kb/sec) and a global limit (eg 300kb/sec).

The solution: My solution is based on iptables, layer7 filter and tc (iproute2). I am using layer7 filter to pick out the bittorrent packets, iptables to mark those packets with specific values and tc to shape those marked packets into categories. Beware that the method I am using works mostly on the “uploading” part (outgoing traffic). It is not that hard to make it work for the incoming traffic as well, but it is my personal view that downloading with a few Mb/sec is not as harmfull as uploading with a few Mb/sec. I usually have my downloads seeded over many weeks…so it’s good for my ratio to have the torrent downloaded as fast as possible and then seed it endlessly. I usually like to seed until i get a ratio over 1000% per torrent (that means 10 times as much uploaded traffic than downloaded). The following example configs are created for use on a 100mbit line and keeping in mind that outgoing torrent traffic should not exceed 2-2.5Mbits (~250-300kb/sec).

The procedure:
0) Before you begin make sure you have the kernel sources on /usr/src/linux.

1) Then, you need to patch your kernel for layer7 filtering and enable marking. On gentoo linux you only need to:
#emerge -avt net-misc/l7-filter net-misc/l7-protocols
and then configure your kernel for marking.

Here’s how my netfilter configuration looks like:


# Core Netfilter Configuration

# IP: Netfilter Configuration
# CONFIG_IP_NF_RAW is not set

You can clearly see layer7 being enabled as a module: CONFIG_IP_NF_MATCH_LAYER7=m
Rebuild your kernel and install the proper modules. If you need to reboot your machine to apply the new kernel do it now.

2) Now it’s time to install iptables and iproute2 if you don’t have them already. On gentoo linux:

#echo "net-firewall/iptables extensions l7filter" >> /etc/portage/package.use
#emerge -avt net-firewall/iptables sys-apps/iproute2

3) Now it’s the iptables marking time. I am going to show you (some of) the output of my iptables-save command. Change it to fit your neeeds:

# Generated by iptables-save v1.3.5 on Fri Jan 12 20:50:52 2007
:PREROUTING ACCEPT [1102387:193393325]
:INPUT ACCEPT [1102372:193390208]
:OUTPUT ACCEPT [2100485:2922693566]
:POSTROUTING ACCEPT [2100483:2922690566]
-A PREROUTING -s IP.OF.MACHINE -p tcp -m multiport --sports 22,80 -j MARK --set-mark 1001
-A PREROUTING -d IP.OF.MACHINE -p tcp -m multiport --dports 22,80 -j MARK --set-mark 1001
-A PREROUTING -m layer7 --l7proto ssh -j MARK --set-mark 1001
#-A PREROUTING -m layer7 --l7proto bittorrent -j MARK --set-mark 11090
-A PREROUTING -m mark --mark 1001 -j RETURN
-A POSTROUTING -s IP.OF.MACHINE -p tcp -m multiport --sports 22,80 -j MARK --set-mark 1001
-A POSTROUTING -d IP.OF.MACHINE -p tcp -m multiport --dports 22,80 -j MARK --set-mark 1001
-A POSTROUTING -m mark --mark 1001 -j RETURN
-A POSTROUTING -m connmark --mark 0x0 -j MARK --set-mark 11030
-A POSTROUTING -m layer7 --l7proto dns -j MARK --set-mark 11010
-A POSTROUTING -m layer7 --l7proto ssh -j MARK --set-mark 11010
-A POSTROUTING -p tcp -m tcp --tcp-flags SYN,RST,ACK SYN -j MARK --set-mark 11010
-A POSTROUTING -p icmp -j MARK --set-mark 11010
-A POSTROUTING -m layer7 --l7proto bittorrent -j MARK --set-mark 11090
# Completed on Fri Jan 12 20:50:52 2007
# Generated by iptables-save v1.3.5 on Fri Jan 12 20:50:52 2007
:OUTPUT ACCEPT [111:6662]
# Completed on Fri Jan 12 20:50:52 2007
# Generated by iptables-save v1.3.5 on Fri Jan 12 20:50:52 2007
:INPUT ACCEPT [266369:32040284]
:OUTPUT ACCEPT [479227:676859047]
# Completed on Fri Jan 12 20:50:52 2007

You need to change IP.OF.MACHINE with the IP of your linux box.

4) And now the traffic shaping part:

# Main Link
# High Priority
# Normal
# Downloads
# del old
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
# add root
tc qdisc add dev $DEV root handle 100: htb default 1
tc class add dev $DEV parent 100: classid 100:1 htb rate ${LINK}kbit
tc qdisc add dev $DEV parent 100:1 handle 1: htb
tc class add dev $DEV parent 1: classid 1:1 htb rate ${SHAPEDLINK}kbit
# some more rules
tc class add dev $DEV parent 100: classid 100:1 htb rate ${LINK}kbit
tc qdisc add dev $DEV parent 100:1 sfq perturb 10
tc filter add dev $DEV parent 100:0 protocol ip prio 1 handle 1001 fw flowid 100:1
tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${SHAPEDLINK}kbit ceil ${SHAPEDLINK}kbit prio 5
tc qdisc add dev $DEV parent 1:10 sfq perturb 10
# High priority
tc class add dev $DEV parent 1:10 classid 1:1010 htb rate ${HIGHPRIO}kbit ceil ${HIGHPRIO_MAX}kbit prio 0
tc qdisc add dev $DEV parent 1:1010 sfq perturb 10
tc filter add dev $DEV parent 1:0 protocol ip prio 0 handle 11010 fw flowid 1:1010
# normal
tc class add dev $DEV parent 1:10 classid 1:1030 htb rate ${NORMAL}kbit ceil ${NORMAL_MAX}kbit prio 5
tc qdisc add dev $DEV parent 1:1030 sfq perturb 10
tc filter add dev $DEV parent 1:0 protocol ip prio 5 handle 11030 fw flowid 1:1030
# bittorent
tc class add dev $DEV parent 1:10 classid 1:1090 htb rate ${TOR}kbit ceil ${TOR_MAX}kbit prio 10
tc qdisc add dev $DEV parent 1:1090 sfq perturb 10
tc filter add dev $DEV parent 1:0 protocol ip prio 10 handle 11090 fw flowid 1:1090

The rules are pretty straightforward…so I am not going to fully explain them. The basic concept is that you create a “shaped” partition of your bandwith and you add classes (high priority, normal , bittorrent) there. The trick is that you can skip anything you don’t want shaped by marking it with iptables 1001 mark.

In my iptables example above, I mark as 1001 the outgoing ssh and http traffic. This way I can shape the seeding of my torrents using TorrentFlux but I can download via http without any traffic shaping the torrents to my PC at home. I can also ssh to the machine without any latency caused by the shaping because the sshd port (22) is marked with 1001.

The only problem I faced with those scripts was that sometimes the layer7 filter for bittorrent let’s some torrent traffic pass by. My solution to that was to change NORMAL_MAX=$SHAPEDLINK to NORMAL_MAX=2048 for example. Then, even “normal traffic” was shaped. Remember that anything I didn’t want shaped, was marked as 1001 on the iptables script…so the machine was still very responsive even after shaping the “normal traffic”.

To check how your scripts are doing in terms of shaping you can download this excellent perl script: tc-viewer. Click here for a screenshot: tc-viewer htb screenshot

The above example configs are very very generic. If you have a server that serves many other duties apart from ssh, http and bittorrent, then this script might not work out of the box for you.

It looks like the problem I had with layer7 bittorrent filter missing packets was not actually a layer7’s “problem”, but rather a new feature of the latest version of bittornado. I was using bittornado version 0.3.18 (experimental) which is the first bittornado version that comes with Message_Stream_Encryption. What this means: whenever bittornado finds another peer with encryption capabilities, it encrypts all traffic between you and the other peer, so the layer7 filter cannot understand that these flows are torrent traffic anymore, and categorizes them as “normal” traffic. That’s why I needed to “shape” normal traffic as well.
There are three ways to cope with encrypted bittorrent traffic. The first one is the one I described above without even knowing about it (shaping normal traffic). The second way is to go back to a version without encryption (0.3.17), which I think is a _really_ bad idea. Encryption came to help us hide our traffic from ISP filters, and is a step we can all take to protect ourselves. The third way is to mark the port range that torrentflux uses (check the admin panel of torrentflux for it) as torrent traffic by our iptables script. If the port range is high enough it can be almost certain that no other service will use those ports, so no priority traffic will be mis-matched as “torrent traffic”. If, for example, you have defined your port range to be from port 61000 to port 63000, then inject a command like:
-A POSTROUTING -p tcp --sport 61000:63000 -j MARK --set-mark 11090
just below the
-A POSTROUTING -m layer7 --l7proto bittorrent -j MARK --set-mark 11090
command of the iptables script above.

Enjoy shaped encrypted bittorent uploads! Keep seeding…

Random stuff

I’ve made a few changes to the sidebar of my blog, I’ve added last.fm Recent Tracks listing and a Meebome widget. The meebome widget is a very nice flash application that let’s you chat with visitors of your site while being online on meebo. I was introduced to meebo sometime ago by thatha. It is an “Instant Messaging Portal”, you create an account and then you can log in to your msn, icq, yahoo, aim, jabber and gtalk account. I use it whenever I am away from my pc, since I find it a lot more “comfortable” to log in to the networks I am interested through meebo than through Portable Gaim that I keep on my usb flash drive.

btw…Gaim is so broken these days…Looks like noone is interested to fix the aging problems it has. No nat-to-nat transfers, random crashes even on normal filetransfers. Even the developer(s) suggest that you use the beta version to log in to msn. How dumb is this ? What are they waiting for ? Since even the developer promotes the beta in favor to the “stable”..shouldn’t the beta be named as “stable” now ? Noone is still using Gaim 1.5.0 …all the latest gnome based distros use 2.0-betaX…

I’ve steadily become more and more unsupportive of OLPC. There are many reasons to this. First of all I think that it made by western people believing that they know what is better for africans or asians. That’s plain wrong. In my view the OLPC is something that western rich kids will enjoy far more than poor africans or asians. It’s a “western toy” for “western rich kids”. Then comes the “open-ness” of the whole project. In the beggining everything looked very promising, then came the closed source drivers and firmwares. I don’t care for whatever reasons Marvell doesn’t open source the wifi driver, but if someone touts for a “complete open source project”, then e v e r y t h i n g must be open source. Not whatever we like. Oh, and then came the added sd card slot in order for the OLPC to be able to run a version of windows. That’s open source too right ? More bashing of the OLPC on beranger.