MENU

Sunday, 5 April 2015

Kwort 4.2

Oh well, Kwort, my old friend, it's a love-hate relationship. Kwort is an experiment; it always was for me. At some stage I wanted to use it more seriously, especially on servers but interests faded away at some point (work overtook my private life, I guess). In the past I used Kwort to base my own personal ideas on, I say it: gnx.in; I wanted to deliver the ultimate...ah, I spare you on that :). Just one thing I really was shocked about: gnx.in is 8+ years ago; I used pkgsrc from netbsd and while chatting with David Cortarello today I realized I still remember it. I'm still shocked that gnx.in is 8+ years ago...that also means I'm using Kwort for 8+ years...holy crap!

However, I turned into some "lower-level-guy" again just because it's something I was doing in the past but forgot to do in the present. I started with asix a few weeks ago just to get in touch with "lower-level" linux. Not just the user-land tools provided by Gnu.

And just because David hacked on a new version of Kwort, I'm more or less writing down how to set up Kwort 4.2. It might wonder you that this has to be explained but Kwort 4.2 doesn't have an installer anymore and this is on purpose. I first thought "come on!" but it's better that way. In fact it's extremely flexible this way. You can set it up from an sd card, your usb pen and a cd. And in the end you really know what you did.

So here we go...

hint1: there is no setup :P. Ya, ok, some sort of setup but not the one you are used to (it's not bad!).
hint2: mcedit is available :P (phew! no crappy vim you have to use :P; sorry)
hint3: if you have a german keyboard layout: "loadkezs de" :P.
hint4: you need at least 512mb of ram or it will panic at boot; the kernel image is big.
opinion1: Kwort isn't made for the every-day ubuntu-joe. If you have no real clue about linux and related software, you will feel frustrated.

1. cfdisk /dev/sd* or even hd* where * is your drive actually :P; be careful not to wipe the wrong drive
2. mkfs.ext4 /dev/sda1 (or whatever you set up in cfdisk)
3. mkswap /dev/sda2 (or whatever you set as your swap partition in cfdisk)
4. mount -t ext4 /dev/sda1 /mnt/install
5. mount /dev/cdrom /mnt/kwort (this really depends; if you are booting from a usb pen or sd card, just mount /dev/sd*)
6. pkgsinstall
7. jumpOS (does some chroot thing)
8. edit "/etc/fstab" in your chroot environment

add
/dev/sda1 / ext4 defaults
/dev/sda2 swap swap defaults

9. edit "/etc/rc.conf"

add
KEYMAP=qwertz/de-latin1
HOSTNAME=kwort42

10. passwd (set root password); if you forget that you will be asked to set it on the first login
11. install lilo from "/root/bootloaders"
# kpkg install lilo-no-LVM*

12. IMPORTANT: edit "/etc/lilo.conf"
12.1 replace "#DEVICE#" with "sda" and "#ROOT_DEVICE#" with "sda1"
12.2 replace "vmlinuz" with "vmlinuz-3.19.2"
12.3 type "lilo" or it won't boot (at least that was the case 10 years ago)

Setting up a bootloader can screw things up. I suggest to use a dedicated drive for Kwort. This is how I do it. Setting up a bootloader to boot Windows and Linux is possible but it's safer if you just use a dedicated drive.

In the case you _are_ using a dedicated drive for Kwort, you probably have to add something like this:
disk = /dev/sda inaccessible
disk = /dev/sdb inaccessible
...to your "lilo.conf"; otherwise lilo will ask you if you have a windows bootloader. If you say "Y", it will abort though you don't want to install a bootloader to your windows drive. It has something to do with volume ids. I have no idea why lilo aborts. But by ignoring the windows drives it works fine.

My lilo.conf:
disk = /dev/sda inaccessible
disk = /dev/sdb inaccessible

lba32
timeout = 50
boot = /dev/sdc
prompt

image = /boot/vmlinuz-3.19.2
        label = KWORT
        root = /dev/sdc1
        read-only

You're done. Congratulations! You can now reboot.

Ok, not completely done. After a successful boot, add a user:
# useradd user1
# mkdir /home/user1
# passwd user1
# chown user1:users /home/user1

Then logout "root" and login "user1". You can now "startx" and enjoy Kwort.

Some notes

The Kernel, yessir!

The kernel used by Kwort is quite big; if you take a look at /proc/config.gz you will notice almost everything is configured to be built as a module. The problem here is not the "module" but the "everything" :). If you boot Kwort you will have a minimum ram usage of approx 52MB. That's not much and acceptable as the default Kwort kernel works for most of my hardware out of the box but when I compile a kernel that just supports my hardware, Kwort only "eats" 9MB of my ram. The boot time isn't considerably faster as linux hangs quite some time checking bios "things" (who knows...). So in the end I just used the default Kwort kernel because it just works.

Wireless "things"

I use linux for many years now but what I never tried was using a wireless lan adapter with linux; I always used an access point (via ethernet) that acted as a client for my wlan router. So in practice I never had to fiddle with stupid wifi hardware or experimental wifi modules. But this time I tried it.

The good thing is that Kwort ships many firmware files in /lib/firmware; what Kwort doesn't know is how certain modules try to load them. In my case it wanted to load "rt2870.bin" from /lib/firmware but it was actually stored in /lib/firmware/ralink. Not a real problem; just something I noticed. I believe Kwort is using the firmware files provided by http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/. The problem for me was that I didn't know what filename it expected. I had to find out my wifi hardware using "lsusb" (or lspci, if you have a pci card) and search for it on https://wireless.wiki.kernel.org/ which got me to https://wireless.wiki.kernel.org/en/users/drivers/rt2800us and finally to http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/. It looked like my "etekcity" (or Etekcity 300Mbps) uses the ralink "rt3072" chip. So in fact I just copied the "rt2870.bin" to /lib/firmware and linux then could load the firmware.

And this is how I got it configured in a short time:

First I identified my wifi adapter using "ifconfig -a".
# ifconfig wlan0 up

This isn't really necessary but you will see error messages in dmesg if something is wrong with the firmware loading.

check if it works:
# iwlist wlan0 scan

if you see some wifi info, it's good.

Now generate a psk for your wpa2 network:
# wpa_passphrase $yourEssid $yourWifiPassword

from the generated output copy the passphrase (after psk=).

Now create the /etc/wpa_supplicant.conf file with the following content:
network={
 scan_ssid=1
 proto=RSN WPA
 key_mgmt=WPA-PSK
 pairwise=CCMP TKIP
 group=CCMP TKIP
        ssid="MYWLAN"
        scan_ssid=1
        psk=someGeneratedShit
}
where "someGeneratedShit" is your generated psk key. Please notice you write it without the ". Otherwise wpa_supplicant will croak.

If you are done, you can issue:
# wpa_cli reconfigure
# wpa_cli status

If everything worked, you can check that it worked by typing:
# ifconfig -a

You will see that your wifi adapter now has an ip address as Kwort defaults to "dhcp" in /etc/rc.d/net.

For now Kwort resides on a small 40GB ssd (ya, really, a 40GB intel ssd, it's reliable and sort of fast compared to "normal" drives) and I'm hopefully contributing something to it in some or another way.

Where can you get Kwort 4.2?

Just head over to http://kwort.org/ :).

Kind regards,
Andreas Schipplock.