6.5 pkg_add "Fatal error: Can't write session into tmp directory"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

6.5 pkg_add "Fatal error: Can't write session into tmp directory"

Jonathan Thornburg-3
I have 6.5/i386 installed on a PC Engines alix board (hostname 'sodium'),
acting as a home firewall and router.  I'd like to install some packages
the firewall it to make system adminstration easier.  So... I downloaded
the appropriate 6./i386 packages from a nearby OpenBSD mirror, ssh-ed them
to /tmp on the firewall, and then (logged into the firewall as root) tried
to  pkg_add  them.  Alas, pkg_add failed with an error message about being
unable to write into a temp directory:

  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.

Is there something obvious I'm overlooked here?  A Fine Man Page I should
be rereading before I start hacking debug prints into the pkg_add (perl)
source code?

Further information (cut-and-pasted from ssh session on the firewall):

  sodium# uname -a
  OpenBSD sodium.bkis-orchard.net 6.5 GENERIC#1 i386
  sodium# df -hi
  Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
  /dev/wd0a      378M   47.7M    311M    13%    1771   47379     4%   /
  mfs:54350     62.9M    2.0M   57.7M     3%       8    8182     0%   /tmp
  /dev/wd0e      677M   15.1M    628M     2%     352   87710     0%   /var
  /dev/wd0f      1.5G    698M    734M    49%   16248  191622     8%   /usr
  mfs:42325     62.9M    2.0K   59.7M     0%       1    8189     0%   /usr/tmp
  /dev/wd0g      516M    138M    352M    28%    8980   58602    13%   /usr/X11R6
  /dev/wd0h      1.7G    218K    1.6G     0%     110  233744     0%   /usr/local
  /dev/wd0j      5.1G    2.0K    4.8G     0%       1  701565     0%   /usr/obj
  /dev/wd0i      1.3G    2.0K    1.3G     0%       1  181885     0%   /usr/src
  sodium# cat /etc/fstab
  5fd63b50b0c6cb1d.a /            ffs rw,softdep,noatime                  1 1
  5fd63b50b0c6cb1d.d /tmp         mfs rw,async,nodev,nosuid,-s=64m        0 0
  5fd63b50b0c6cb1d.e /var         ffs rw,softdep,noatime,nodev,nosuid     1 2
  5fd63b50b0c6cb1d.f /usr         ffs rw,softdep,noatime,nodev            1 2
  5fd63b50b0c6cb1d.d /usr/tmp     mfs rw,async,nodev,nosuid,-s=64m        0 0
  5fd63b50b0c6cb1d.g /usr/X11R6   ffs rw,softdep,noatime,nodev            1 2
  5fd63b50b0c6cb1d.h /usr/local   ffs rw,softdep,noatime,wxallowed,nodev  1 2
  5fd63b50b0c6cb1d.j /usr/obj     ffs rw,softdep,noatime,nodev,nosuid     1 2
  5fd63b50b0c6cb1d.i /usr/src     ffs rw,softdep,noatime,nodev,nosuid     1 2
  sodium# top|head
  load averages:  0.08,  0.02,  0.01    sodium.bkis-orchard.net 13:12:00
  52 processes: 1 running, 50 idle, 1 on processor  up 14 days,  5:21
  CPU:  0.1% user,  0.0% nice,  0.3% sys,  0.0% spin,  0.3% intr, 99.3% idle
  Memory: Real: 35M/110M act/tot Free: 127M Cache: 46M Swap: 0K/548M
 
    PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
  59735 root      10    0    0K   19M sleep     bored    44:53  0.44% softnet
  65312 root     -22    0    0K   19M sleep     -       339.9H  0.00% idle0
  57981 root      10    0    0K   19M sleep     bored     7:56  0.00% sensors
  39371 _unbound   2    0   12M   10M sleep     kqread    1:33  0.00% unbound
  sodium# cd /tmp
  sodium# ls -l
  total 4144
  drwxrwxrwt  2 root  wheel      512 Jun 16 07:51 .ICE-unix
  drwxrwxrwt  2 root  wheel      512 Jun 16 07:51 .X11-unix
  -rw-r--r--  1 root  wheel  1499861 Jun 30 12:31 lynx-2.8.9rel1.tgz
  drwxr-xr-x  2 root  wheel      512 Jun 16 07:51 sndio
  -rw-r--r--  1 root  wheel   564428 Jun 30 12:31 tcsh-6.20.00p1-static.tgz
  drwxrwxrwt  2 root  wheel      512 Jun 30 12:33 vi.recover
  sodium#
  sodium# pkg_info
  sodium#
  sodium# which pkg_add
  /usr/sbin/pkg_add
  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# env
  _=/usr/bin/env
  LOGNAME=root
  PWD=/tmp
  HOME=/root
  OLDPWD=/tmp
  SSH_TTY=/dev/ttyp0
  TOP=-S -i -s1
  MAIL=/var/mail/root
  SSH_CLIENT=192.168.105.0 4099 22
  PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
  TERM=xterm
  SHELL=/bin/ksh
  SSH_CONNECTION=192.168.105.0 4099 192.168.105.62 22
  USER=root
  sodium# cd /tmp
  sodium# touch foo
  sodium# ls -l foo
  -rw-r--r--  1 root  wheel  0 Jun 30 13:07 foo
  sodium# /bin/rm foo
  sodium#
  sodium# cd /var/tmp
  sodium# touch foo
  sodium# ls -l foo
  -rw-r--r--  1 root  wheel  0 Jun 30 13:08 foo
  sodium# /bin/rm foo
  sodium#
  sodium# cd /usr/tmp
  sodium# touch foo
  sodium# ls -l foo
  -rw-r--r--  1 root  wheel  0 Jun 30 13:13 foo
  sodium# /bin/rm foo
  sodium#
 
Thanks in advance for any assistance,
--
-- "Jonathan Thornburg [remove -animal to reply]" <[hidden email]>
   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 | Threaded
Open this post in threaded view
|

Re: 6.5 pkg_add "Fatal error: Can't write session into tmp directory"

Raimo Niskanen-7
On Sun, Jun 30, 2019 at 01:18:15PM -0700, Jonathan Thornburg wrote:

> I have 6.5/i386 installed on a PC Engines alix board (hostname 'sodium'),
> acting as a home firewall and router.  I'd like to install some packages
> the firewall it to make system adminstration easier.  So... I downloaded
> the appropriate 6./i386 packages from a nearby OpenBSD mirror, ssh-ed them
> to /tmp on the firewall, and then (logged into the firewall as root) tried
> to  pkg_add  them.  Alas, pkg_add failed with an error message about being
> unable to write into a temp directory:
>
>   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.
>
> Is there something obvious I'm overlooked here?  A Fine Man Page I should
> be rereading before I start hacking debug prints into the pkg_add (perl)
> source code?
>
> Further information (cut-and-pasted from ssh session on the firewall):
>
>   sodium# uname -a
>   OpenBSD sodium.bkis-orchard.net 6.5 GENERIC#1 i386
>   sodium# df -hi
>   Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
>   /dev/wd0a      378M   47.7M    311M    13%    1771   47379     4%   /
>   mfs:54350     62.9M    2.0M   57.7M     3%       8    8182     0%   /tmp
>   /dev/wd0e      677M   15.1M    628M     2%     352   87710     0%   /var
>   /dev/wd0f      1.5G    698M    734M    49%   16248  191622     8%   /usr
>   mfs:42325     62.9M    2.0K   59.7M     0%       1    8189     0%   /usr/tmp

Am I reading the numbers correctly that /tmp and /usr/tmp are two different
memory file systems of maximum size 62.9M?  If so, I wonder what pkg_add is
trying to write into /tmp, it migh be way more than just some metadata...

/ Raimo Niskanen


>   /dev/wd0g      516M    138M    352M    28%    8980   58602    13%   /usr/X11R6
>   /dev/wd0h      1.7G    218K    1.6G     0%     110  233744     0%   /usr/local
>   /dev/wd0j      5.1G    2.0K    4.8G     0%       1  701565     0%   /usr/obj
>   /dev/wd0i      1.3G    2.0K    1.3G     0%       1  181885     0%   /usr/src
>   sodium# cat /etc/fstab
>   5fd63b50b0c6cb1d.a /            ffs rw,softdep,noatime                  1 1
>   5fd63b50b0c6cb1d.d /tmp         mfs rw,async,nodev,nosuid,-s=64m        0 0
>   5fd63b50b0c6cb1d.e /var         ffs rw,softdep,noatime,nodev,nosuid     1 2
>   5fd63b50b0c6cb1d.f /usr         ffs rw,softdep,noatime,nodev            1 2
>   5fd63b50b0c6cb1d.d /usr/tmp     mfs rw,async,nodev,nosuid,-s=64m        0 0
>   5fd63b50b0c6cb1d.g /usr/X11R6   ffs rw,softdep,noatime,nodev            1 2
>   5fd63b50b0c6cb1d.h /usr/local   ffs rw,softdep,noatime,wxallowed,nodev  1 2
>   5fd63b50b0c6cb1d.j /usr/obj     ffs rw,softdep,noatime,nodev,nosuid     1 2
>   5fd63b50b0c6cb1d.i /usr/src     ffs rw,softdep,noatime,nodev,nosuid     1 2
>   sodium# top|head
>   load averages:  0.08,  0.02,  0.01    sodium.bkis-orchard.net 13:12:00
>   52 processes: 1 running, 50 idle, 1 on processor  up 14 days,  5:21
>   CPU:  0.1% user,  0.0% nice,  0.3% sys,  0.0% spin,  0.3% intr, 99.3% idle
>   Memory: Real: 35M/110M act/tot Free: 127M Cache: 46M Swap: 0K/548M
>  
>     PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
>   59735 root      10    0    0K   19M sleep     bored    44:53  0.44% softnet
>   65312 root     -22    0    0K   19M sleep     -       339.9H  0.00% idle0
>   57981 root      10    0    0K   19M sleep     bored     7:56  0.00% sensors
>   39371 _unbound   2    0   12M   10M sleep     kqread    1:33  0.00% unbound
>   sodium# cd /tmp
>   sodium# ls -l
>   total 4144
>   drwxrwxrwt  2 root  wheel      512 Jun 16 07:51 .ICE-unix
>   drwxrwxrwt  2 root  wheel      512 Jun 16 07:51 .X11-unix
>   -rw-r--r--  1 root  wheel  1499861 Jun 30 12:31 lynx-2.8.9rel1.tgz
>   drwxr-xr-x  2 root  wheel      512 Jun 16 07:51 sndio
>   -rw-r--r--  1 root  wheel   564428 Jun 30 12:31 tcsh-6.20.00p1-static.tgz
>   drwxrwxrwt  2 root  wheel      512 Jun 30 12:33 vi.recover
>   sodium#
>   sodium# pkg_info
>   sodium#
>   sodium# which pkg_add
>   /usr/sbin/pkg_add
>   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# env
>   _=/usr/bin/env
>   LOGNAME=root
>   PWD=/tmp
>   HOME=/root
>   OLDPWD=/tmp
>   SSH_TTY=/dev/ttyp0
>   TOP=-S -i -s1
>   MAIL=/var/mail/root
>   SSH_CLIENT=192.168.105.0 4099 22
>   PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
>   TERM=xterm
>   SHELL=/bin/ksh
>   SSH_CONNECTION=192.168.105.0 4099 192.168.105.62 22
>   USER=root
>   sodium# cd /tmp
>   sodium# touch foo
>   sodium# ls -l foo
>   -rw-r--r--  1 root  wheel  0 Jun 30 13:07 foo
>   sodium# /bin/rm foo
>   sodium#
>   sodium# cd /var/tmp
>   sodium# touch foo
>   sodium# ls -l foo
>   -rw-r--r--  1 root  wheel  0 Jun 30 13:08 foo
>   sodium# /bin/rm foo
>   sodium#
>   sodium# cd /usr/tmp
>   sodium# touch foo
>   sodium# ls -l foo
>   -rw-r--r--  1 root  wheel  0 Jun 30 13:13 foo
>   sodium# /bin/rm foo
>   sodium#
>  
> Thanks in advance for any assistance,
> --
> -- "Jonathan Thornburg [remove -animal to reply]" <[hidden email]>
>    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"

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

Reply | Threaded
Open this post in threaded view
|

Re: 6.5 pkg_add "Fatal error: Can't write session into tmp directory"

Stuart Henderson
In reply to this post by Jonathan Thornburg-3
On 2019-06-30, Jonathan Thornburg <[hidden email]> wrote:

> I have 6.5/i386 installed on a PC Engines alix board (hostname 'sodium'),
> acting as a home firewall and router.  I'd like to install some packages
> the firewall it to make system adminstration easier.  So... I downloaded
> the appropriate 6./i386 packages from a nearby OpenBSD mirror, ssh-ed them
> to /tmp on the firewall, and then (logged into the firewall as root) tried
> to  pkg_add  them.  Alas, pkg_add failed with an error message about being
> unable to write into a temp directory:
>
>   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.
>
> Is there something obvious I'm overlooked here?  A Fine Man Page I should
> be rereading before I start hacking debug prints into the pkg_add (perl)
> source code?

Chances are you're temporarily out of space in /tmp during the run, but don't
see it because the files are cleaned up on exit. I think you would be better
off merging /tmp and /usr/tmp into a single slightly larger fs (or just use
a partition on wd0 for tmp - alixes don't really have enough RAM to throw
~half of it into a ramdisk).

Running under ktrace may give some clues. Try "ktrace -Bi pkg_add (...)".
The file is likely to be large so maybe cd /usr/obj first, or use ktrace -f.
Use kdump to see the plaintext version, which will be even larger, you might
want to "kdump | gzip -1 > kdump.txt.gz" and copy it to another system to
read it in an editor. Search backwards from the end of the file for part
of the text in the error message, then work backwards.

> Further information (cut-and-pasted from ssh session on the firewall):
>
>   sodium# uname -a
>   OpenBSD sodium.bkis-orchard.net 6.5 GENERIC#1 i386
>   sodium# df -hi
>   Filesystem     Size    Used   Avail Capacity iused   ifree  %iused  Mounted on
>   /dev/wd0a      378M   47.7M    311M    13%    1771   47379     4%   /
>   mfs:54350     62.9M    2.0M   57.7M     3%       8    8182     0%   /tmp
>   /dev/wd0e      677M   15.1M    628M     2%     352   87710     0%   /var
>   /dev/wd0f      1.5G    698M    734M    49%   16248  191622     8%   /usr
>   mfs:42325     62.9M    2.0K   59.7M     0%       1    8189     0%   /usr/tmp
>   /dev/wd0g      516M    138M    352M    28%    8980   58602    13%   /usr/X11R6
>   /dev/wd0h      1.7G    218K    1.6G     0%     110  233744     0%   /usr/local
>   /dev/wd0j      5.1G    2.0K    4.8G     0%       1  701565     0%   /usr/obj
>   /dev/wd0i      1.3G    2.0K    1.3G     0%       1  181885     0%   /usr/src
>   sodium# cat /etc/fstab
>   5fd63b50b0c6cb1d.a /            ffs rw,softdep,noatime                  1 1
>   5fd63b50b0c6cb1d.d /tmp         mfs rw,async,nodev,nosuid,-s=64m        0 0
>   5fd63b50b0c6cb1d.e /var         ffs rw,softdep,noatime,nodev,nosuid     1 2
>   5fd63b50b0c6cb1d.f /usr         ffs rw,softdep,noatime,nodev            1 2
>   5fd63b50b0c6cb1d.d /usr/tmp     mfs rw,async,nodev,nosuid,-s=64m        0 0
>   5fd63b50b0c6cb1d.g /usr/X11R6   ffs rw,softdep,noatime,nodev            1 2
>   5fd63b50b0c6cb1d.h /usr/local   ffs rw,softdep,noatime,wxallowed,nodev  1 2
>   5fd63b50b0c6cb1d.j /usr/obj     ffs rw,softdep,noatime,nodev,nosuid     1 2
>   5fd63b50b0c6cb1d.i /usr/src     ffs rw,softdep,noatime,nodev,nosuid     1 2
>   sodium# top|head
>   load averages:  0.08,  0.02,  0.01    sodium.bkis-orchard.net 13:12:00
>   52 processes: 1 running, 50 idle, 1 on processor  up 14 days,  5:21
>   CPU:  0.1% user,  0.0% nice,  0.3% sys,  0.0% spin,  0.3% intr, 99.3% idle
>   Memory: Real: 35M/110M act/tot Free: 127M Cache: 46M Swap: 0K/548M
>  
>     PID USERNAME PRI NICE  SIZE   RES STATE     WAIT      TIME    CPU COMMAND
>   59735 root      10    0    0K   19M sleep     bored    44:53  0.44% softnet
>   65312 root     -22    0    0K   19M sleep     -       339.9H  0.00% idle0
>   57981 root      10    0    0K   19M sleep     bored     7:56  0.00% sensors
>   39371 _unbound   2    0   12M   10M sleep     kqread    1:33  0.00% unbound
>   sodium# cd /tmp
>   sodium# ls -l
>   total 4144
>   drwxrwxrwt  2 root  wheel      512 Jun 16 07:51 .ICE-unix
>   drwxrwxrwt  2 root  wheel      512 Jun 16 07:51 .X11-unix
>   -rw-r--r--  1 root  wheel  1499861 Jun 30 12:31 lynx-2.8.9rel1.tgz
>   drwxr-xr-x  2 root  wheel      512 Jun 16 07:51 sndio
>   -rw-r--r--  1 root  wheel   564428 Jun 30 12:31 tcsh-6.20.00p1-static.tgz
>   drwxrwxrwt  2 root  wheel      512 Jun 30 12:33 vi.recover
>   sodium#
>   sodium# pkg_info
>   sodium#
>   sodium# which pkg_add
>   /usr/sbin/pkg_add
>   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# env
>   _=/usr/bin/env
>   LOGNAME=root
>   PWD=/tmp
>   HOME=/root
>   OLDPWD=/tmp
>   SSH_TTY=/dev/ttyp0
>   TOP=-S -i -s1
>   MAIL=/var/mail/root
>   SSH_CLIENT=192.168.105.0 4099 22
>   PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin
>   TERM=xterm
>   SHELL=/bin/ksh
>   SSH_CONNECTION=192.168.105.0 4099 192.168.105.62 22
>   USER=root
>   sodium# cd /tmp
>   sodium# touch foo
>   sodium# ls -l foo
>   -rw-r--r--  1 root  wheel  0 Jun 30 13:07 foo
>   sodium# /bin/rm foo
>   sodium#
>   sodium# cd /var/tmp
>   sodium# touch foo
>   sodium# ls -l foo
>   -rw-r--r--  1 root  wheel  0 Jun 30 13:08 foo
>   sodium# /bin/rm foo
>   sodium#
>   sodium# cd /usr/tmp
>   sodium# touch foo
>   sodium# ls -l foo
>   -rw-r--r--  1 root  wheel  0 Jun 30 13:13 foo
>   sodium# /bin/rm foo
>   sodium#
>  
> Thanks in advance for any assistance,

Reply | Threaded
Open this post in threaded view
|

Re: 6.5 pkg_add "Fatal error: Can't write session into tmp directory"

Marc Espie-2
On Tue, Jul 02, 2019 at 08:58:12AM -0000, Stuart Henderson wrote:

> On 2019-06-30, Jonathan Thornburg <[hidden email]> wrote:
> > I have 6.5/i386 installed on a PC Engines alix board (hostname 'sodium'),
> > acting as a home firewall and router.  I'd like to install some packages
> > the firewall it to make system adminstration easier.  So... I downloaded
> > the appropriate 6./i386 packages from a nearby OpenBSD mirror, ssh-ed them
> > to /tmp on the firewall, and then (logged into the firewall as root) tried
> > to  pkg_add  them.  Alas, pkg_add failed with an error message about being
> > unable to write into a temp directory:
> >
> >   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.
> >
> > Is there something obvious I'm overlooked here?  A Fine Man Page I should
> > be rereading before I start hacking debug prints into the pkg_add (perl)
> > source code?


> Chances are you're temporarily out of space in /tmp during the run, but don't
> see it because the files are cleaned up on exit. I think you would be better
> off merging /tmp and /usr/tmp into a single slightly larger fs (or just use
> a partition on wd0 for tmp - alixes don't really have enough RAM to throw
> ~half of it into a ramdisk).

Nope, I don't think that's the issue.

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