Tiny Core Linux 5.X and mounting Samba drives

I was fighting for a while to mount a network drive on my Tiny Core Linux box running v5.4 with the following error

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

The command I was trying was:

sudo mount -t cifs // /mnt/popcorn -o username=$USER,password=$PASSWORD

After a lot of googling, it turns out that as per http://office-supply-liberation.blogspot.ie/2014/01/asus-ac66r-wireless-router-mounting.html, I need to add another option! Weird, since Tiny Core Linux 4.X mounts the exact same drive without requiring the option.

So the command that works is:

sudo mount -t cifs // /mnt/popcorn -o username=$USER,password=$PASSWORD,sec=ntlmv2

Setting up a NAS server with Tiny Core Linux 5.4

Makes sense, since the whole OS runs from a USB key, no need to waste hard drive space for an OS to do the few things I want a NAS to do, namely mount my existing NTFS drives (2 data drives, 2 backup drives), share the data drives on my LAN via samba and run a few rsync jobs to keep the backup drives in sync with the data drives.

I could have used (and considered) NAS4free but I want to keep my data on NTFS drives (because if the machine fails, I can pick up the drives, mount them in an external USB enclosure and access my data from any machine I have lying around) and NTFS works in nearly everything. Problem with NAS4Free from that prospective is that NTFS is not recommended. I tried it and was able to mount and share my drives fine but running rsync just blew up the box and triggered a reboot.

I have already covered most of the work in a previous post, copying the Tiny Core Linux ISO to a USB key, installing it and setting up SSH.

After that, type “blkid” in the terminal to view which disks are available to be mounted, install ntfs-3g and mount the drives with the command “sudo ntfs-3g /dev/sde1 /mnt/data1”. I decided to add to the /opt/bootlocal.sh file the commands to create a /shares folder, then subfolders for each drive as well as the mount commands for each drive. Do not put those into the /home folder (as I did inadvertently the first time around) because then your data will be backed up and fill your USB drive and RAM to capacity (when you hit that issue by the way, just plug your USB into a Linux box, explode the mydata.tgz file, remove the folder and boot from the USB again)!

Samba again is covered in my previous post. Next on my list is rsync, FTP access and web utilities…

Rsync is pretty straightforward, install the rsync.tcz package and run the backup commands from /opt/bootlocal.sh. The FTP package is bftpd.tcz and the config file is /usr/local/etc/bftpd.conf. I just tweaked the settings to allow root access and set the default home directory to /usr/local/apache2/htdocs (since I only want FTP access to maintain my web files). Install the apache2.tcz and apache2-mod-php5.tcz for web access and php support.

Now I was looking for a web interface to display info on the drives (space, temperature…) and phpsysinfo fits the bill perfectly. Now to get smart info, I had to install the smartmontools.tcz package and because phpsysinfo doesn’t seem to be able to run the smartctl command with enough rights, enable cron in the boot options to run smartctl as a cron job and output to a text file that phpsysinfo can then read.

As an added bonus, I installed MiniGal Nano to display all my home pics through a web interface. I had to fight with the apache-mod-php5 package to be able to enable the gd library, for which I had to install the XLibs.tcz, gt2k.tcz, libiconv.tcz and libpng.tcz. Now the version of the libpng library bundled with the 5.x version doesn’t match the version required by apache-mod-php5 and I had to (from another computer) replace the libpng.tcz with the one from version 4.x (which I downloaded from http://ftp.vim.org/ibiblio/distributions/tinycorelinux/4.x/x86/tcz/libpng.tcz). But I got it working in the end and it was worth the trouble shooting! And to top it up, a nice landing page using the Deep template.

Tiny Core Linux v5.3 and a new webserver set-up

My little HP Thinclient is still going strong and I decided to upgrade my USB-powered web server to the latest version (5.3) of Tiny Core Linux. As part of the process and rather to upgrade all the components as they were, I decided to review my set-up and go for as small and resource efficient as possible. I don’t like the WordPress latest upgrades to the UI and admin sections and I still had occasional problems with the SQL database getting corrupted after powercuts and other sudden power downs.

As my landing page, I went for a very nice free bootstrap theme – http://startbootstrap.com/template-overviews/freelancer/ running on nginx. For convenience’s sake, I also installed Droopy (http://stackp.online.fr/?p=28, nice piece of software to allow me to upload files directly on my web server through a web page, as content for my blog or just when on the go to retrieve later) and the best blog platform I could find around, Ghost. Both are served to the outside world through proxies set-up in nginx.

I will detail the steps of the set-up in future posts.



Setting up TinyCoreLinux as a VirtualBox Guest on Ubuntu

I wanted to be able to boot my USB drive with Tiny Core Linux installed on it from Virtualbox on my Ubuntu laptop in order to do the set-up from my machine before booting my headless server from the USB once set-up is complete.
This assumes you have a bootable USB drive with Tiny Core Linux installed on it already.

VirtualBox (4.3.12) on Ubuntu requires the VirtualBox extensions to be installed to support USB full stop, get those at http://www.virtualbox.org/wiki/Downloads and install them (see here for more background info).

Now, even with those installed, VirtualBox doesn’t allow booting from USB (and using Plop BootManager only got me a Boot Failed error). I followed those instructions (with a sudo in front) to create a vmdk file pointing to my USB – http://www.dallagnese.fr/en/computers-it/boot-on-your-usb-drive-in-virtualbox-4/.

Finally, I kept getting an error in VirtualBox when trying to add the vmdk file as a hard drive, even after adjusting the permissions on both the generated vmdk file and the USB drive itself. I got it to work by opening the VirtualBox GUI as root. From Terminal, type “sudo VirtualBox”.

And that’s it. My VirtualBox guest is now booting from the USB drive without issues or errors.


It was short-lived. Doing the above allowed me to boot up the live system. However, once the system was installed (following those instructions – http://www.parkytowers.me.uk/thin/Linux/CoreInstall.shtml), it gave me a “Boot Failed” error instead.

Through a series of trials and errors, I got it to work by:

  • Attaching the Plop Boot Manager ISO to the Virtual CD drive. The virtual machine then boots into the Plop Boot menu.
  • At the boot menu, press “q” to list the different partitions to boot from (from the vdmk file created above that points to the USB drive) and (in my case?), choose “HDA Partition 3” to boot up Tiny Core.

A bit of a roundabout way and certainly more complicated than I was expecting but it works!

Papercut, a Local Test SMTP Server for Windows

As a web developer, it is sometime needed to test email notifications in a local environment, either error notifications or emails for end clients, without the emails going near their intended recipients.

That’s where Papercut comes in. A dead simple SMTP server running on your local machine on port 25 that you can point your web application to, it acknowledges receipt of the email (so the web application is happy) and provides a simple GUI for you to be able to see the emails. It is a Windows-based tool, compatible with Windows 8 and is free to use.

For more info, visit the app site at http://papercut.codeplex.com/.

Starting and Shutting Down a Ubuntu machine from Android

Specifically from an android phone. WOL apps are 2 dimes a dozen to start the server remotely (I am using PC Wake, simple and it works) but I found it harder to find an app to allow me to shut down the machine remotely (I can log in using an SSH client and type the command but it gets a bit tedious after a while). Either the app didn’t work, or it required something to run on the target machine.

I ended up settling for a halfway solution called SSH Remote Exec+ (the + is important, it replaces another app called SSH Remote Exec that is no longer being developed), which basically allows you to save scripts to run remotely via SSH (obviously you need an SSH server running on the target machine). Next I needed the syntax of the command to be able to run the shutdown command on Ubuntu without getting stuck at the password prompt that immediately follows.

I didn’t want to start editing my sudoers file and the below works fine (it requires me to store the password in the script for SSH Remote Exec+ but since I am already storing the same password in the connection information anyway…)

echo <password> | sudo -S shutdown -h now