Exploring a Linux-based TV box

/images/woxter-bt-download.jpg

Hello! So... a family member brought this media center home, and asked me to repurpose it to a NAS. Here I'm going to share some notes about this media center and how I repurposed it as a NAS.

What media center are we talking about?

This media center is a Woxter i-Cube 2400 [spanish]. Yes, it is that old. It works just fine, though: it can reproduce images, MP3s and videos. Please re-encode your videos if they use a recent codec (such as h264, used by Youtube videos). I didn't try Matroska videos (mkv) - if they don't work, use ffmpeg or autohardsubber to create a single .mp4 file. I was amazed to see that Japanese characters were not replaced with squares, points or some strange A - it renders unicode characters just fine.

As any respectable media center, it has a replaceable internal 3.5" hard drive, and can access USB thumb drives. It can also access remote folders via SMB, if your Windows computers in the same network expose shared folders. Please note that the internal hard drive partitions must use a FAT32 filesystem, or it won't be recognized.

Remote controller configuration

This media center was provided as-is, without its remote control. Fortunately, we found an universal remote controller manufactured by SilverCrest: the codes are 6138 and AUX2. I don't really know how universal remote controllers work, so you may have to find your own codes online.

Shell inside

To access the remote shell, just telnet into the media center (default port) using the root user - no password needed. Once we log in, we can discover that this media center runs an old version of busybox, with its shell "ash".

> uname -a
Linux NAS 2.6.12.6-VENUS #4 Wed Oct 21 15:10:26 CST 2009 mips unknown

It does not have a lot of utilities: for example, user configuration applets (useradd, usermod, etc) are not present here. By default, it runs an HTTP server, a bittorrent downloader and the media center GUI.

I'd have liked to modify some configuration files, such as inetd.conf, but the root (/) partition is squashfs, so remounting it as read-write is not possible. Fortunately for us, we don't really need it - I'll explain why in a later section.

A HTTP server in my media center?!?

To be honest, the first thing I tried was to check if the thing had an administration panel to manage it remotely, even without a remote controller. I wasn't that far from the truth: it launches the busybox httpd server at boot, and you may create CGI webservices. I'm not sure you really want to handle POST requests in bash, though. I suppose I may try to cross-compile some C or Rust code there, but I'm too busy to try that right now. If you want to try, all CGI webservices are stored in /var/www/cgi-bin.

There is one very important CGI service that the media center offers: a webpage to load torrent files, start and stop the download and delete everything from the server. It uses btpd, a small (and outdated) bittorrent downloader daemon. It works, but I'm not really sure how secure it may be - not much, I suppose. You can use that webpage by accessing http://192.168.1.176/cgi-bin/webtorrent.cgi

Samba configuration

Let's gather to work on the best part of the post: samba configuration. Busybox has a samba daemon, I'm not sure if the configuration file was already present or not, but I can tell you it won't start at boot.

There are two servers to be launched at boot time: smbd and nmbd. The first one implements the SMB protocol - file listing, creating directories, and so on. the second one is a NetBIOS server (port 139) - if this server does not run, the media center will not be shown in the "Network" tab of the Windows Explorer.

To launch smbd and nmbd, I had to modify a service file: /usr/local/etc/rcS.

# add these lines to /usr/local/etc/rcS

# launch the samba daemon
smbd --configfile=/usr/local/etc/smb.conf
# start the netbios daemon in a different script
ash /usr/local/etc/launch_netbios.sh &

Beware: you need to launch nmbd after that the IP is set, or it won't work. To ensure that, I launch nmbd after 30 seconds. It comes from empirical measures, so you may need to sleep longer. nmbd is not necessary, though: you can access the NAS directly via its IP (look it up in your router's administration panel). smbd can be launched at any time.

# launch_netbios.sh

sleep 30
nmbd --configfile=/usr/local/etc/smb.conf

As said before, you cannot create new users: it means that the only usable user is root. It also affects the configuration of our Samba server: all folders must be accessed as guest. An important utility, smbpasswd, is also missing, so we cannot even set passwords for samba users.

The commented configuration follows:

[global]
  hosts allow = 192.168.1.

  # don't load printers, obviously
  load printers = no
  disable spoolss = yes

  # standalone file server, consider unknown users as guests
  # and use `root` as the default guest account.
  # in the documentation, the default guest account is `ftp` - it cannot access any folder here
  security = user
  map to guest = Bad User
  guest account = root

  # transfer speed tuning
  use sendfile = yes
  read raw = yes
  write raw = yes
  dns proxy = no

  # set the workgroup and the name of server
  workgroup = WORKGROUP
  server string = NAS

[HDD1]
  comment = HDD Partition 1
  path = /usr/local/etc/hdd/volumes/HDD1
  hide dot files=yes
  hide files=/.*/lost+found
  force create mode=0775
  force directory mode=0775

  # enable guest access to this folder
  guest ok = yes
  # the guest user can create, delete and move files
  read only = no

Do you want to add something, or point out some errors? Send me an email at winter@wintermade.it. If you liked it, why don't you buy me a Ko-fi ?