[[for the archives]]

In message <https://marc.info/?l=openbsd-misc&m=156192613829968&w=1>,
I wrote that pkg_add was failing (on 6.5/i386 running on an alix board):
|   sodium# pkg_add -vv tcsh-6.20.00p1-static.tgz
|   Fatal error: Can't write session into tmp directory
|    at /usr/libdata/perl5/OpenBSD/PackageRepository.pm line 1025.
|   sodium#
|
| I've checked that the firewall has adequate free memory & swap space,
| that all the obviously-relevant filesystems are mounted read-write and
| have free inodes and disk space, and that 'touch foo' can create a new
| file in each of /tmp, /var/tmp, and /usr/tmp.

Marc Espie's suggestion in
<https://marc.info/?l=openbsd-misc&m=156215779607119&w=1>
solved the problem:

> I would look more closely at your /var/tmp
> It's highly likely it has wrong permissions.
> 
> Checking that you can create a file in /var/tmp as root is definitely
> not enough.
> 
> pkg_add is privilege separated, it will run ftp(1)  as _pkgfetch

/var/tmp itself was ok (it's a symlink to ../tmp, and permissions on
symlinks don't matter).  But I had somehow gotten both /tmp and /usr/tmp
to be mode 755, so that non-root users didn't have write permission.
Correcting these directories to both be mode 777, so that non-root users
also had write permission, solved the problem.  (I also set the sticky
bit on both directories, as per sticky(8).)

Marc Espie also noted (private email) that in -current the pkg_* tools
produce a more detailed error message which makes it immediately clear
what's wrong in a situation like this.

For the record, my final (working) directory permissions are:

  sodium# ls -lFgd /tmp /usr/tmp /var/tmp 
  drwxrwxrwt  6 root  wheel  512 Jul 24 03:30 /tmp/
  drwxrwxrwt  2 root  wheel  512 Jul 18 00:31 /usr/tmp/
  lrwxr-xr-x  1 root  wheel    6 Jul 24 17:26 /var/tmp@ -> ../tmp
  sodium# 

My thanks to all who replied either on the list or in private email,
and my apologies for the delayed followup (which was due to a hand injury
leaving me badly typing-impaired for several weeks).

ciao,
-- 
-- "Jonathan Thornburg [remove -animal to reply]" 
<jth...@astro.indiana-zebra.edu>
   Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
   currently on the west coast of Canada
   "There was of course no way of knowing whether you were being watched
    at any given moment.  How often, or on what system, the Thought Police
    plugged in on any individual wire was guesswork.  It was even conceivable
    that they watched everybody all the time."  -- George Orwell, "1984"

Reply via email to