Linux Tips & Tricks

[2017-07-06] Preventing excess disk space usage with systemd/journal logs

On my OpenSuSE Leap 42.2 Linux system with SSD drive (and limited space) systemd journal logs took over 3.2GB.
journalctl –disk-usage
-> Archived and active journals take up 3.2G on disk.
These variables need to be changed in “/etc/systemd/journald.conf":

[Journal]
SystemMaxUse=100M
SystemMaxFileSize=10M

[2015-10-06] Installing Python module for specific version of Python 

Here is a sample for Python 2.7.
1) Download and unzip module archive, cd into unpacked archive directory.
2) Run in terminal as root:

python2.7 setup.py install

[2015-09-18] Lost LibreOffice Basic macro modules after upgrade  4.x -> 5.x

It was really awkward, annoying and hard to solve problem.
For whatever reason (I think its a bug or glitch), new LibreOffice 5.x on first start simply overwrites XML config file with the list of registered LibO Basic macro modules. Go to
/home/your_user_name/.config/libreoffice/4/user/basic/Standard/
and open file named script.xlb in any text editor. Then replace its content with the one below, changing macro modules name (like main BA_mag_gen) to yours.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false">
<library:element library:name="BA_mag_atrafo"/>
<library:element library:name="BA_mag_gen"/>
<library:element library:name="BA_mag_geom"/>
<library:element library:name="BA_mag_test"/>
</library:library>

[2014-04-05] OpenSUSE – hassle-free KDE upgrade  

Upgrading KDE may be an irritating experience due to large number of inter-dependent packages.
Failing to comply with these dependencies may result misbehaved desktop environment.
Here is a simple way to do the upgrade.
1) Add repositoreis “KDE SC” and “KDE SC Extra” (more information here).
2) Run in terminal as root:

zypper dup --from KDE_SC && KDE_SC_Extra

[2013-10-09] ISPConfig3/Postfix mail queue stuck – solution

I’ve got this problem a couple of times with ISPConfig3 server- mail queue stuck for no apparent reason. First, I deleted all stuff from /var/vmail/mydomain.com, it didn’t help.
Here is a solution (run as root):

postsuper -d ALL

[2013-09-23] Installing OpenSuSE on Intel server m/b S1200BTL E98681-352 and LSI 3Ware 9750-4i RAID L5

After assembling new server with
Intel server m/b S1200BTL E98681-352 (BMC Firmware 1.13.2825, ME Firmware 02.02.00.036)
Intel Xeon E3-1230 3.3GHz
8GB ECC RAM
LSI 3Ware 9750-4i RAID L5 with 4x1TB WD hard drives
I’ve got nasty problem – server won’t boot, just blinking cursor after BIOS prompt. OS (OpenSuSE 12.3 x64 with EFI partition/GRUB2-EFI, secure boot off) was installed on hardware RAID5. Quite strange, since OS installer was loaded from USB stick with EFI partition, and no problem were encountered during installation process. As some people suggested, I flashed latest available Intel m/b firmware (BMC Firmware 1.16.4347, SDR 0.14, ME Firmware 2.2.0.49), switched on / off EFI Optimized Boot in BIOS (tried both possibilities). Looks like I moved one step backward – server just hang at BIOS prompt. Quite strange, in EFI command prompt “map -r” don’t list EFI boot partition on LSI/3Ware RAID. This moved me to the conclusion that LSI 3Ware 9750-4i BIOS and Intel EFI don’t play nicely together. I have removed EFI boot partition and installed GRUB2 instead of GRUB2-EFI. Now everything worked fine. Additionally, please be aware, that although LSI 3Ware 9750-4i theoretically supports RAID 6 (which can survive failure of 2 hard drives simultaneously without data loss), it has only one SFF-8087 4-lane connector, and therefore, requires SAS expander to connect more then 4 SATA drives. This expander costs more then 9750-4i, making it economically unattractive option, one should purchase 9750-8i with 2 x SFF-8087 ports instead in order to use RAID L6 option.

[2013-09-07] Installing MS fonts on OpenSuSE

sudo zypper install fetchmsttfonts

[2013-08-18] upowerd failure on SuSE Linux 12.3 x64

If upowerd daemon fail to start on your system with this message:

systemd[1]: Starting Daemon for power management…
upowerd[8289]: /usr/lib/upower/upowerd: symbol lookup error: /usr/lib/upower/upowerd: undefined symbol: g_type_class_adjust_private_offset
systemd[1]: upower.service: main process exited, code=exited, status=127/n/a
systemd[1]: Failed to start Daemon for power management.
systemd[1]: Unit upower.service entered failed state

Do the following:
1) Add Gnome 3.8 repository:
http://download.opensuse.org/repositories/GNOME:/STABLE:/3.8/openSUSE_12.3/
2) Update glib2-devel and glib2-tools from this repository.to 2.36.4 or above.
Then run:
systemctl restart upower.service
systemctl status upower.service

[2013-06-14] Compiling latest FreeCAD on SuSE Linux

Once I needed FreeCAD I noticed that RPM version in SuSE repositories is quite old and outdated. It didn’t took much time to compile latest version. Actually there is a how-to buried on FreeCAD wiki, but it needs some updates.

1) Add these repositories to YaST sources:

http://download.opensuse.org/repositories/science/openSUSE_12.3/
for OCE and OCE-devel
http://download.opensuse.org/repositories/home:/drevilt:/python/openSUSE_Factory/
for python-pycollada
http://download.opensuse.org/repositories/home:/scalpel4k/openSUSE_Factory/
for Coin-devel

2) Install these packages:

sudo zypper install gcc gcc-fortran git cmake rpm-build doxygen 
checkinstall swig OCE-devel libXerces-c-devel libode-devel
libeigen3-devel libqt4-devel libQtWebKit-devel Coin-devel SoQt-devel
boost-devel python-devel python-qt4 python-pivy python-pycollada libspnav-devel

Make sure that you have gcc, fortran, and other develoment tools installed.
Create subdirectory in home/your name/bin, e.g. FreeCAD. then “cd” to this path.

Download latest sources from FreeCAD git:

git clone git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad

Make another dir for compilation:

# build configuration
cmake ../free-cad
# build FreeCAD
make

Compiled binaries will be located in FreeCAD-Build_git/bin

[2013-06-06] Delete empty directories – recursively

Once I run into problem – I had a large archive containing a LOT of empty directories. Here is a shell commands to clean things up (actually made by someone else).

while [ -n "$(find . -depth -type d -empty -print -exec rmdir {} +)" ]; do :; done

[2012-08-30] Fix – Python macros don’t work anymore after upgrade LibreOffice 3.4 -> 3.5/3.6

Really annoying issue which could be somehow documented, or even better, avoided altogether with simple startup check procedure. In short, LibreOffice V3.4 and earlier stored Pyton scripts inside
“/home/~user/.libreoffice/3-suse/user/Scripts/python/”
and starting from V3.5 in
“/home/~user//.config/libreoffice/3-suse/user/Scripts/python/”
Just copy your Python scripts manually, and everything will be fine again.

[2010-11-30] Fix – ISPConfig 2.x doesn’t start properly on SuSE 11.x

I have noticed strange behavior of ISPConfig 2.x software running on OpenSuSE 11.x – after restart it starts with OK status but doesn’t work properly – at least BIND had to be restarted. I watched startup sequence and noticed a culprit – for whatever reason “ispconfig_server” “rc.init.d” script was launched before network service! No surprise system didn’t worked as expected. Fix is quite simple. First remove “ispconfig_server” from the list of startup scripts (with YAST for example). Second, open “/etc/init.d/ispconfig_server” with any text editor and these lines right at the beginning:

### BEGIN INIT INFO
# Provides:       ispconfig_server
# Required-Start: $network $syslog
# Should-Start:   
# Required-Stop:  $network $syslog
# Should-Stop:    
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Short-Description:
# Description:   
### END INIT INFO

It will tell OpenSuSE to run “ispconfig_server” only after network service is up and running. Then, add again “ispconfig_server” to the list of active startup scripts.

[2009-10-21] Mounting Remote Directory via SSH

You need to install fuse package to have secure shell filesystem support.

 sshfs remoteuser@remotehost:/path/to/remote_dir local_mountpoint

Then, use this command to unmount remote directory:

 fusermount -u local_mountpoint

[2009-10-21] Quick & Dirty Comparison of 2 Directories

Today I had a rather daunting task. I recovered a directory with important documents from my hard drive with damaged partition map. Although files should be OK, who really knows if that is true (there are over 5000 of them). On the other hand, I have a backup made some time ago. So I wish to stay with recovered version which has all new stuff (which I can check manually), but verify if any of older files (last modified more then 1 month ago) may become corrupt. So, basically, I am need to recursively compare 2 directories. Its simple as 1-2-3.
Just run in terminal “diff -r -q folder-1.1/ folder-2.2/”. “-r” means “recursive”, “-q” – brief, report only whether the files differ, not the details of the differences. Sample:

 diff -r -q folder-1.1/ folder-2.2/
 Only in folder-2.2/: 1.txt
 Only in folder-1.1/: 1.txt~
 Only in folder-1.1/: .emacs2
 Files folder-1.1//kitchin.txt and folder-2.2//kitchin.txt differ

PS. I have a number of interesting topics in the old version of this site. Old tips and tricks will not be moved here since I would like to keep new stuff separately from the old one.

Leave a Reply