Get some base Linux info in QNAP TS-210 using console

QNAPs runs on (sometimes heavily modified) Debian distributions. But, what about kernel version etc.?

There several ways of getting this information from console. Out of them following works on TS-210:

  • uname -a
  • cat /etc/issue
  • cat /proc/version

If you ever need more information on this then… LMGIFY.

In this article I’ll show you the very basic commands that can be used on QNAP TS-210 (modified Debian Linux) to obtain system release, version, hardware info etc.

Read More “Get some base Linux info in QNAP TS-210 using console”

Introduction to curl

This is just a barely memo about very, very basics of curl. Since curl fetches URLs and data from some endpoints, it can be used for a variety of reasons. I am using to for a very basic (and quick!) API calls tests.

If you’re on Linux, Unix or any of its clones or if you’re on Mac then you most likely have curl. If you’re on Windows, but you’re using Git for Windows (or some similar tool) then you have curl.

So, let’s jump into that basics. Be warned — you will not find here anything that you wouldn’t already knew.

Read More “Introduction to curl”

Developing applications for Raspberry Pi or Linux

Depending on: project’s scope, business expectations, your knowledge and Raspberry Pi’s role you can develop software for RPi in mainly three ways:

  1. Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients.
  2. Develop a HTML/CSS/JS application
  3. Develop an native Raspberry Pi app

All of the above require you to:

  • Develop a regular Linux app
  • Optimised to use hardware and computing power of Raspberry Pi
  • Run it in Raspbian OS or any other Linux distribution of your choice

And, if you really want to get your hands dirty and truly have no limits then you must forget about Linux and start thinking about Ultibo (there’s a separate article for that).

Developing in Ultibo (or similar complete embedded development environment) requires a lot of expertise, development knowledge and practice. And simply isn’t an option for all. Especially, if you only need to build a quick-and-easy app for RapberryPi. For these purposes this article lists details about RPi development.

Read More “Developing applications for Raspberry Pi or Linux”

The smallest Linux for Raspberry Pi?

There are dozens of articles similar to this, so I treat it just as another quick memo for myself:

  1. You can create custom Linux-based system yourself with tools like:
  2. A ready out-of-the box solution is Core Linux / pi Core:
    • some info: here, here and here
    • very modular, add whatever you need
    • smallest version is claimed to have only 10 MB with GUI!
  3. Smallest Rasbian OS is 0.5+ GB in size so is out of option.

And if anything above is not for you then maybe a… non-Linux solution for your RPi?

The very introduction to Raspberry Pi

After a nearly five years of struggling with hardware and software for feeding data to Flightradar24, I have finally decided to give it a try with Raspberry Pi. On contrary to what some of you may think, this is not a guide on how to achieve it. The original text is very good and quite self-explanatory. No need to copy it here.

In addition to feeding data to Flightradar 24 there are hundreds of ideas how can you use your Raspberry Pi. With this article I wanted to show you (and remind to myself) just of a few IMHO most interesting ones.

If you’re just unpacking your first Raspberry Pi then better read these two articles:

before even continuing with this article.

Read More “The very introduction to Raspberry Pi”

Add one or more folders to .zip archive

To add single directory (with all files and sub-directories) simply execute:

zip -r name_of_your_directory

To add all contents of current directory (again, recursively) call instead:

zip -r *

While to add two or more directories (but not all) in current directory — list them:

zip -r directory_a directory_b directory_c

Call just zip to see all switches, options etc.

chown: Recursively change owner of all files and folders

Sometimes QNAP changes file owner to admin:administ (actually to admin:administratorsadmin user in administrators group) which may cause some troubles on certain FTP operations when you’re logged in to QNAP’s FTP server with user different than admin (using this user to operate on FTP is a quite great mistake and you should always use other, less privileged user for this).

Using chown command you can easily fix this.

Read More “chown: Recursively change owner of all files and folders”

Fix problems with sudoers or file on QNAP

Root / power-user configuration on QNAP devices is a little bit different (quite weird) than this, what you can find on most Unix/ Linux systems. And sometimes you may be hit with error messages like “admin is not in the sudoers file. This incident will be reported“, “ must be owned by uid 0” etc. Here are some tips on what to do in this case.

For second error, claiming that file uid isn’t 0, first go to folder containing this file (/opt/libexec/ on QNAP TS-210) and ls -ls to check, who is current user of it. It should be admin:administ (actually admin:administrators, but ls -ls chops names to 8 characters).

If it isn’t, change ownership of this file and /opt/etc/sudoers folder, by executing:

chown admin:administrators /opt/libexec/
chown admin:administrators /opt/etc/sudoers

As for first error, saying, that admin is not in the sudoers file, you may try to execute sudo usermod -aG sudo,adm admin, but this will most likely fail on QNAP.

If it does, then fix this manually as described in here:

  1. Execute visudo command to edit /opt/etc/sudoers.tmp file.
  2. Scroll down contents of this file, until you reach root ALL=(ALL) ALL.
  3. Hit Enter to add a new line below and write admin ALL=(ALL) ALL.
  4. Hit Esc, enter wq and hit Enter to save file and exit forsakend vi editor.

This is the only solution, that I found working on my QNAP TS-210.

All others, that required using GRUP, were impossible, as you don’t have access to GRUP during QNAP boot.

Change prompt and enable command auto-completion [updated]

I really like some simple extensions and changes to command line in Linux. An ability to enable command auto-complete, commands history navigation and changing prompts look in particular.

However, not every console is suited with these changes, so I wrote this simple article to keep all my how-tos around Linux command line in one place.

Read More “Change prompt and enable command auto-completion [updated]”

Get WebSVN to QNAP

This guide assumes, that you have svn already installed on your QNAP, fully configured and working like a charm, and you just want to enhance it with web client (WebSVN). You can use this guide also on any other server, than QNAP, but keep in mind, that it contains some QNAP-specific problems.

Keep in mind: WebSVN (as good as all other alternatives mentioned in the end of this text) are read-only web SVN clients! You can do a lot of useful stuff on your repos, but forget about committing or anything similar that requires write access or changing repository structure.

Read More “Get WebSVN to QNAP”

Installing and configuring FTP server on on Ubuntu 12.04 and adding users

As for good FTP server for Ubuntu I’ve choosen vsftp server, though it has some glitches (more here), after fairly good response in the Internet. Many guides shows how to configure and use vsftp on local users, though giving them, by default, access only to their home folder. And allowing them to access server via SSH.

Which is not, what we want in most cases.

I’ve found a good guide, which shows you how to add ftp users with access to folder inside WWW root only.

Read More “Installing and configuring FTP server on on Ubuntu 12.04 and adding users”

Fixing 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

Unfortunately, Ubuntu 12.04 LTS has vsftpd (very famous FTP server) in version 2.3.5 as latest one, which is affected by well know problem of disallowing users to login and throwing

500 OOPS: vsftpd: refusing to run with writable root inside chroot()

error, when using default vsftpd configuration (including a must-have chroot_local_user=YES setting).

There are few ways of working around this problem and most of them are discussed in this post.

Read More “Fixing 500 OOPS: vsftpd: refusing to run with writable root inside chroot()”

Finding Apache installation path and configuration file

There are several ways to determine, where Apache has been installed on your Linux/Unix system and what are other imporant paths for it (WWW root, configuration etc.). You can use this nice blog entry, which in general means executing ps -ef | grep apache to determine path and then running /usr/sbin/apache2 -V with proper path (replace /usr/sbin/ part) to determine Apache configuration details.

You can also use DistrosDefaultLayout page in Httpd Wiki to find default path layout for your particular operating system.

If everything else fails, try to help yourself with Installation and setup of the Apache Web Server (Linux) document.

Copy large folders using command-line with progress indication

By many sources cp is mentioned as the fastest way to copy large filesets. And the only fault of it, is that it does not provide an easy way to see progress of copy process. This post discusses various ways of fixing this problem. Keep in mind, that this post is (again) QNAP-optimized, meaning that it mostly focuses on solutions available on my old, lame QNAP TS-210 NAS system. It only points out other methods, that are not available on this very limited edition of Linux.

Read More “Copy large folders using command-line with progress indication”

Scanning all incoming traffic. Proper use of tcpdump

I had to do some strange listening stuff with even more strange Chineese GPS locator, that was weird enough to use UDP protocol only. Since there was absolutely no technical guide for these devices (at least, when I was looking for them), I had to listen for everything on every port of my local server to see, what this damn box is actually sending.

Since I’m kind of Linux newbie, I asked this Unix & Linux question and got answer enough worth for me, that I decided to put some summary of them to my own blog.

Read More “Scanning all incoming traffic. Proper use of tcpdump”

screen: Force program to continue after logging-off from the console

So, there I was… needing to have any solution, that will allows me to write my very own port listener. Since the only language, in which I am handy is PHP, I was forced to be able to run PHP script without interruption, 24 hours a day, 7 days a week. That was a bit of challenge for me, given my quite very limited Linux knowledge, but — as they say — the only thing not possible in IT is to open an umbrella in your ass! :>

Read More “screen: Force program to continue after logging-off from the console”

Installing SVN on QNAP using IPKG (Optware)

This article is based on information provided by QPKG package created for SVN by noski and on QNAP Wiki article about SVN and of course a piece of my experience. But since SVN is relatively easily to install by-hand (so you don’t actually need QPKG package) and since Wiki article about SVN is outdated / contains some garbage (directory /share does note belong to /dev/ram!), I decided to write my own guide.

Read More “Installing SVN on QNAP using IPKG (Optware)”

Fix for problem with mixing USB shares on QNAP

Most QNAPs randomly mounts USB disk shares. I.e. you can have disk attached to left USB port as USBDisk1, second as USBDisk2 and after reset — changed together. This causes many problems, where being unable to write some script accessing particular disks could be named at first. There isn’t an easy way to work around it. The only solution I found out was to write an script that resides in flash memory (therefore is called upon each restart of QNAP) and that mounts disks under shares similar to their disk labels.

Read More “Fix for problem with mixing USB shares on QNAP”