Posts Tagged ‘Linux/Unix’

Surprising new keyboard shortcuts

Thursday, June 17th, 2010

(Well, surprising me, at least)

It’s been a while since I wrote these two posts about keyboard shortcut, so I’ll try to summarize some neat ones I’ve recently learned:

Unix Shell

  • Ctrl+U deletes all characters on the cursor’s left. And.. keep it in the shell’s clipboard.
  • Ctrl+K deletes all characters to the cursor’s right (including the cursor’s position), keeps in clipboard.
  • Ctrl+Y: paste clipboard.
  • Ctrl+R: search for string in history. Multiple Ctrl+R’s search for the next matches in history. Btw, It’s F7/F8 on windows command prompt.

Google vim keys and more

  • Google search: Google Experimental Search, enables vim keys for browsing the results! Super useful.
  • Google Calendar support vim keys (j, k, l, m) for navigating in the calendar. Type “?” for more keyboard shortcuts.

GNOME

  • Alt+F10 toggles between maximal window size and original window size.
  • Alt+F9 minimizes window
  • Alt+F8 switches to resize window mode
  • Alt+F1 opens the GNOME menu.

Thanks for Zohar and Aviv for presenting me with most of the above shortcuts.

KDE: a call for a change (or: why I moved to GNOME)

Thursday, March 11th, 2010

[Disclaimer: I'm merely a KDE user, hardly involved with the KDE development processes; my criticism is based on what I see as a user, I'll be glad to be corrected in the comments]

Back when I started my way with Linux with the brand new RedHat 6.0 (which as always, preferred GNOME). KDE always went forward: KDE1 was pretty.. basic, KDE2 was a big step, and same goes from KDE3. I’ve been using KDE 3.5.x for quite a long while (RHEL/CentOS5 and Debian sid until recently). 3.5.x symbolizes, in my opinion, the last “winning’ era of KDE:  It had the right features, but more important: it was mature and stable.

KDE 4 introduced important improvements:

  • User interface continued the tradition of being much nicer than its predecessors. Compare for yourselves: KDE 1 2 3 4
  • Very nice OpenGL effects were added with two important advantages over GNOME+ Compiz: the OpenGL features are fully integrated inside KDE, configuration is way easier (Compiz configuration tool is scary), and the attitude is more towards productivity and less toward eye-candiness. For example, instead of the useless wobbling windows and water effects of Compiz, KDE provides the useful feature that displays all open windows and allows search-as-you-type for choosing the right application by its name, by simply putting the mouse pointer  on the top-left corner.
  • Simplified user interface: the developers had the courage to do some rewrites and strip complicated GUIs, even lose some features, and make the new KDE 4 apps more simple. This is mostly notable in konsole and amarok.

But, it also got worse than its predecessors on some areas:

(more…)

Debian: nfs-kernel-server is broken (Or: portmap to rpcbind transition)

Tuesday, January 5th, 2010

UPDATE: rpcbind-0.2.0-3 was just released, and it solves all the rpcbind issues.

UPDATE2: THE BUG WAS SOLVED! Alexander Wirt patched nfs-kernel-server: by removing the linkage of libtirpc, it now uses the previously method of IPv4 binding, thus not triggering the problem. When/if would rpcbind replace portmap – I don’t know.

[ This article describes my analysis to a problem found in Debian Unstable(sid) ]

1. The bug (link)

Since the end of December, a change in nfs-kernel-server package caused a change of behavior in some NFSv3 crucial services: rpc.statd, rpc.mountd. NFS is RPC-based, and as thus, it uses an RPC-to-UDP/TCP address translation service, aka port mapper. These services try to connect to port mapper when they need address translation, and since the recent change they first try to do it over IPv6.

portmap, the current widely-used rpc port mapper service, does not support IPv6. This causes these crucial services to die, and NFSv3 fails to start (actually, with default configuration it even prevents starting an NFSv4 server).

2. So… rpcbind?

(more…)

udev debugging toolbox

Thursday, December 24th, 2009

Ever wondered why a certain rule doesn’t run? Ever got confused (or disgusted) by udev rules format?

Well, with all the udev badness, there are many useful tools in the udev package, which help to understand how udev works. I’m still far from knowing all the tricks, but here are some things that I’ve learned recently:

Note: the udev tools got changed several times during the last 5 years. I’ll cover here the latest version (149), and the older, RHEL/CENTOS5 version.

1. INFO: get all info available to udev about a certain device (or all devices):

# udevadm info -e (RHEL5: udevinfo -e)

Try it.. amazing, eh? You can use each detail to write udev rules to match these devices.

(more…)

Sudo make me a sandwich

Friday, December 11th, 2009

Sudo

Q: How come “which ifconfig” (runing as a user) finds nothing, yet “sudo ifconfig” does work?

A: sudo has a compile-time parameter called with-secure-path, which sets a different PATH for the sudo environment. Debuntu secure path contains /sbin:/usr/sbin, and that’s how it works. This feature gets two goals: convenience (no full path required for common root cmds) and security (ignoring potentially bad user PATH).

NOTE that RHEL doesn’t use this option, and running “sudo ifconfig” there simply fails.

Q: How come sudo requests a password only on the first run?

A: Sudo has a nice mechanism for creating these “sudo session” things. After authentication, sudo creates a ‘timestamp dir’ (in /var/run/sudo on my Debian), then uses its date to check when the last successful authentication took place.

  • Session timeout is configurable, defaults to 15mins.
  • sudo -k kills this session by simply removing the timestamp dir.

All info is found in the sudo(8) and sudoers(5) manpages

Setuid and LD_LIBRARY_PATH

Just a quick insight from my workplace: to my surprise, a setuid binary deliberately ignores many environment variables such as LD_LIBRARY_PATH and LD_PRELOAD.

Security Shmecurity..

RIP sysvinit, welcome upstart

Saturday, September 5th, 2009

After Ubuntu and Fedora, Debian also migrates to upstart.

To summarize the article in the previous link, the main reason for the change is that the kernel is now no more blocking on some hardware scans, and this might make some init scripts (e.g. fsck, network) start before the device is initialized. We now need an event-based init system, so the kernel could “tell” it when the device is ready. This is something that upstart is capable of.

Now I wonder if RHEL6 would inherit upstart from Fedora, this will mean a complete victory for upstart.

Accessing a LVM volumes from a foreign OS

Sunday, July 19th, 2009

A lesson learned: in order to mount an LVM device on another machine or simply another OS (e.g., from within a live cd os, mount the local machine’s volumes), the LVM volume group must be exported and then imported. This is done using the vgexport / vgimport commands.

Another requirement, is to have lvm2 package installed (so lvs command actually sees the volumes), and device mapper module should be loaded (dm-mod) or builtin the kernel.

Thanks for Amir who found that out.

By the way, I’ve recently found the dmsetup command very useful.

bash evilness

Friday, July 10th, 2009

I’ve been trying to read a file in bash, and keep all the lines in a single variable, printing it at once after the loop:


all="EVIL_BASH"
cat /tmp/myfile | while read line; do
all="$all $line"
done
echo $all

However the output was only: EVIL_BASH, instead of having the lines of the /tmp/myfile appended.

WHAT THE HELL?

Because of the PIPE, the whole ‘while’ loop runs in another subshell. This means that $all outside the loop  is not the same $all from within the loop!

Sounds simply like scoping (as in perl), but a really awkward one. Beware.

SuSE chkconfig vs. insserv

Monday, June 29th, 2009

I got confused: should I use insserv or chkconfig on SLES? How do they differ?

Apparently, chkconfig is a perl wrapper to insserv, which actually mimics chkconfig very well.

Good.

Advantures of CentOS 5.3 upgrade

Friday, April 17th, 2009

I’ve upgraded my home server (which is also a router and an access point) from 5.2 to 5.3. All in all it was pretty flawless. Kudos to the CentOS team! Still, I’ll update about few issues I’ve encountered:

1. Atheros wifi driver: I’ve been using the madwifi driver until now, which is not a part of the kernel because of licensing issues (contains proprietry firmware I guess). CentOS 5.3 introduced the ath5k driver, which is a free implementation. However, ath5k still doesn’t implement “access point” mode, so I had to disable it (renamed  ath5k.ko and ran depmod -a), and reinstall madwifi 0.9.4 instead (simply running make; make install).

2. udev.rules were overwritten, which cleared the changes I’ve made, in particular the /dev/snd permissions were reverted to CentOS default (no “audio” group, only the device owner can access audio), so I had to re-change the /dev/snd/* file permissions.