Saturday, 5 July 2014

Synaptics trackpad configuration and the dreaded "Windows Shell Common Dll has stopped working"

Recently, I've been repurposing my wife old laptop (a dell 1520 from 2007) after I was surprised how much faster it bacame after installing an SSD.
One of the things that I wanted to configure was the synaptics touchpad to have finger gestures (specially the 3 finger back and forward for the browser). After finding a suitable driver (as the lastest Synaptics drivers don't work on windows 8.1), I had to manually update the driver to the Synaptics one, because windows would keep setting it as a generic touchpad.

So finally, I had the driver installed, and I was ready to configure it... but when I tried to access the configuration screen I got the helpful message "Windows Shell Common Dll has stopped working".

Mouse properties
Windows Shell Common Dll has stopped working
After searching for about 1 hour, I found a few posts from people who got the same error when they tried to play a video... and the Synaptics tool does try to play a video to demonstrate each feature... a smoking gun.

Since my hacking skills are non-existent, I decided to take the low cost approach of removing all the wmv files from the folder where the driver was installed (c:\Program Files\Synaptics\SynTP\ in my case). After that I was able to access the configuration window.

Synaptics configuration window
It's a pitty that Synaptics doesn't have an option to configure right clicks in the same way as MacBooks (one finger pressed + one tap). It does have a right click with a 2 tap, but I think the other gesture is easier to use.

Tuesday, 6 August 2013

Error updating / installing cygwin

Cygwin recently started to provide different binaries for windows 32 and 64 bits (the previous version was 32 bit only). As part of this change, they've changed the layout of the update repositories, so if you have an old setup.exe binary, you might get one of the following errors when you select from which mirror to download the packages

  • Unable to get setup.ini from <ulr>
 or the more cryptic
  • Internal error: gcrypt library error 60 illegal tag.
The way to fix this is simple, just download one of the new flavours of setup_<arch>.exe from cygwin. If you download the 64 bit version I suggested you to install it in a different location or delete your previous version, but do not override a 32 bit version with a 64 bit version.



Thursday, 1 November 2012

Windows 7 internal shutdown command

It looks like Windows 7 now has its own shutdown command. If you want to shutdown your computer with a timer, you can run:

shutdown.exe /s /t 3600

/s tells the command to do a shutdown (no reboot) and /t is to add a time out. So the command above is equivalent to the linux command
shutdown -h 3600
If you suddenly don't want to shutdown (or reboot) your computer, you can abort the command with
shutdown.exe /a

Centos 6 hangs up at boot - say hi to selinux

Last night, I was updating some packages on a few Centos 6.2 VMs that I have in my home server when I found out that some commands hung (such as rpm), and that I couldn't open new login shells on any of the VMs.

I tried restarting one, just to see the boot process hang while starting bind/named. I restarted the VM again in single user mode, and disabled that service using chkconfig. Rebooted the VM, and it hung up on dhcpd, and later, after doing the same process, hung up on postfix.

At this point, I noticed a pattern: I obviously had broken a core library. Some of the packages that I had cherry picked for the update, were the standard C++ runtime libraries, and some other core components.

After searching the web for a while and fearing that I would need to reinstall all the VMs (luckily I have a golden VM template and I use puppet, so this wouldn't have been terrible, just very annoying), I found the release notes for Centos 6.3, which stated

If you update CentOS 6.2 to 6.3 with certain packages only, the system may hang upon reboot. For example, this happens if you apply only the security updates from CentOS 6.3. To fix this issue, boot the system with a "enforcing=0" kernel option and update selinux policy to 3.7.19-155.el6_3 (or later) available in the 6.3 updates repository.
Phew, I had a solution. I restarted all the VMs with the boot option enforcing=0, and updated the following two package
  • selinux-policy
  • selinux-policy-targeted
Some of the VMs had an inconsistent rpm database (2 VMs with unfinished transactions and 1 with duplicate packages). I was able to sort this out by running yum-complete-transactions and cleaning any of the unfinished transactions.

After that, all of the VMs started properly without any issues. Unfortunately, the one that failed to start up is the one that has all the core network services (dns, dhcpd, ntp, etc). And further it failed with the message Kernel panic - not syncing - Attempted to kill init!. I particularly don't like KP. But I assumed that it was related to selinux issue.

I rebooted the VM with enforcing=0 and it did boot up, which pointed to an error on the selinux database. I run semodule -B to rebuild the selinux policy and I got an odd error saying that it couldn't find some files. The fix was quite simple
  • Removed the policy packages with yum remove selinux-policy selinuc-policy-targeted 
  • Reinstalled the packages with yum install selinux-policy selinuc-policy-targeted
  • And to be sure I run semodule -B again
This time I didn't get any errors and the VM restarted without a KP.


So last night I've learned:
  • Don't do any patching/upgrading half an hour before your target time to go to sleep.
  • Respect selinux
  • Always upgrade first selinux policy files, before upgrading any other OS library package
  • Do a snapshot of the VMs before any big patching (schoolboy error)

Sunday, 30 September 2012

Cygwin: How to paste with a right click

For the last few weeks, I've been scratching my head because I could paste content into cygwin with a right click on my work computer, but I couldn't do it at home. And more annoyingly, I couldn't figure it out until a few minutes ago.

To enable paste with a right mouse click, follow these steps (written for dummies like me)

1) Open the cygwin options (aka preferences or settings)




2) Select mouse in the left menu, and select Paste under Right click action



And since the last few versions of cygwin supports windows resize, it has the same good features as putty :).

Sunday, 9 September 2012

Git error about missing ca-bundle.crt on Cygwin

If you get the following error:
$ git push -u origin master
error: error setting certificate verify locations:
  CAfile: /usr/ssl/certs/ca-bundle.crt
   [...]
when pushing, cloning, or any other operation that requires https access, the problem is that cygwin hasn't installed the ca-certificates package. Run the cygwin installer again, and add that package; after that git should start working.

Sunday, 5 February 2012

SELinux policy to run check_yum with sudo

A small update on the previous post. If you want to run check_yum with sudo you'll need to use the following policy file:


#-- Start nagios_plugin_checkum.te
module nagios_plugin_checkyum 1.0.4;

require {
        type usr_t;
        type boot_t;
        type admin_home_t;
        type rpm_var_lib_t;
        type tmp_t;
        type rpm_var_cache_t;
        type nrpe_t;
        type sudo_exec_t;
        type http_port_t;
        type rpm_exec_t;
        class capability { sys_nice audit_write };
        class tcp_socket name_connect;
        class file { rename execute setattr read lock create ioctl execute_no_trans write getattr unlink open };
        class netlink_audit_socket { write nlmsg_relay create read };
        class lnk_file read;
        class dir { search read write getattr remove_name open add_name };
}

#============= nrpe_t ==============
allow nrpe_t admin_home_t:dir search;
allow nrpe_t boot_t:dir { read getattr open };
allow nrpe_t http_port_t:tcp_socket name_connect;
allow nrpe_t rpm_exec_t:file { execute getattr read open ioctl execute_no_trans };
allow nrpe_t rpm_var_cache_t:dir { search getattr };
allow nrpe_t rpm_var_cache_t:dir { write read open add_name remove_name };
allow nrpe_t rpm_var_cache_t:file { rename create unlink setattr };
allow nrpe_t rpm_var_cache_t:file { write read getattr open lock };
allow nrpe_t rpm_var_lib_t:dir add_name;
allow nrpe_t rpm_var_lib_t:dir write;
allow nrpe_t rpm_var_lib_t:dir { getattr search };
allow nrpe_t rpm_var_lib_t:file create;
allow nrpe_t rpm_var_lib_t:file write;
allow nrpe_t rpm_var_lib_t:file { read lock getattr open };
allow nrpe_t self:capability { sys_nice audit_write };
allow nrpe_t self:netlink_audit_socket { write nlmsg_relay create read };
allow nrpe_t sudo_exec_t:file { read execute open execute_no_trans };
allow nrpe_t tmp_t:dir { read write add_name remove_name };
allow nrpe_t tmp_t:file { rename setattr read lock create write getattr unlink open };
allow nrpe_t usr_t:file { read getattr open };
allow nrpe_t usr_t:lnk_file read;
#-- End nagios_plugin_checkum.te

And you'll need to add something like the following to your /etc/sudoers file
nagios  ALL=(ALL) NOPASSWD: /usr/lib64/nagios/plugins/check_yum
 
And you need to comment out the following line in the sudores file, otherwise nrpe won't be able to parse the return
#Defaults    requiretty



References
  1. http://blog.gnucom.cc/2009/configuring-nagios-to-run-privileged-or-root-commands-with-nrpe/