Category Archives: GNU/Linux

mount –bind vs symbolic link

With mount –bind, a directory tree exists in two (or more) places in the directory hierarchy. This can cause a number of problems. Backups and other file copies will pick all copies. It becomes difficult to specify that you want to copy a filesystem: you’ll end up copying the bind-mounted files twice. Searches with find, grep -r, locate, etc., will traverse all the copies, and so on.

You will not gain any “increased functionality and compatibility” with bind mounts. They look like any other directory, which most of the time is not desirable behaviour. For example, Samba exposes symbolic links as directories by default; there is nothing to gain with using a bind mount. On the other hand, bind mounts can be useful to expose directory hierarchies over NFS.

You won’t have any performance issues with bind mounts. What you’ll have is administration headaches. Bind mounts have their uses, such as making a directory tree accessible from a chroot, or exposing a directory hidden by a mount point (this is usually a transient use while a directory structure is being remodelled). Don’t use them if you don’t have a need.

Only root can manipulate bind mounts. They can’t be moved by ordinary means; they lock their location and the ancestor directories.

Generally speaking, if you pass a symbolic link to a command, the command acts on the link itself if it operates on files, and on the target of the link if it operates on file contents. This goes for directories too. This is usually the right thing. Some commands have options to treat symbolic links differently, for example ls -L, cp -d, rsync -l. Whatever you’re trying to do, it’s far more likely that symlinks are the right tool, than bind mounts being the right tool.

it’s worth noting that some utilities might consider a bind-mounted directory to be a separate file system. This may have performance or functionality implications if the program can no longer assume that the same inode number refers to the same file (which it doesn’t, if they are on different file systems), a move cannot be optimized as link-at-target-then-unlink-source, etc.

Author: Gilles

Time zones

Dirty script to show times in different places in the world

echo -n -e "World Times:\n\tTokyo\t\t"; TZ=":Asia/Tokyo" date | cut -d " " -f4; echo -n -e "\tShanghai\t"; TZ=":Asia/Shanghai" date | cut -d" " -f4;echo -n -e "\tMoscow\t\t"; TZ=":Europe/Moscow" date | cut -d" " -f4;echo -n -e "\tRome\t\t"; TZ=":Europe/Rome" date | cut -d" " -f4;echo -n -e "\tLondon\t\t"; TZ=":Europe/London" date | cut -d" " -f4;echo -n -e "\tNew York\t"; TZ=":America/New_York" date | cut -d" " -f4;echo -n -e "\tLos Angeles\t"; TZ=":America/Los_Angeles" date | cut -d" " -f4

find your preferred places in /usr/share/zoneinfo
then place the script in your .bashrc


Quick way to setup swap

fallocate -l 4G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
mkswap /swapfile
swapon /swapfile
free -m

vim /etc/fstab
At the bottom of the file, you need to add a line that will tell the operating system to automatically use the file you created:
/swapfile none swap sw 0 0

VirtualBox and networking between guests

For this to happen you have to enable a secondary network adapter that is set as Internal Network (make sure you assign both guests to the same Internal Network, default is “intnet”)
The next step is to enable DHCP server on that network by this command:
VBoxManage dhcpserver add –netname intnet –ip –netmask –lowerip –upperip –enable

CyanogenMod for Sony device

1. To get to the service menu type this code in your dialer:
This way you can check if you can unlock your bootloader, it is 50/50 chance, it depends on the production batch.
If a bootloader is allowed to be unlocked you can install custom ROM, if not you will not be able to proceed any step further
2. find the right device on CM website
3. download the right build image (stable or nightly) and corresponding recovery image
4. download Open Google Apps from here
As you can see I would go for NANO build which is below 100MB in size
5. unlock bootloader:
6. PLEASE NOTE: you will need ADB and FASTBOOT applications and correct Sony drivers to be able to flash recovery image once the bootloader is unlocked
PLEASE NOTE that ADB and FASTBOOT uses different drivers to access the device
device is accessible using ADB when it is in normal mode
adb devices
device is accessible using FASTBOOT only from recovery mode
fastboot devices
fastboot flash boot boot.img
fastboot reboot

7. follow the instructions from an email they are going to send you
adb reboot bootloader - this is effective way to get to recovery mode for fastboot
fastboot -i 0x0xxx oem unlock 0xDxxxxxxxxxxxxx

8. flash custom ROM
adb sideload (from this moment you will not be able to access service menu anymore as it is not included in custom ROM)
9. install Google Apps
adb sideload
10. go trough initial device setup, sign up to Google Play
11. enable Root access within Developers option -> Root access for Apps and ADB
12. install TWRP ROM manager
13. flash TWRP recovery image
You definitely want to read this: as you will be presented with a question that your have to check prior flashing recovery image, you risk bricking the device so double check.
14. once custom TWRP image is flashed you can boot to it and perform a first backup

Moving to a new hard drive

Lets say you want to migrate your system to a new hard drive.
Of course the best practice is to buy a hard drive with the exact same size. This will save you problems.

I think instead of changing the files where disk UUIDs reside just swap UUIDs between the old and new disk.

invalid partition -- table wrong signature 0
This means something went wrong with the partition table and you want to use fdisk to write a valid partition table.


There is an extensive discussion about benefits and disadvantages of this features.
I have decided to disable it.

1. open “/etc/sysconfig/prelink” in a text editir (such as vi)
2. you should see this line: PRELINKING=yes
3. change ‘yes’ to ‘no’
4. save the change you just made & exit the text editor
5. manually run “/etc/cron.daily/prelink” as root.
6. prelinking is now disabled and will not reactivate the next time you reboot.

SSHD, SSD and Windows

These disks will save reputation of Microsoft because performance of Windows systems on traditional hard drives is bad. It happens to me to turn on this system from time to time and experience the difference.

Linux user: get rid of Win key

They do some nice stickers in US that you can stick over Windows symbol (Win key), but why to do that?
SammieV from Canada perfectly answers this: “I love that symbol, it reminds me of why I moved over to another OS.”
Windows same as KERNAL, Commodore Basic or DOS is our heritage like inventions of Ancient and Medieval times and I do have very good memories of Windows 98, 2000 and XP regardless of some occasional blue screens.

Digital Universe

Very interesting piece of software
if you get this error message:
error while loading shared libraries: cannot open shared object file: No such file or directory
you need to install 32-bit version of libGLU:
apt-get install libglu1-mesa:i386
yum install mesa-libGLU.i686

Log spamming

systemd: Starting Session xxx of user yyy.
systemd: Started Session xxx of user yyy.

The only workable solution to this is to comment out this line in your rsyslog.conf
# $ModLoad imjournal # provides access to the systemd journal


To better understand it please imagine:
Permissive Mode as a Intrusion Detection System (IDS) where
Enforcing Mode could be considered a Intrusion Prevention System (IPS).

Bluetooth: Error in firmware loading

Bluetooth: Error in firmware loading err = -110

So this is my story. My new laptop comes with Atheros AR9565.
This one has integrated wifi and bluetooth which causes problems.
My BT mouse was working fine, but suddenly disconnected to never come back even after multiple reboots.
Thanks to Fahad the solution was to create a file e.g. bluetooth-coe-fix.conf in /etc/modprobe.d with this single line:
options ath9k btcoex_enable=1
Reboot and voila!
Related bug report.