Unable to install Samba 4 on Ubuntu 12.04

When I tried to install Samba4 on Ubuntu 12.04, I was getting the following error:


root@samba4:~# apt-get install samba4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  phpldapadmin samba-gtk swat2
The following NEW packages will be installed:
  samba4
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,662 kB of archives.
After this operation, 11.4 MB of additional disk space will be used.
Preconfiguring packages ...
Traceback (most recent call last):
  File "/usr/bin/samba-tool", line 26, in 
    from samba.netcmd.main import cmd_sambatool
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/main.py", line 24, in 
    from samba.netcmd.delegation import cmd_delegation
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/delegation.py", line 29, in 
    from samba.netcmd.common import _get_user_realm_domain
  File "/usr/lib/python2.7/dist-packages/samba/netcmd/common.py", line 24, in 
    from samba.net import Net
ImportError: libkdc-policy.so: cannot open shared object file: No such file or directory
Selecting previously unselected package samba4.
(Reading database ... 15986 files and directories currently installed.)
Unpacking samba4 (from .../samba4_4.0.0~alpha18.dfsg1-4ubuntu2_amd64.deb) ...
Processing triggers for ureadahead ...
Setting up samba4 (4.0.0~alpha18.dfsg1-4ubuntu2) ...
ERROR: Invalid smb.conf
ERROR: Invalid smb.conf
unable to open smb.conf at /usr/share/samba/setoption.pl line 22.
dpkg: error processing samba4 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 samba4
E: Sub-process /usr/bin/dpkg returned an error code (1)

In my case, I won’t be needing the missing modules. The workaround is to tell ubuntu the package installed correctly. Samba worked just fine for me without the missing .so file.

Edit /var/lib/dpkg/status and search for:

Package: samba4
Status: install ok half-configured

Replace with:

Package: samba4
Status: install ok installed

Posted in Linux, Samba | Comments Off on Unable to install Samba 4 on Ubuntu 12.04

How to specify an SSH key with git, without using a config file

There are a number of ways to do this, but for me setting up an ssh config file was not practical or desirable. I wanted to be able to make a fabric script that becomes a user (that does not have a shell) and does a git pull.

This approach works very well, on the command line, or in a fabric script:


ssh-agent bash -c 'ssh-add /path/to/private_key; git pull'

Posted in git, Linux | Comments Off on How to specify an SSH key with git, without using a config file

Use UTF-8 as the default encoding for postgres databases

To avoid problems with encoding if you forget to change from the default SQL_ASCII when you create a database, I find it is best to set the default to UTF-8 whenever I set up a new server. One less thing to worry about.

THIS WILL DESTROY ALL DATA. DO NOT DO THIS EXCEPT RIGHT AFTER YOU INSTALL POSTGRES

pg_dropcluster --stop 9.1 main
pg_createcluster --start -e UTF-8 9.1 main
Posted in postgres | Comments Off on Use UTF-8 as the default encoding for postgres databases

PHP Fatal Error: Error Number: 8192 Message: Function split() is deprecated

This annoyance popped up when I was moving a site from an old RedHat 4.4 server to a new ubuntu 12.04 server.

[Error message: [PHP Fatal Error: Error Number: 8192
Message: Function split() is deprecated

Replacing the split() function with explode() fixed it for me.   I had googled and found a recommendation to use preg_split() but it didn’t work exactly the same.

Posted in PHP | Comments Off on PHP Fatal Error: Error Number: 8192 Message: Function split() is deprecated

Raspberry Pi (raspbian) drops wireless connection after openvpn is started

Whenever the tap0 or tun0 device came up, my wireless connection would go down within a couple seconds. This was frustrating.

I found that there is a file /etc/default/ifplugd that needs to be edited.

Make it look like this:

INTERFACES="auto"
HOTPLUG_INTERFACES="eth0 wlan0"

This will prevent the default up script from tearing down your wireless connection. By default raspbian has “all” in the HOTPLUG_INTERFACES, which is NOT what we want if using openvpn and wireless.

online diamond buyers

Posted in Linux, raspberry pi | Comments Off on Raspberry Pi (raspbian) drops wireless connection after openvpn is started