Boot order of systemd services

In the last months I discovered the world of SystemD through two installation and configuration of ArchLinux on two different PCs, and a new product of my company that use SystemD.
At the beginning it seems very strange and difficult, but after some trys I found it very powerful!

Particurarly I discovered the simple way to manage the boot order of the system services to control some action before other (like create a dynamic folder for all the system sockets, before start the services that create that sockets).

To control your service, look for a file called “mySpecialService.service” into folder /lib/systemd/system or /etc/systemd/system.
Open that file using nano, vi or other editor and into that file search for the After parameter into [Unit] session.

Into that parameter you can insert the name of the services required to start before your service, separated by space.

Description=/etc/mySpecialService Compatibility
ConditionFileIsExecutable=/etc/mySpecialService otherService.service

You can do the same with the services that requires your action before start.

After changed these files, run the ENABLE command to configure the system with your new settings:

$ sudo systemctl enable mySpecialService.service

that is the same operation that you done with the older “update-rc.d” on SysVinit systems.

Have a good SystemD configuration! 😉


Backup Outlook email folder tree on Thunderbird profile

Hi everybody,

in this period I’m changing job and then I was faced with a big problem: how can I save all Outlook messages and folders?
(I think that can be useful hold with me a backup of work communications and messages for a couple of years.)

So, I looked for some guides to backup all the data but Outlook (my version is 2010) permits to save in *.pst format only, a MS format recognized just from few software and mainly from MS software.
But after many searches on Google I discover these steps to save all messages and structure on Thunderbird:

1. Install Thunderbird version 31 or previous
It is necessary because later versions don’t support the Import of data from Outlook.

2. Import data from Outlook
It could be done by Thunderbird menu Tools->Import->Mail, then select Outlook; and wait that process finish.

3. Install add-on ImportExportTools
ImportExportTools is a useful add-on of Thunderbird to import or export data and profile to/from Thunderbird.
You can found it here

4. Export profile
Using the ImportExportTools menu, you can export the user profile, that means all the structures, folders and messages present in Thunderbird.
Once saved the profile you can move that profile where you want: it is just a special folder tree with special files readable by Thunderbird.

5. Import profile into Thunderbird
To open a saved profile, just open a Thunderbird with ImportExportTools addon installed, and select Tools->ImportExportTools->Import profile, inserting a name for the profile to recognize it after.

6. Open your profile into Thunderbird
If you don’t see your messages recovered, close Thunderbird and reopen by command line, using the command
$ thunderbird -p that opens the window profile selection: here you can select the profile with the name gived and then you should see the recovered messages.


install Pyload on NAS Synology – DSM 5.1

Two months ago I bought a new Network Attached Storage.
For my purposes, I choose a NAS Synology DS213J with two hd Western Digital RED of 3TB for each, to have 3TB of free space with a best RAID1 “bit-to-bit” backup.

So this special NAS, has a custom Linux OS with a wonderful web GUI to manage every part and to use various applications created for it, like a Download Manager, a Video Streamer, a Cloud Station and so on. Using Linux and having so many applications (made by the producer or by the community of users) I hoped to find a version of Pyload made for it. But I was wrong, because there is a Pyload made for Synology, but it is for older version of Synology OS: on my OS, DSM version 5.1, it doesn’t work.

So, in this forum I found a working solution.


Following, the steps:


1- For first you need to install the official app of “Synology Pyload” developed by the pyload Team.
This app is a 3rd party community package, that means that is developed by the community and not directly from Synology. So, to have this app into the installation list on your DSM 5.1 operating system you need to open the DSM Package Center, click on the Settings tab, then on the item Package Sources, Add button and insert the url Now, you can find the Pyload app into the Community item, into the Package Center, and then try to install it on the DSM 5.1. On the DSM 5.1 the installation process fails, but it necessary to do this before the next steps.


2- The second step is to do the standard setup by command-line of Pyload, as on a normal linux machine.
So, for this you must connect on remote terminal to your NAS through ssh, using the root user (pay attention!), that has the same password of the admin user (is the same user, but for the terminal is needed the username root to have correct administration priviledges). After the ssh connection, you should have a particular terminal like this:


To have a normal sh terminal, type the command su and then you’ll get the root terminal on your Synology NAS.
Then, the linux command to correct install Pyload on your DSM 5.1 is:

# /volume1/@appstore/pyload/bin/python /volume1/@appstore/pyload/pyload/ -s

ATTENTION: to run Pyload and its setup process you need to have PYTHON installed. I installed both the app “Python3” and the “Python Module” found into the producer’s app list

After that command, you must have to insert all the Pyload configurations, like the Port of the NAS on which start the Pyload daemon (to connect to Pyload via browser), the SSL security connection settings and so on.

Then, you can try to start Pyload using

# /volume1/@appstore/pyload/bin/python /volume1/@appstore/pyload/pyload/

and verify it connecting via browser to the IP of the NAS at the daemon port specified. Mine is at:


3- Configuration of the Pyload user.
Pyload needs a special configuration command to add a Pyload user (even if is the first or the only user), done with the command:

# /volume1/@appstore/pyload/bin/python /volume1/@appstore/pyload/pyload/ -u


4- Automate the startup of Pyload
To automate the startup of Pyload at the startup of the machine, you need to create the new script file:

# touch /usr/syno/etc/rc.d/

and write into that file this script:

COMMAND="/volume1/@appstore/pyload/bin/python /volume1/@appstore/pyload/pyload/"

start() {
        echo "Starting PyLoad"
        $COMMAND --daemon

status() {
        echo -n "Status of PyLoad: "
        STATUS=$($COMMAND --status)
        if [[ $STATUS = "False" ]]; then
                echo "Not running"
                echo "Running as PID $STATUS"

stop() {
        echo "Stopping PyLoad"
        $COMMAND --quit

case "$1" in
                sleep 4
                echo "Usage: $0 (start|stop|restart|status)"
                exit 1
exit 0

Then this file need the execution priviledges

# chmod +x /usr/syno/etc/rc.d/

and on the next system startup Pyload will be launched automatically!
To start now pyload, the command is:

# /usr/syno/etc/rc.d/ start


VERY INTERESTING: after this setup, Pyload can be used also by the Synology app, that opens a window with the same web GUI in execution at the port specified!!


Enjoy! 😉

remote Xfce4 desktop on ArchLinux

Hi everybody!

Few weeks ago I installed Arch linux on my RaspberryPI, to try this particular distro. ArchLinux is a “nerd” distro of Linux, where you must setup every single part that you need to use.
(You can find instructions to setup ArchLinux on Raspberry here)

In this post I don’t want to explain the setup of every single parts into ArchLinux, because there are already many guides for that (best guide is, but I want to talk about a particular situation like mine, where there is a Raspberry PI without monitor and keyboard, with only the ethernet cable to talk with any user, and the need to use the GUI of the Raspberry.
So the question is how get remote Xfce4 desktop on ArchLinux through SSH terminal?.

For first, you need to connect to your remote SSH terminal and install Xorg and Xfce4 on the machine. You also need to install vncserver provided by the package tigervnc.

After that, you only need to create the file ~/.vnc/xstartup (if already exists, delete it and create a new file), and into that file you must write:

exec /bin/sh /etc/xdg/xfce4/xinitrc

that starts an Xfce4 session at every VNC connection of the user owner of that home sub-folder.

The last operation to do is to start on the remote machine a vnc remote desktop, using the command

$ vncserver

that print the number ID of the new remote desktop created.
Then, you can connect to that remote desktop using a simple VNC program, like xvnc4viewer or the graphical remote desktop client remmina of Ubuntu, using as remote IP the format <remoteIP>:<dekstopID> like this:

or, otherwise if you need to setup the connection PORT, you only have to sum the standard VNC port 5900 to the ID of the desktop (if the new desktop created is the number 2 the remote port will be 5902).

Enjoy! 😉


PS: to delete the created remote dekstop (for example the desktop 2), the command is

$ vncserver -kill :2

Setting up SSH public/private keys

SSH can be set up with public/private key pairs to have a personal security control onto your ssh connection.

To obtain your public and private keys, on your client machine you only need to type:

$ ssh-keygen -t rsa -C "John Doe "

where instead “John Doe” you must insert your name and surname.
The output is:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/fra/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):

where you have to insert the filename for your key (for example “fcastagnotto_key”) and the passphrase to protect the use of your private key (lika a password).

After that, the command shows the key fingerprint and the key’s randomart image of your public key and then, your keys are created!!

You can find your private key (for me is the file fcastagnottoLINUX_key) and your public key (for me is the file under the directory where you have been done this procedure.

Then, if your keys aren’t under your ~/.ssh/ folder, you have to move them there. For my keys, this is the command:

$ sudo mv fcastagnottoLINUX_key* .ssh/ -v

To complete the setup for the key recognition, you must copy your public key into your remote server whit the command

$ ssh-copy-id user@

where the you have to replace user with your remote user and whit the IP address of your remote machine. This command place your public key into the remote machine’s authorized_keys file. (This command ask you to insert the remote user’s password for the copy of the key)

At this point, you can test your remote recognition with

$ ssh user@

and you should have to insert your passphrase, to correct login into your remote machine!!

Enjoy! 😉

Reinstall GRUB with a GNU\Linux LiveCD or LiveUSB

Sometimes, I had to install Windows in addition to GNU\Linux on the same machine. Sad days.

Best way to do this, is to start with the Linux installation -that opens the partition program- to have a right division of your disk. After this installation, I install Windows in its own partition, but this OS doesn’t like the linux bootloader and it rewrite the disk MBR with the reference to start the Microsoft Bootloader.

So in this condition, to reinstall the GRUB bootloader (the best used bootloader with new GNU\Linux distros) you can use the live distro on the CD or pendrive.
When the live-system starts, you need to know the system name of the linux partition. To know that, use the command

$ sudo fdisk -l

that shows the various partitions of the machine. Then you can identify your linux partition and know the system name that is “/dev/sdaX” or “/dev/hdaX” where X is a number.

Then, you only need to write these commands:

$ su
# mkdir /disk
# mount /dev/sdaX disk
# mount --bind /dev disk/dev
# mount -t proc none disk/proc
# chroot disk /bin/bash
# grub-install /dev/sda
# update-grub

In case you have the /boot folder into a different partition, you need to write also

# mount /dev/sdaX disk/boot

before the chroot command.

After that, you can do a normal restart of your system from HD and the bootloader is restored!

USB_Modeswitch (Ubuntu systems)

Few week ago, i bought a Internet Key – 3G modem USB, because the one provided by Vodafone stop working (was a Huawei 3G modem).
The new modem is a TP-LINK 3G modem USB (all the feauters here
So i connected the modem to the usb port, but on my Ubuntu i686 the device is not automatically recognized by the Ubuntu Network Manager.
Then, i search on Google, and i found the USB_modeswitch project, that is (as reported in the site) “(surprise!) a mode switching tool for controlling “flip flop” (multiple device) USB gear.

So, from the forum of the project and from other results online, i found a configuration that run on my pc, with Ubuntu 12.04.2 LTS i686 and Unity.


1ST STEP: prepare the system

The usb-modeswitch needs the libusb and libudev package to run, and the system must not have another usb-modeswitch installed.

$ sudo apt-get install libusb-dev
$ libusb-config –version

(it is needed at least the version 0.1.12)

$ sudo apt-get remove usb-modeswitch
$ sudo apt-get install libudev0 libudev-dev


2ND STEP: download and compile the sources

The program source, device database and device references can be downloaded from the page of the project, from these links:

Then, they must be extracted from their archives and installed with the make command (build by the Makefile present in every folder).
Note that these installations need the tcl package already installed in the system. (otherwise see other methods in README file)

$ sudo apt-get install tcl
$ bunzip2 usb-modeswitch-1.2.5.tar.bz2 && tar xvfp usb-modeswitch-1.2.5.tar
$ bunzip2 usb-modeswitch-data-20121109.tar.bz2 && tar xvfp usb-modeswitch-data-20121109.tar

$ su
# cd usb-modeswitch-1.2.5
# make install
# cd ../usb-modeswitch-data-20121109
# make install


3TH STEP: configure the system

Now, the system still doesn’t recognize the device as a modem.
Then, the configure file usb_modeswitch.conf must be modified, with changing EnableLogging=1 (default value is 0) to enable the log of the device.

Then to automate the execution of usb_modeswitch, we need to add a command at the end of the file rc.local.

$ sudo nano /etc/rc.local

sudo modprobe usbserial vendor=0x2357 product=0x0201



Finally my device is working properly!!!!

The Ubuntu Network Manager recognizes a new 3G device, and shows the option “Enable Mobile Broadband“. So the configuration of the new connection is standard:

  • Edit Connections
  • Mobile Broadband
  • Add
  • select your device in the combo-box
  • Continue, select your Country and Continue
  • select your provider and Continue
  • if it appears the choose of the billing plan, select your plan or write it
  • then Continue and Apply
  • (in some cases, the provider may want the PIN to connect: must be entered in the appropriate field in the editing window of the connection)


So I’m finally connected to my provider “Vodafone Italy” (yuppi!!) and I’m connected to internet by the mobile broadband connection!!

Enjoy!!  ;o)