Recently I wanted to create completely static build of audioserve – so it can be easily moved and run on any modern 64bit linux without any other actions. Rust provides some guidelines for static building, but it still took me some time to make it work, mainly due to dependencies on other C/C++ libraries (libssl, libavformat …). So here I my experiences: Continue reading Static Build of Rust Executables
Tag Archives: linux
Linux Desktop for 2017 and on
As Canonical has announced the end of Unity desktop I thought it’s time to look again around at Linux desktops. In past years I have been using mainly Gnome 2 (or Mate recently), XFCE, Cinnamon and Unity (yes I did and experience was after all rather positive). I’ve tried Gnome 3 few years ago, but really never gave it longer try and never really find attraction for KDE. So in this article I’ll look a bit at those desktops again and especially at the recent Gnome Shell and it’s customization to my needs (which is indeed based on very individual preferences). Continue reading Linux Desktop for 2017 and on
Beware of sync option in mount
By default mount is using async option, which means that write operations do not wait for final confirmation from the device – they are stored in disc cache and writes are done latter, optimized by disc firmware. However you can set sync option manually ( -o sync
), then write operations are synchronous, meaning each block write has to wait for confirmation that it’s physically written to the disc and there is no optimization available. This can significantly slow down write speed, of which I convinced myself just recently – I backuped some data to external 2.5″ USB 3.0 HD – slowdown in this case was almost 1000x – (70kb/s vs 60MB/s measured by rsync --progress
). How it happened that disc was mounted with sync option? I actually use usbmount to auto-mount disks and it has sync as default mount option (fortunately can be changed in it’s configuration). So conclusion is – don’t use sync option unless you know exactly what you are doing and if write speed is suspiciously slow check mount options.
Run Multiple Terminal Tabs with Python Virtualenv
Virtualenv is a must have for python development. If your project is a complex beast consisting of multiple services/components you want them see running in different terminals (ideally tabs of one terminal window). Staring all terminal manually could be cumbersome. This simple script starts terminal tabs (in gnome-terminal) with activated virtual environments and eventually appropriate services/applications started:
#!/bin/bash VENV=".venv/bin/activate" export PYTHONPATH=~/workspace/asexor gnome-terminal \ --tab -e "bash --rcfile $VENV -ci 'cd asexor && crossbar start'" \ --tab -e "bash --rcfile $VENV" \ --tab -e "bash --rcfile $VENV" \ --tab -e "bash --rcfile $VENV"
None -ci
argument – interactive shell must be enforced to run command with virtual environment loaded.w
Also gnome terminal recently drop support for –title parameter, which enabled to set title to the tab (really do not understand why, because it was very useful). So now our tabs will have same prompt.
This can be somehow fixed with modification of virtualenv activate script to include terminal escape sequence shown below (thus we will see current terminal directory as tab title):
PS1="\[\e]0;\W\a\](`basename \"$VIRTUAL_ENV\"`)$PS1"
Replacing failed disk in Linux RAID1
In this past article I’ve written about setting a sofware based RAID1 on Linux. After less then two years one disks failed, so I had to replace it – here are my experiences with this procedure. Continue reading Replacing failed disk in Linux RAID1
Unity – adding unknown applications to Launcher/Dash
It’s described in numerous posts how to add new application to Unity so it’s searchable in Dash. Unity works with .desktop files, which define how applications should be launched from Unity – these files are located in /usr/share/applications
(system wide definitions) or ~/.local/share/applications
(user specifics application). So if you add well formated .desktop file to any of these locations Unity will be aware of it (may need to restart unity).
Recently I found one more interesting behavior of Unity – if you start unknown application from terminal it will appear in Launcher (in ‘Running applications’ section), Unity even makes some effort to find correct icon for it. Now you can lock it to Launcher (right click and chose ‘Lock to Launcher’ from menu). On background Unity creates new .desktop entry for this program in ~/.local/share/applications
, so it can stay locked to Launcher in future. This new .desktop file contains title of the application from window title (in which application is running) executable path and parameters are taken from process properties, even icon path is stored if Unity was able to find one. And when you unlock application from launcher, .desktop file will still remain in users applications – so you can search it in Dash. So this approach can make adding new unknown application easier – just run, then lock and unlock from Launcher and you’ll have new entry in ~/.local/share/application
. You can then edit it a bit manually to make it perfect and this is it.
UbuntuOne client behind proxy
It can sound bit weird, but most problematic platform for UbuntuOne client is Ubuntu itself – especially when your PC is behind proxy – or even worst when you’re moving between several networks with your laptop, where some nets are using proxy. Continue reading UbuntuOne client behind proxy
Converting files in directory structure
Often I needed to convert a set of files (audio files to different format, text files to different encoding, …) in some directory structure and save results to a new destination while retaining directory structure. In order to walk through directory structure we can use find
command, but if we are to create output in new place, subdirectories have to be created, which is where find
command line gets bit complicated (especially if we have to consider spaces in files/directories names). So here is an example for converting text files encoding:
find . -name "*.txt" -exec bash -c 'mkdir -p "/dest-dir/`dirname "{}"`"; iconv -f utf-8 -t windows-1250 -o "/dest-dir/{}" "{}"' \;
Software RAID 1 And LVM
While adding more capacity to my Ubuntu 12.04 based server I decided to use two disks in RAID 1 – although the whole topic is well discussed and described, it still took me some time to put all pieces together, so here I’d like to share my experiences. Plus there are couple of decision point on the way, so I’d like to explained my decisions, based on informations I read. Continue reading Software RAID 1 And LVM
Diskless PC (booting from USB stick) with Ubuntu
Recently I decided to revamp my linux HTPC and this time to do it properly – there is no disk and all media are on separate server (or NAS – I prefer server, because I’d like to run some other things there, which might be problematic to run on pure NAS box). New PC should boot from from common USB stick – 8GB – value around 5 EUR (I thought it would be more convenient to build system and I did not have any server yet to boot from network only – actually old HTPC would become server, but first new HTPC has to be created). To overcome two major issues of common USB stick – limit on number of write operations (too much writes decrease lifetime of the stick) and slow write operations speed I decided to use overlays file system (or sometimes called union file system), where (once all system is set up) all writes go to memory – this is similar to linux live CDs or USB sticks. In order to be able to do some user customizations after installation and that user can save various data his home directory, the home directory is hosted on server/NAS and shared via NFS. The recipe described below is for xubuntu 12.10. Continue reading Diskless PC (booting from USB stick) with Ubuntu