Category Archives: linux

Raspberry Pi 3 vs Cubieboard 2 Samba NAS performance

I’ve been using a Cubieboard overclocked to 1.3GHz as my home little NAS server since a few years ago, and just recently I bought a Raspberry Pi 3 thinking it would have been surely faster.

I was especially looking to get better Samba performance.

I have additional ntfs-3g and encryption layers other than Samba, but both boards had their version of Debian installed, with the same packages and same configurations, so the starting configuration was basically the same.

Both were -alternatively- attached to the same Toshiba Canvio 3TB USB3 disk (working in USB2 mode on both boards), and on two adiacent ports on my TP-Link ADSL router.

I overclocked my Raspi3 to 1.5GHz, with sdram_freq set to 500.

For my test, both were alternatively running off the same AC powered USB adapter, under the same wattmeter, each with his own USB power cord.

Well, it was an overall disappointing experience.

Raspberry Pi 3 @ 1.5GHz

  • Download speed via Samba: almost 7MB/s
  • CPU temperature: about 42°C
  • System load: ~2
  • Power draw: 2.6W, with short spikes to 2.7W

Cubieboard 2 @ 1.3GHz

  • Download speed via Samba: almost 7MB/s in average, oscillating between 6.3 and 7.5MB/s
  • CPU temperature: about 42°C
  • System load: ~2
  • Power draw: average 3.4W, ranging from 3.3 to 3.5W

So, the only area where raspi3 is superior to cubie2 is the power draw, otherwise I would have expected way better performance.

Interesting to note, the transfer speed via samba was the same on the raspi3 at the default frequency of 1.2GHz (no benefit from overclocking whatsoever, if not maybe increased oscillations in speed with the same average value), while cubie2 seriously improved after I overclocked back then.

This might indicate a saturation of the USB bus, where the ethernet adapter resides in the raspberry pi 3, which might be the case since the system load of 2 means the 4 cores of the raspberry pi 3 are loaded half as much as the 2 cores on the cubieboard 2, so they could be waiting for the bus to free itself.

Investigating further, I ran

vmstat 3

on both the boards during the transfer… and averages were as follows:

  • Cubieboard 2: user 7%, system 52%, idle 39%, waiting 2%
  • Raspberry Pi 3: user 2%, system 28%, idle 55%, waiting 15%

I think it’s quite clear at this point that while the cubieboard 2 is crunching during that time (the idle should be due to one of the two cores not being optimized), the raspberry pi 3 is waiting on the bus to free itself before sending in other data (the higher idle also must be due to the 4 cores not being all used for the task, mostly 2 of which just don’t do anything at all).

I spend about half to buy the raspberry pi 3 than what I paid for the cubieboard 2 back then, but after so much time it’s not surprising; what is surprising is that the everyday performance appears to be the same 🙁

At this point I will probably keep the cubieboard 2, because it’s already configured as I want it (it’s got more amenities to it than just the NAS server based on Samba) and the different power draw would save me only about 2€ per year on the raspberry pi 3, so no point in upgrading.

Share mysql and apache folders from windows XAMPP to linux XAMPP

This is a replica of the article by jultech from 2007 for posterity and data-replication purposes.

When dualbooting between windows (first OS installed) and linux, do this:

~ # mv /opt/lampp/var/mysql /opt/lampp/var/mysql.BACKUP
 ~ # ln -s /mnt/windisk/path/to/XAMPP/mysql/data/ /opt/lampp/var/mysql
 ~ # mv /opt/lampp/htdocs /opt/lampp/htdocs.BACKUP
 ~ # ln -s /mnt/windisk/path/to/XAMPP/htdocs /opt/lampp/htdocs

This creates a backup of the original XAMPP folders in linux, and them symlinks them to the windows disk mounts.

Restart XAMPP to have th configuration running.

Thank you jultech.

Fix mount: unknown filesystem type ‘isw_raid_member’

You may also get ‘linux_raid_member‘ instead of ‘isw_raid_member‘, usually it’s the same.

So you probably have run through other tutorials telling you not to mount directly but to mount the raid instead…. but you have no raid!

Maybe though, you HAD a raid back in time, and you removed it leaving the disks as separate storage, and in that case there would be “rogue” raid metadata on the disk that makes linux (mint in my case) think it is a raid, and get confused.

Thanks to Chris_F I finally solved it, you need to use dmraid (install it if it’s not on the system, via apt-get) to remove those orphan tags:

sudo dmraid -rE /dev/sdb

In my case, this instantly showed the disk in file manager.

403 Permission denied on Apache in Debian/Ubuntu with changed document root

I had just made a brand new installation of both Ubuntu trusty and vivid and Debian jessie (tried all of them) on my android phone with Linux Deplow, and installed the LAMP stack via SSH. I wanted Apache to serve files decrypted from an EncFS mount, so I found easier to move the DocumentRoot to a subfolder of my home (by editing /etc/apache2/sites-available/000-default.conf – by the way, this file has changed location quite a bit in the past, being called just default.conf, or being httpd.conf in older versions), and changed Apache’s username to my own (by editing /etc/apache2/envvars).

Well, what happened is that, no matter what I did, I was still getting a 403 Permission denied error, which had nothing to do with EncFS.

By pure chance, I went checking what was inside /etc/apache2/apache2.conf, and other than a reference to envvars for the username and group definitions for the user Apache is run as, scrolling further down there are folders definitions which were, in previous versions, located in the default.conf file. Changing in there the reference to /var/www into the new custom folder made it.

You obviously need to restart Apache after such changes.

AFWall+ and Linux Deploy, no internet access unless firewall is disabled

This is a personal reminder and also an easier-to-find heads up to those looking for a solution: if you installed linux on Android via Linux Deploy, and find that, no matter how you set rules on AFWall+ you can never get internet to the mounted linux image, unless you disable the firewall altogether (not recommendable since you installed a firewall in the first place), then here is the solution provided in this thread (it’s all due to DNS calls being blocked without a possibility to make them pass through in the vanilla AFWall+).

Under AFWall+ contextual menu, open the custom script editor, and inser these lines:


$IPTABLES -A afwall-wifi -m owner --uid-owner root -p udp --sport=67 --dport=68 -j RETURN
$IPTABLES -A afwall-wifi -m owner --uid-owner nobody -p udp --sport=67 --dport=68 -j RETURN
$IPTABLES -A afwall-wifi -m owner --uid-owner root -p udp --sport=53 -j RETURN
$IPTABLES -A afwall-wifi -m owner --uid-owner nobody -p udp --sport=53 -j RETURN
$IPTABLES -A afwall-wifi -m owner --uid-owner root -p tcp --sport=53 -j RETURN
$IPTABLES -A afwall-wifi -m owner --uid-owner nobody -p tcp --sport=53 -j RETURN
$IPTABLES -A afwall-3g -m owner --uid-owner root -p udp --dport=53 -j RETURN
$IPTABLES -A afwall-3g -m owner --uid-owner nobody -p udp --dport=53 -j RETURN
$IPTABLES -A afwall-3g -m owner --uid-owner root -p tcp --dport=53 -j RETURN
$IPTABLES -A afwall-3g -m owner --uid-owner nobody -p tcp --dport=53 -j RETURN

making sure you preserve the line return after each RETURN since pasting directly into the tiny textbox of AFWall+ may lose the carriage returns.

BAM you will have internet from your android linux without having to disable the firewall. Naturally, you will also have to enable internet access to “Applications running as root”.

Update: as per Peter’s suggestion in the comments (thank you Peter!) if you still get errors with this approach you may need to add a couple more lines, like so:

$IPTABLES -A afwall-wifi-wan -m owner –uid-owner 5000 -j RETURN
$IPTABLES -A afwall-wifi-lan -m owner –uid-owner 5000 -j RETURN

where “5000” is an id you have to customize to your needs, and you can get it either from AFWall’s errors logs, or by checking the /etc/passwd file for the current user’s entry.

Samba share connection doesn’t accept user:password login from Windows

This is mainly a self-reference for when I find myself reinstalling Samba on my home server, if something goes wrong and the previous system got corrupt, or if I am upgrading something.

It happens, ALWAYS, that I setup a share with a login, which is the same of the user on the server the share resides into, and when I insert that login info in the Windows dialogue that appears, it just gives me an access denied error, as if the password I inserted wasn’t correct.

What I forget to do, every single time, is to create first a samba user with

sudo smbpasswd -a username

and then using those credentials (which you can create as matching the linux user’s) in the windows dialogue.

Change the user Transmission Debian daemon runs under and avoid warning message

I am writing this post also for personal reference (and currently I am writing in bare HTML since my WordPress installation lacks an updated multilanguage plugin to be able to use the WYSIWYG editor).
I was moving my home server from a slow Raspberry PI to a way faster Cubieboard 2, and got to reinstall Transmission daemon. I needed to change its user tho, because I needed a certain folder to be accessible to it.
So I edited as SU the /etc/init.d/transmission-daemon file changing the transmission-debian value into the username I wanted to use, but I kept getting a (warning) message when trying to start the daemon.
Long story short, here are some tips you have to follow, but first credits where they’re due:
This is the page where I got started the first time:
And this is a heads up I got while trying to solve this problem:

So, back on track:
1) Make sure the transmission daemon is stopped, otherwise changes you make to configuration files will be reverted to original
2) Edit the init.d starting script changing the username to your wanted username
3) chown the default transmission-debian folders to the user you need:

sudo chown username:group /var/lib/transmission-daemon/info –R
sudo chown username:group /etc/transmission-daemon/ –R

4) If you are importing a settings.json file from a previous installation, make sure to copy it to both /etc/transmission-daemon/ and /var/lib/transmission-daemon/info/ so that both copies are identical
5) You can now start the daemon and everything should work as expected

Cyclic sound MP3 audio recording in ubuntu

I work in a relatively safe environment, yet it may very well happen that I need to prove something that someone said in my office, so I can hold it against them when the time comes.

My laptop is always turned on, so I could use it to record the environmental sounds around it, with a couple of requirements:

  • the recording must be totally unattended, starting when I turn on the pc, and stopping when I turn it off, without any user intervention
  • the recorded files must be somehow purged, starting from the oldest ones, so that my disk doesn’t get filled with audio files

As in the Ubuntu spirit, I tried to search for something that did the job right away, but with no luck.

So, still in the Ubunt spirit, I had to arrange it myself: the idea is to record the audio in chunks of 10 minutes, and each time delete the oldest files, so that there is a chosen number of max files inside the recording folder.

You will need the audio-recorder package for the job, install it as follows:

sudo apt-add-repository ppa:osmoma/audio-recorder
sudo apt-get update
sudo apt-get install audio-recorder

when the program is installed, open it (Alt-F2 and then launch audio-recorder), click on the “additional settings” button, and setup your default recording folder there, in this example it’s the folder “audiofiles” directly under your home folder.
Also I suggest changing the file naming standard to %Y-%m-%d-%H:%M:%S so that each recording can be easily associated with the time of starting.

Then, you need to make a bash script that will deal with starting a new recording, while closing the previous one, this is what I came up with:


/usr/bin/audio-recorder --display=:0.0 -c stop
/usr/bin/audio-recorder --display=:0.0 -c start
cd /home/username/audiofiles
rm `ls -t | awk 'NR>150'`

which does exactly the following: stops a previously open (if existing) instance of the program, and starts a new one, then deletes the oldest recorded audio chunks so that there are maximum 150 files inside the recording folder (if you want a different amount, just replace 150 with the number you prefer); please note that the recording folder written in this bash script must be the same that is set in the additional settings, so if you want to use a different folder make sure to set it up both in audio-recorder and in this bash script.
Also, please note that the username part of the path must be replaced with your ubuntu username.

You can create this bash script as a “” file in your home folder, and then be sure to chmod +x so you can execute it.

Then, you need something that actually starts the recording, and cron is our friend here.

Run the command

crontab -e

and if it’s the first time you run it,  you should be presented with a choice screen asking you which editor you prefer… absolutely choose nano!

Inside the editor screen, paste this:

*/10 * * * * /home/username/

where “username” must be replaced with you ubuntu username, then press Ctrl-X to save the file (press Y is prompted to confirm).

What this cron line does, is running the bash script we just created every ten minutes, so the recorded sound files will be 10 minutes long. If you want to change this length, just change the 10 in the command to the number of minutes you prefer.

Restart the pc, and notice how files are being created inside of your folder. After a while, you will also get over the set limit for the files, and you will notice how the number of files will always stay the same, with the oldest files being deleted.

How to drag and drop files between windows in Ubuntu Unity launcher bar

So I like Unity, it looks nifty and the Zeitgeist launcher is so productive.
One huge gripe about unity though, is that you cannot, apparently, drag&drop files between applications open in the Unity launcher bar, namely:

  • a file from nautilus into thunderbird as a mail attachment
  • an image from nautilus into a photo-editing program
  • the same file from nautilus into an archive manager
  • an image into the upload page of opened in your browser
  • anything else

I use a Precise Pangolin installation, and this is what works for me:

  1. Start dragging the file until you have it under your mouse pointer, ready to be dropped somewhere
  2. At this point you will notice the launcher bar buttons become gray (almost all of them, Nautilus and Firefox stay bright for me)
  3. Trying to drop onto any of the buttons, be it grayed out or bright, will NOT bring up its window
  4. Keep the mouse button pressed, and on your keyboard use theWinKey+TAB combination, you will see the applications buttons on the unit launcher bar brighten one at a time, cycling though both bright ones and grayed ones
  5. When you have highlighted the button of the program you need (for example, Thunderbird to attach a file into a mail), release the WinKey+TAB combo and the relative application window will open
  6. Finally drop your file in the opened window
  7. After you’ve done your job, flood LaunchPad with bug reports until we get this dumb problem fixed

Ubuntu won’t start Gnome GDM after upgrade to Oneiric Ocelot

So I was upgrading my home server first from Maverick Meerkat to Natty Narwhal, and then from Natty to Oneric Ocelot.
It is not a plain desktop installation, as back in the time I installed Ubuntu Server and then built upon it adding Gnome without the useless stuff that comes with the ubuntu-desktop package.

Anyway, after upgrading to Oneiric the X interface went away, all I saw was the boot messages text by the kernel up to the Apache2 start, and nothing else. SSH was still accessible so I could go through it, but you could still use recovery console to access the system if you don’t have remote terminal capability installed.

Checking with dmesg I saw these error messages:

[ 24.974182] gdm-simple-slav[1009]: segfault at 0 ip 002945b7 sp bfe9b6c8 error 4 in[291000+6000] [ 38.598946] gdm-simple-slav[1218]: segfault at 0 ip 00a3b5b7 sp bf9c35c8 error 4 in[a38000+6000] [ 39.562834] gdm-simple-slav[1238]: segfault at 0 ip 005eb5b7 sp bff72138 error 4 in[5e8000+6000]

Upgrading again, via SSH, to Precise Pangolin didn’t solve the problem, so I googled aroung and found this bug on launchpad.

Apparently, the autologin feature prevents GDM from going on and just hangs there.

Briefly, what I did and worked in my case (mileage may vary) was:

sudo add-apt-repository ppa:gnome3-team/gnome3
sudo add-apt-repository ppa:ubuntugnometeam/ppa-gen
sudo apt-get update
sudo apt-get dist-upgrade
sudo mv /etc/gdm/custom.conf /etc/gdm/

The last line is the command that removes the autologin (by renaming the conf file that activates it), after doing this and rebooting I was showed the login screen.