Up to Main Index                          Up to Journal for December, 2012

                   JOURNAL FOR THURSDAY 20TH DECEMBER, 2012
______________________________________________________________________________

SUBJECT: Minimal Linux for running dedecated WolfMUD server
   DATE: Thu Dec 20 22:35:53 GMT 2012

As I've been working with resource constrained ARM systems lately it gave me
reason to wonder how much Linux do you actually need running in order to
'play' WolfMUD?

I started with a standard QEMU setup: versatilepb running Debian and 256Mb RAM
allocated. A standard boot looks like:

  $ ps aux
  USER      PID %CPU %MEM   VSZ  RSS TTY   STAT START TIME COMMAND
  root        1  1.0  0.2  2128  724 ?     Ss   21:59 0:01 init [2]
  root        2  0.0  0.0     0    0 ?     S    21:59 0:00 [kthreadd]
  root        3  0.4  0.0     0    0 ?     S    21:59 0:00 [ksoftirqd/0]
  root        4  0.2  0.0     0    0 ?     S    21:59 0:00 [kworker/0:0]
  root        5  0.0  0.0     0    0 ?     S    21:59 0:00 [kworker/u:0]
  root        7  0.0  0.0     0    0 ?     S<   21:59 0:00 [cpuset]
  root        8  0.0  0.0     0    0 ?     S<   21:59 0:00 [khelper]
  root        9  0.0  0.0     0    0 ?     S    21:59 0:00 [kdevtmpfs]
  root       10  0.0  0.0     0    0 ?     S<   21:59 0:00 [netns]
  root       11  0.0  0.0     0    0 ?     S    21:59 0:00 [sync_supers]
  root       12  0.0  0.0     0    0 ?     S    21:59 0:00 [bdi-default]
  root       13  0.0  0.0     0    0 ?     S<   21:59 0:00 [kintegrityd]
  root       14  0.0  0.0     0    0 ?     S<   21:59 0:00 [kblockd]
  root       15  0.0  0.0     0    0 ?     S    21:59 0:00 [khungtaskd]
  root       16  0.0  0.0     0    0 ?     S    21:59 0:00 [kswapd0]
  root       17  0.0  0.0     0    0 ?     SN   21:59 0:00 [ksmd]
  root       18  0.0  0.0     0    0 ?     S    21:59 0:00 [fsnotify_mark]
  root       19  0.0  0.0     0    0 ?     S<   21:59 0:00 [crypto]
  root       22  0.0  0.0     0    0 ?     S    21:59 0:00 [kworker/0:1]
  root       23  0.3  0.0     0    0 ?     S    21:59 0:00 [kworker/0:2]
  root       62  0.0  0.0     0    0 ?     S    21:59 0:00 [scsi_eh_0]
  root       99  0.0  0.0     0    0 ?     S    21:59 0:00 [kworker/u:1]
  root      114  0.0  0.0     0    0 ?     S    21:59 0:00 [jbd2/sda1-8]
  root      115  0.0  0.0     0    0 ?     S<   21:59 0:00 [ext4-dio-unwrit]
  root      191  0.0  0.0     0    0 ?     S    21:59 0:00 [flush-8:0]
  root      245  0.5  0.4  2784 1048 ?     Ss   21:59 0:00 udevd --daemon
  root      303  0.0  0.0     0    0 ?     S<   21:59 0:00 [kpsmoused]
  root      614  0.0  0.2  2780  680 ?     S    21:59 0:00 udevd --daemon
  root      616  0.0  0.3  2780  784 ?     S    21:59 0:00 udevd --daemon
  root     1516  0.0  0.7  4892 2004 ?     Ss   22:00 0:00 dhclient -1 -v -pf
  root     1699  0.5  0.6 27980 1536 ?     Sl   22:00 0:00 /usr/sbin/rsyslogd
  daemon   1757  0.0  0.1  2112  316 ?     Ss   22:01 0:00 /usr/sbin/atd
  root     1767  0.1  0.3  3780  796 ?     Ss   22:01 0:00 /usr/sbin/cron
  root     1865  0.1  0.4  6268 1044 ?     Ss   22:01 0:00 /usr/sbin/sshd
  root     2074  4.3  1.1  9444 2916 ?     Ss   22:01 0:01 sshd: diddymus [pri
  101      2085  0.1  0.3  7760  944 ?     Ss   22:01 0:00 /usr/sbin/exim4 -bd
  root     2113  0.3  0.3  3724  812 tty1  Ss+  22:01 0:00 /sbin/getty 38400 t
  diddymus 2114  0.9  0.7  9444 1824 ?     S    22:01 0:00 sshd: diddymus/
  diddymus 2115  1.3  0.7  4764 1840 pts/0 Ss   22:01 0:00 -bash
  diddymus 2123  0.0  0.4  4436 1124 pts/0 R+   22:01 0:00 ps aux


  $ free -h
               total       used       free     shared    buffers     cached
  Mem:          249M        37M       212M         0B       6.4M        18M
  -/+ buffers/cache:        12M       237M
  Swap:         465M         0B       465M


So, not too bad but what if I ONLY wanted to run WolfMUD? A totally dedicated
server. Well we can replace init with something like /bin/sh. We then end up
with:


  # ps aux
  USER      PID %CPU %MEM   VSZ  RSS TTY   STAT START TIME COMMAND
  root        1  2.8  0.2  1732  512 ?     S    22:07 0:01 /bin/sh
  root        2  0.0  0.0     0    0 ?     S    22:07 0:00 [kthreadd]
  root        3  0.0  0.0     0    0 ?     S    22:07 0:00 [ksoftirqd/0]
  root        4  0.2  0.0     0    0 ?     S    22:07 0:00 [kworker/0:0]
  root        5  0.0  0.0     0    0 ?     S    22:07 0:00 [kworker/u:0]
  root        6  0.0  0.0     0    0 ?     S    22:07 0:00 [watchdog/0]
  root        7  0.0  0.0     0    0 ?     S<   22:07 0:00 [cpuset]
  root        8  0.0  0.0     0    0 ?     S<   22:07 0:00 [khelper]
  root        9  0.0  0.0     0    0 ?     S    22:07 0:00 [kdevtmpfs]
  root       10  0.0  0.0     0    0 ?     S<   22:07 0:00 [netns]
  root       11  0.0  0.0     0    0 ?     S    22:07 0:00 [sync_supers]
  root       12  0.0  0.0     0    0 ?     S    22:07 0:00 [bdi-default]
  root       13  0.0  0.0     0    0 ?     S<   22:07 0:00 [kintegrityd]
  root       14  0.0  0.0     0    0 ?     S<   22:07 0:00 [kblockd]
  root       15  0.0  0.0     0    0 ?     S    22:08 0:00 [khungtaskd]
  root       16  0.0  0.0     0    0 ?     S    22:08 0:00 [kswapd0]
  root       17  0.0  0.0     0    0 ?     SN   22:08 0:00 [ksmd]
  root       18  0.0  0.0     0    0 ?     S    22:08 0:00 [fsnotify_mark]
  root       19  0.0  0.0     0    0 ?     S<   22:08 0:00 [crypto]
  root       22  0.0  0.0     0    0 ?     S    22:08 0:00 [kworker/0:1]
  root       23  0.1  0.0     0    0 ?     S    22:08 0:00 [kworker/0:2]
  root       65  0.0  0.0     0    0 ?     S    22:08 0:00 [scsi_eh_0]
  root      102  0.0  0.0     0    0 ?     S    22:08 0:00 [kworker/u:1]
  root      118  0.0  0.0     0    0 ?     S    22:08 0:00 [jbd2/sda1-8]
  root      119  0.0  0.0     0    0 ?     S<   22:08 0:00 [ext4-dio-unwrit]
  root      129  0.0  0.0     0    0 ?     S    22:08 0:00 [flush-8:0]
  root      130  0.0  0.3  2908  996 ?     R    22:08 0:00 ps aux


  # free -h
               total       used       free     shared    buffers     cached
  Mem:          249M       8.7M       241M         0B       1.7M       1.8M
  -/+ buffers/cache:       5.2M       244M
  Swap:           0B         0B         0B


Interesting... we can also run the WolfMUD server. In fact we could even pass
init=/home/diddymus/WolfMUD/bin/server to the kernel. There is only one
problem - networking is not started yet :(

So I created a small script to load the networking module, start networking
and then start the WolfMUD server:


  #!/bin/sh
  /sbin/modprobe smc91x
  /etc/init.d/networking start
  /sbin/ifup eth0
  /home/diddymus/WolfMUD/bin/server


Passing this to the kernel using init=/home/diddymus/start I have a dedicated
WolfMUD server with very little overhead, and a darn quick boot to... boot! :)

I'd like to take this further and build a sub-minimal install. Just a bootable
kernel and the minimum of executables and libraries. Having Go compiling
static executables is of great benefit here. At the moment /bin/sh is
symlinked to dash. I'm guessing replacing this with busybox or somthing would
be a good idea as well.

Not bad for about an hour's work poking around ;)

--
Diddymus


  Up to Main Index                          Up to Journal for December, 2012