# No perl



## byrnejb (Oct 20, 2020)

Today, on FreeBSd-12.1p10,  I ran a script that has been working on FreeBSD for years and got this result: `env: perl: No such file or directory`.  Which is, to put it mildly, bizarre.  So I checked for perl: `which perl | echo $?`   ==> 1.   So, no`perl` installed.   So I checked that:

```
pkg info -x perl
p5-Log-Log4perl-1.53
perl5-5.32.0
perl5.30-5.30.3
```

So, I looked where it should be and saw this:


```
-r-xr-xr-x    1 root  wheel     23520 Aug  6 10:36 peglgears
-rwxr-xr-x    1 root  wheel     15448 Oct  5 19:14 perl5.30.3
lrwxr-xr-x    1 root  wheel         4 Oct  2 21:28 perl5.32.0 -> perl
-rwxr-xr-x    2 root  wheel     45836 Oct  5 19:14 perlbug5.30.3
```

And in /var/log/messages I found this:

```
grep perl /var/log/messages
Oct  8 11:04:56 vhost01 pkg[82169]: perl5-5.32.0 installed
Oct  8 11:04:58 vhost01 pkg[82169]: perl5-5.30.3 deinstalled
Oct  8 11:05:16 vhost01 pkg[82169]: perl5.30-5.30.3 installed
Oct 15 11:04:53 vhost01 pkg[22122]: p5-Log-Log4perl upgraded: 1.49 -> 1.53
```

Then I checked history for the time given:

```
hg '2020-10-08 11:0[4\|5]'
44792  2020-10-08 11:04:12: pkg upgrade ca_root_nss zenity ytnef swaks rrdtool
45424  2020-10-20 15:52:08: hg '2020-10-08 11:04'
45425  2020-10-20 15:56:22: hg '2020-10-08 11:05'
45426  2020-10-20 15:56:54: hg '2020-10-08 11:04\|5'
```

It appears that `pkg upgrade` removed the `perl` binary altogether; leaving a logical link that points to nothing.  

To fix the problem I ended up doing this:

```
pkg install perl5
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The most recent versions of packages are already installed

pkg install -f perl5
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
    perl5-5.32.0 [FreeBSD]

Number of packages to be reinstalled: 1

Proceed with this action? [y/N]: y
[1/1] Reinstalling perl5-5.32.0...
[1/1] Extracting perl5-5.32.0: 100%

which perl
/usr/local/bin/perl
```

Why did this happen?


----------



## Hornpipe2 (Oct 28, 2020)

I don't know why it happened, but thanks for posting - I had the same issue, and forced reinstall fixed it


----------

