sudo: unable to initialize PAM: Exec format error

I tried upgrade some packages tonight, but I found $ sudo ls sudo: unable to initialize PAM: Exec format error

I figured this was related to my use of ssh-agent for sudo authorization. I’ve been using sudo this way for just over a year, and wrote about it. I’m using the method described in Mr Lucas’ blog post on sudo auth via ssh-agent.

I went back to my blog post and saw mention of security/pam_ssh_agent_auth.

I noticed it was not installed:

$ pkg info security/pam_ssh_agent_auth
pkg: No package(s) matching security/pam_ssh_agent_auth

So I installed it:

# pkg install -r local security/pam_ssh_agent_auth
Updating local repository catalogue...
local repository is up-to-date.
All repositories are up-to-date.
New version of pkg detected; it needs to be installed first.
Checking integrity... done (0 conflicting)
The following 1 packages will be affected (of 0 checked):

Installed packages to be UPGRADED:
	pkg: 1.4.1 -> 1.4.4 [local]

The process will require 24 kB more space.

Proceed with this action? [y/N]: y
[empty] [1/1] Upgrading pkg from 1.4.1 to 1.4.4...
[empty] [1/1] Extracting pkg-1.4.4: 100%
Message for pkg-1.4.4:
 If you are upgrading from the old package format, first run:

  # pkg2ng
Updating local repository catalogue...
local repository is up-to-date.
All repositories are up-to-date.
The following 1 packages will be affected (of 0 checked):

New packages to be INSTALLED:
	pam_ssh_agent_auth: 0.10.2 [local]

The process will require 115 kB more space.
40 kB to be downloaded.

Proceed with this action? [y/N]: y
[empty] Fetching pam_ssh_agent_auth-0.10.2.txz: 100%   40 kB  41.6k/s    00:01    
Checking integrity... done (0 conflicting)
[empty] [1/1] Installing pam_ssh_agent_auth-0.10.2...
[empty] [1/1] Extracting pam_ssh_agent_auth-0.10.2: 100%

And then it worked:

$ sudo ls
.bash_history			.joe_state			.mailrc				.ssh				mnt
.bash_profile			.login				.profile			fetch.out			test.sh
.bashrc				.login_conf			.rhosts				gmirror-to-zfsroot-beadm.sh	test.sh~
.cshrc				.mail_aliases			.shrc				jail-testing

But wait, you might ask, how did I install without sudo? I happened to be in a jail. I use ezjail, so I used that to jump into the console:

$ sudo ezjail-admin console empty
Last login: Sat Jan 10 01:36:47 on pts/0
FreeBSD 9.3-RELEASE-p5 (GENERIC) #0: Mon Nov  3 22:38:58 UTC 2014

Welcome to FreeBSD!

Before seeking technical support, please use the following resources:

o  Security advisories and updated errata information for all releases are
   at http://www.FreeBSD.org/releases/ - always consult the ERRATA section
   for your release first as it's updated frequently.

o  The Handbook and FAQ documents are at http://www.FreeBSD.org/ and,
   along with the mailing lists, can be searched by going to
   http://www.FreeBSD.org/search/.  If the doc package has been installed
   (or fetched via pkg_add -r lang-freebsd-doc, where lang is the
   2-letter language code, e.g. en), they are also available formatted
   in /usr/local/share/doc/freebsd.

If you still have a question or problem, please take the output of
`uname -a', along with any relevant error messages, and email it
as a question to the questions@FreeBSD.org mailing list.  If you are
unfamiliar with FreeBSD's directory layout, please refer to the hier(7)
manual page.  If you are not familiar with manual pages, type `man man'.

Edit /etc/motd to change this login announcement.

You have new mail.
root@empty:/root # 
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top