Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, January 2, 2014

Keybindings in Openbox

When I log into XFCE on my work desktop remotely using NoMachine's NX client, the "p" button stopped working.  Instead of messing with my XFCE settings, I tried logging into LXDE.  The "p" button worked.

Then I needed to remap the keyboard shortcuts for switching/cycling through windows.  I'm using a Mac Pro at home, and left Command-Tab alone.  Instead, I wanted my keyboard's control + tab keys to cycle through windows.  In XFCE, I would have gone to the window manager settings in the main settings dialog.  However, it looks like I had to manually edit Openbox's keyboard mappings in an XML file.

I ran xev in the X session to find out which key was being pressed.  It said Control_L and Tab were being pressed.  When I edited the /.config/openbox/lxde-rc.xml file from:

   1:  <!-- Keybindings for window switching -->
   2:  <keybind key="A-Tab">
   3:    <action name="NextWindow"/>
   4:  </keybind>
...to:
   1:  <!-- Keybindings for window switching -->
   2:  <keybind key="Control_L-Tab">
   3:    <action name="NextWindow"/>
   4:  </keybind>
...it didn't work.  I didn't care if it was the left or right Control key, so I just changed it to:
   1:  <!-- Keybindings for window switching -->
   2:  <keybind key="C-Tab">
   3:    <action name="NextWindow"/>
   4:  </keybind>
Then I typed openbox --reconfigure to reload the settings without restarting Openbox, and it worked as expected.

References:


- http://openbox.org/wiki/Help:Bindings
- http://superuser.com/questions/248517/show-keys-pressed-in-linux
- http://linux.die.net/man/1/xev

Friday, May 11, 2012

Proprietary NVIDIA drivers for Linux

One of my perennial occasions to POUND MY HEAD AGAINST A WALL is trying to wrestle with video issues on Linux.  This time around, I was trying to once and for all figure out why Kubuntu was doing such a poor job with giving me the available 3D & window compositing effects.  My mantra which was written on paper and hanging on my cube wall in front of my eyeballs for years at my old job was, "Never install proprietary video drivers!  Evar!!!1"  I wrote that after wasting probably a dozen hours trying to get my Ubuntu box to run as I thought it should.  This time, after trying XRender (which I don't understand), then switching back to OpenGL (which I don't understand), trying different NVIDIA drivers from the Ubuntu/Kubuntu repositories (I'm using 12.04), trying to tweak my xorg.conf, etc., I finally just went to NVIDIA's site and downloaded the latest driver, dated something like last week.  Of course, I installed it, rebooted it, now everything is great.


Thursday, March 22, 2012

Tweaking display set-up on Ubuntu

(Thank you very much, Shinobu!)

I was trying to switch to the Nvidia drivers for Ubuntu 10.04, but was running into the same problem that made me ditch the drivers in the first place: I couldn't get Nvidia's config tool to rotate one of my monitors and leave the other alone.

Thanks to http://zuttobenkyou.wordpress.com/2009/10/04/linux-nvidia-xinerama-guide-rotating-just-one-monitor-in-a-dual-head-setup/ , I was able to switch to Xinerama (an Xorg extension), and rotate one of my monitors.  It involved some manual editing of my /etc/X11/xorg.conf , but nothing too painful.

Here's my /etc/X11/xorg.conf :


# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 1.0  (buildd@yellow)  Fri Apr  9 11:51:21 UTC 2010

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 1024 100 
    Screen      1  "Screen1" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "1"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "DELL ST2420L"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
    Option         "Rotate" "Left" # for portrait mode
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "DELL 1907FP"
    HorizSync       30.0 - 81.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
    #Option         "Rotate" "Left" # for portrait mode
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro FX 4600"
    BusID          "PCI:8:0:0"
    Screen          1
    Option         "RandRRotation" "on"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro FX 4600"
    BusID          "PCI:8:0:0"
    Screen          0
    Option         "RandRRotation" "on"
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "TwinViewXineramaInfoOrder" "DFP-1"
    Option         "metamodes" "DFP-0: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "DFP-1: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection


I'm sure there's still some cruft in there, but oh well.

Thursday, March 1, 2012

Debugging Google Chrome / Chromium CPU Horror

I hated to admit that using Google Chrome was destroying my productivity on my Ubuntu workstation at work.  The CPU usage was absolutely horrible, and the average load on my machine was usually anywhere from 1.5 to 7.  I know!

My workstation was fairly beefy memory-wise and CPU-wise, and had plenty of disk space.  I disabled everything I could think of, enabled GPU rendering of things, disabled debugging, extensions, ETC. . . .

I exited Chrome and waited for the processes to die.  Usually, I just verify this happened by looking at top; since Chrome usually owns the top spots (no pun intended), I wait until top shows no chrome processes, then I restart it.  This time, I did ps for chrome and chromium processes.  TURNS OUT that after using the Profile Manager[1] extension, several chrome and chromium processes were starting up every time I logged in.  I verified this by looking at "~/.config/autostart", which showed several *.desktop files pointing to Google Chrome and Chromium profiles.

So far, the change is extremely significant.  I recorded no benchmarks along the way, so I am unsure of how much each of my changes improved performance.  However, it appears that all of the extra Chrome processes were what made the biggest difference.

Chalk up another win for blogging about anecdotal information that may or may not lead to misunderstandings about technology.  :-)  You're welcome!


-Ali


[1]  I started using Profile Manager because I wanted to run multiple Chrome sessions in isolation, depending on what I was working on.  For my day-to-day work, I use one profile.  For my volunteer work, which I associate with its own Google Apps account, I use another profile.  For my browser testing, I use another.  THE LIST GOES ON.

Wednesday, October 5, 2011

Ubuntu + x11vnc + TightVNC = happytime

In searching for the current best way to access remote X sessions, I tried out x11vnc and TightVNC -- not the native client, but the Java app, no less -- and was immensely pleased!  Just ran "x11vnc -display :0" on a remote console, and connected with TightVNC instantly.  No additional config.  The display was very smooth, and resolution was 1280 x 1024.

FYI, that was a password-less session, so if you want to secure it, gotta do a little better than that.  But with a simple SSH tunnel, should only involve another command on the remote shell, right?

Friday, June 11, 2010

VMware Communities: Workstation Installer Hang 6.5.3 and ...


I just encountered a hang installing Workstation on Ubuntu Karmic.

Symptom: you are running a an install using 6.5.3 bundle and you get to "Configuring VMWare Player" and then everything stops indefinitely.

Cause: the installer runs vmware-modconfig-console which produces enough output with some kernels that the python engine deadlocks is command piplining during the compile.

Technical Details: It is always dangerous for a linux/unix program to use the pipe-based "run a sub-command" library calls if it isn't ready to read all the output in one thread while waiting for the command to complete in another. Normally such commands should either be reading the result text or redirecting that result text to /dev/null. The naieve version just runs the command and waits for the result. But if the result text is larger than the system pipe buffer size, the command will block while trying to send its output, and the command never finishes. With the command waiting for the parent to read the data, and the parent waiting for the command to finish, the whole shebang just comes to a stop.

Why this is happening: The current driver patches for the 2.6.31 kernels produce a lot of warning messages about the symbols _MSVC_VER and __FREE_BSD__ being not defined. This never happened before, and whoever wrote the installer never tried it against a long stream of output. So with the new warning stream the compile and the installer deadlock as above.

Workaround: There are three phases to the work around; It is necessary to catch and kill the compile step; this, in turn would cause the installer to back out the installation, so you have to stop that from happening; then you have to compile the modules manually.

Steps:

1) open two command windows.

2) become root in one of those windows. i.e. "su -". (If you havn't set your root password in Ubuntu use "sudo su -" and your login password)

3) in the root-ed window run "while true; do killall -9 vmware-modconfig-console; sleep 1; done" this wil try, once each second, to kill the module compile step. Ignore the stream of not-found messages.

4) in the non-root window run the install with sudo and the --ignore-errors argument; i.e. "sudo ./VMware-Workstation-6.5.3-185404.i386.bundle --ignore-errors". This will take a little longer than usual because of the continuous killall above, don't sweat it.

5) once the installer finishes go back to the root window and do a control-C to stop the kill loop.

6) In the root window run "vmware-modconfig --console --install-all" to install the modules.

Caveats and Tips:

a) Once you have a hung installer session you have to kill the python command that is running the installer. Think of that as a step-0 if it comes up. 8-)

b) If the installer still hangs, the kill loop may not be fast enough; start over but leave the 'sleep 1;' out of the kill loop. It will slow down the install even more, but it is more likely to catch the command in time.

ASIDE: It woudl be nice if the installer had a don't compile the modules step...

Hopefully the installer will be fixed soon.


I'm having this problem also. Tried strace, lsof, now trying this solution. Thanks in advance, guy!

Posted via web from Ali Nabavi's posterous

Friday, July 18, 2008

SSHFS from ext3 to NTFS woes

This is a follow-up to http://blog.alijnabavi.info/2008/07/difficult-experience-trying-to-create.html.

I thought I eliminated all of my problems yet there remained more problems: bytes of some of the files were zeroed out. It took me a while to figure this out, unfortunately. Finally, though, here is the config that seems to work (in my .bash_profile):

echo 'me_password' | sshfs me_username@www.me.domain.com: ~/mnt/www.me.domain.com -o password_stdin -o reconnect -o allow_root -o workaround=all -o ro -o umask=222 -o use_ino


Some of that is probably unnecessary and uninterested, but what solved my problem was the "-o use_ino".

I didn't want to blindly plug something in without understanding what it was doing . . . HOWEVER :-) I am not ready to learn about use_ino apparently because the results page that Google showed to me when I searched for it looked entirely unappealing, especially at 00:35 when I have to get up at 06:00. I'm just happy that my files are intact.