Archive

Archive for the ‘linux’ Category

Lmod and Sudo: ‘module: command not found’

September 11th, 2015 No comments

Recently, I switched from Environment Modules to Lmod because of … reasons. I really like it so far but one thing annoyed me a bit. When executing sudo -s which is one of my usual workflows, my shell reports:

module: command not found

The reason is simple: sudo dumps most of the users environment with some exceptions, due to env_reset in /etc/sudoers, when spawning the new non-login shell. Specifically the last fact causes the trouble since Lmod is activated by sourcing the proper file on (login-)shell startup. In my case (following the Lmod docs) there is a soft link in /etc/profile.d pointing to /usr/share/lmod/lmod/init/profile.

My first attempts to modify the env_keep list in /etc/sudoers didn’t work, because the module command itself is set as a shell function which AFAIK cannot be handled by that list of kept variables.

from the shell environment:

BASH_FUNC_module%%=() { eval $($LMOD_CMD bash “$@”);
[ $? = 0 ] && eval $(${LMOD_SETTARG_CMD:-:} -s sh)

$ type module
module is a function
module ()
{
eval $($LMOD_CMD bash “$@”);
[ $? = 0 ] && eval $(${LMOD_SETTARG_CMD:-:} -s sh)
}

So I saw no other solution but adding the following code snippet to my /etc/bash.bashrc

if [ -z "$LMOD_CMD" ]; then
. /etc/profile.d/modules.sh
fi

This will test if there is a LMOD_CMD environment variable set. If not, it will source the proper file to activate Lmod.

Feel free to post if there are better solution! Cheerio!

Shell One-liner: psgrep

July 6th, 2015 2 comments

When I want to find out specific process information, I usually use ps aux | grep PATTERN. There are several drawbacks, but the most annoying one for me are the missing coloumn headlines. Therefore, I made this little alias and put it into my global bash.bashrc file:

alias psgrep=’ps u | head -n 1; ps aux | grep -v grep | grep’

This enables a psgrep command which can be used like grep (since that is exactly what it is).

psgrep

 

Maybe some of you know an even better way? Cheerio!

Categories: bashism, linux Tags: ,

Phone Book Backup Ubuntu Phone (Aquaris E 4.5)

April 25th, 2015 No comments

If you have an Ubuntu Phone, like the Aquaris E4.5 from BQ. You can backup your contacts the following way:

  1. Install the “Terminal” app from Ubuntu Core App Developers
  2. Open the app and type: syncevolution --export /home/phablet/Documents/utcontacts.vcf backend=evolution-contacts
  3. Connect phone to computer, copy the vcf from Documents

Do not follow the instructions on this website. The sudo leads to an “[ERROR] creating source registry: Cannot autolaunch D-Bus without X11 $DISPLAY”, while the “database=Personal” leads to “[ERROR] database not found: ‘Personal'”

Patching Running Linux Kernel

October 27th, 2014 No comments
Categories: linux Tags: , , ,

Debian + Icedove + Owncloud

March 27th, 2014 3 comments

Intro
As many others I have to sync my contacts and calendar between several systems. Since I have no Apple products and don’t want to donate my private data to Google, I found owncloud as the best solution covering my needs. Debian and Gnome have been allies for a long time now so I coupled the Evolution mail client with my owncloud instance. The last weeks were a little tricky due to several issues in my mail client (damaged encrypted mails, hung ups, excessive ressource consumption…) on Debian Jessie. After reaching peak annoyance level, it was time for a change.

Part I – The Mail Client
The only useful alternative known to me is Thunderbird. In the past I got to know Thunderbird as a very nice, fast, and powerful piece of software. Debian re-brands it to Icedove which can be installed using APT. To me as a Chromium user it looks quite familiar and exhibits a huge performance increase towards Evolution. Nice…
Next thing was to get my calendar into Icedove. Usually, I don’t like bloated software and prefer small, fast tools one for each task. The Exceptions to me are development suits and mail clients. Having all the important information bundled in on place is a nice thing. Thunderbird got the Lightning plugin, a great ‘little’ helper to manage dates within Thunderbird. Unfortunately, the integrated plugin interface of Icedove doesn’t work with (all?) Thunderbird plugins, so beware of using the integrated Extensions/Add-Ons menu! My first attempt lead to a crashing mail client on it’s startup with the following error message (when startet on the console) and seems to be a known Bug:

…version xul24.0 not defined in file libxul.so with link time reference…

On Debian one has to install Iceowl-extension, which basically is the Lightning plugin for Icedove, via APT and all is fine.

Part II – Owncloud and Remote Address Books
Getting Icedove and Owncloud to cooperate wasn’t that easy as expected (and as it should be!). First Problem, there is no way to enter a remote location for an address book (except LDAP) or calendar server. To ‘fix’ this one you need the Inverse SOGo Connector. The available software of the Debian repository does not include this frontend (just a sogo server and common files, as far as I can see) which helps to connect collaborative applications. So just download it from the website and install it. This time, the Thunderbird plugin works fine with Icedove. The SOGo Connector adds the entry Remote Address Book in the address book’s menu which can be found in File->New in your address book view. In the appearing wizard you can enter your owncloud address book link and your done.
Same thing for the calendar. Create a new calendar, choose On the Network and CalDAV and enter your proper owncloud link. When the sync seems not to work, and you get a message on startup (vie console) saying the calendar location seems to be a CalDAV collection and therefore is in the wrong format, you have entered the wrong link. If this is the case, log into your owncloud account, choose calendar and spot the button to get the personal link. This should include your login as an directory level in the URL. Use this link for your calendar location in Icedove.

Update-alternatives by example

March 13th, 2014 1 comment

Hi everyone,

some Linux distributions are using a symlink-based method to manage multiple versions of the same binary. For example one could have several Java VM version installed on the same system. Usually typing the java command will start one of them … but which one? The command update-alternatives manages a set of symlinks, located in /etc/alternatives by default, which refer to the correct binary. In the case of java, /etc/alternatives/java will refer to the binary somewhere in /usr/lib/jvm (for Debian). To change this link just call:

sudo update-alternatives –config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode

Press enter to keep the current choice[*], or type selection number:

The command’s output will show a list of installed alternatives for this binary, which will be configured by the packet manager. Selecting a number will change the symlink.

To add a custom alternative, update-alternatives –install is used. The description of this command can be found in it’s manpage, but I think an example will make it more clear. Let’s say we got JDK7 from the oracle website and want to add it. First install/copy it do a useful destination. I’ve chosen /usr/lib/jvm/java-7-sunjdk-amd64/jdk/. 😉

update-alternatives –install /usr/bin/java java /usr/lib/jvm/java-7-sunjdk-amd64/jdk/bin/java 1072

The first parameter (excluding –install) is the path of the symlink your system will use to find the binary. Therefore, it has to be at a location listed in your PATH environment variable. Thereafter, the name of the group is specified followed by the absolute location of the binary. A group is an alias which assorts the similar binaries. Finally, a priority value is set. The result looks like this:

update-alternatives –config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
————————————————————
0 /usr/lib/jvm/java-7-sunjdk-amd64/jdk/bin/java 1072 auto mode
* 1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
3 /usr/lib/jvm/java-7-sunjdk-amd64/jdk/bin/java 1072 manual mode

 

Categories: linux Tags: ,

NFS export not mounted after reboot

March 5th, 2014 8 comments

Long story short: you have an NFS export and a proper configured /etc/fstab on your client. Mounting manually via mount -a works fine but nothing happens after reboot. Try to add the following to your /etc/default/rcS:

 ASYNCMOUNTNFS=no

cheers!

Categories: linux Tags: , , ,

NFSv4 and the seven Nobodies

March 5th, 2014 1 comment

I don’t know why this is still an issue on Debian/Linux machines but it is as annoying as it already was 2 years or more ago. Imagine you want to export /home via NFSv4 on a server so your clients can mount it remotely. Mostlikely, you will end up with lots of nobody:nogroup labeled entries, when you do a ls -la /home on your client. Check your logfiles and when you find something like:

rpc.idmapd[1905]: nss_getpwnam: name ‘USERNAME’ not found in domain ‘localdomain’

chance is high your idmap is not properly configured. This service is needed for NFSv4 as far as I know. Unfortunately, it is sometimes deactivated by default. Check /etc/defaults/nfs-common for this entry:

NEED_IDMAPD=yes

which also will tell NFS to start idmapd on startup. Next step is to adjust domain settings which depends on your setup.

  • Check DNS/DHCP server config, especially on correct domain name and it’s export if this is desired
  • Check if the client correctly receives and sets domain name (see lease-file and domainname-command for example)

Last but not least you need to check /etc/idmapd.conf to have this entry:

Domain = yourdomain

where yourdomain must be set properly. If you’re not sure about the DNS/DHCP config and/or receive a (none) by the domainname command, you want to go with localdomain as value here.

Do not forget to restart all reconfigured services and that should fix the issue.

Categories: linux Tags: , , , ,

Rescue of a broken Parallels VM (Linux guest system)

October 31st, 2013 No comments

Something went terrible wrong. I upgraded form Parallels Desktop 6 to 9 to have my Ubuntu VM in Mac OSX 10.9. After the second boot of the VM I got a popup by Parallels: “your disk 7gb contains lots of unused space, would you like to compress to 2gb” or something like that.

My first thought was “hey, nice, a smart tool, which cares about users”. After lots of I/O and 10min later I had a second thought: “f**king bull**** software, i want my files back”. The VM was “gone”, every time I booted I got messages about missing sata devices. The VM hdd was corrupted (and still 7gb big).

Mounting the VM hdd in another VM didn’t help either, cause it didn’t even show up as a harddrive. And Murphy’s law hit me as always: I deleted a copy of the hdd earlier this day which I used to check a migration to virtualbox 🙁

Luckily Ubuntu (or at least a bunch of Linux tools) and the fact that I had only one etx4 partition helped me to restore the VM:

  1. Boot w/ a Linux live CD in the VM and run “parted /dev/sda” as suggested here
  2. Run “mklabel msdos” and “rescue 0% 100%” in parted (change 100% to something else if you have multiple partitions)
  3. Reoot w/ a Boot-Repair-Disk live CD in the VM to restore MBR, grup, …. as explained here
  4. Reboot w/o live CD and the VM hopefully works again (as it does in my case)

 

Summery:

  • Parallels Desktop 9 WTF???
  • Ubuntu/Linux *thumbs up* 😀
  • This writeup is not a general rescue guide, but worth a try if everything else fails.

Firefox 23+ Search in URL Bar

October 31st, 2013 1 comment

If you are a Firefox User you might have noticed, that something changed with the 23.0 Update. In former times, when you typed something in the URL bar (except an actually well formed URL) Firefox used Google search, independent of which search engine was selected at the top right search box. This changed with the 23.0 Version. Now the selected search engine from the search bar also is used for URL bar search. In my opinion this sucks.

But there is help, and it comes in the form of a little add-on called “keyword.URL Hack!”. You can install it from here: https://addons.mozilla.org/en-US/firefox/addon/keywordurl-hack/?src=api. After installation you have to change a setting in the about:config. To do this the following steps are necessary:

  1. Type “about:config” in your URL bar
  2. Accept the warning message
  3. Search for “keyword.URL”, if nothing shows up create an entry
  4. Right click in the empty space
  5. Select New -> String
  6. As an identifier type in “keyword.URL”
  7. In the next window type in “http://www.google.com/search?ie=UTF-8&sourceid=navclient&gfns=1&q=”
  8. Restart Firefox … thats all, now you can use Google as the default URL bar search engine

Why did Mozilla remove it? Well more or less because of security concerns. You can read the bugzilla entry here: https://bugzilla.mozilla.org/show_bug.cgi?id=738818

Categories: linux Tags: , , ,