# freebsd-update crash then grep and ranlib missing



## mecano (May 1, 2013)

Hello,

I just did a `freebsd-update -r 8.3-RELEASE upgrade` from 7.4p11, set kernel to GENERIC, then boot in single user mode (host company rescue mode); 

```
FreeBSD 7.4-RELEASE (GENERIC) #0: Fri Feb 18 01:55:22 UTC 2011
```
then mount all my partitions and chroot to it, then launch `freebsd-update install`.
I then got 
	
	



```
Installing updates...Bad system call (core dumped)
```
 with lots of 
	
	



```
Bad system call (core dumped)
```
I escaped tried to reboot, system won't boot, reboot in single user mode tried to run `freebsd-update install` and got

```
id: not found
[: !=: unexpected operator
sha256: not found
No updates are available to install.
Run '/usr/sbin/freebsd-update fetch' first.
```
Tried a `freebsd-install fetch`:

```
grep: not found
freebsd-update: Invalid key fingerprint: xxx
```
 (<<truncated fingerprint number)

I couldn't use `freebsd-update rollback`
Tried to `cd /usr/src && make buildworld` and got a 
	
	



```
mkdep -f .depend -a    -I/usr/obj/usr/src/tmp/legacy/usr/include /usr/src/tools/build/dummy.c
cc -O2 -fno-strict-aliasing -pipe  -I/usr/obj/usr/src/tmp/legacy/usr/include -c /usr/src/tools/build/dummy.c
building static egacy library
ranlib libegacy.a
ranlib:No such file or directory
*** Error code 1

Stop in /usr/src/tools/build.
*** Error code 1
```

Help!


----------



## mecano (May 1, 2013)

Still trying to recover, I edited /usr/local/etc/cvsup/standard-supfile to get consistency in /usr/src/
`/usr/local/bin/vim /usr/local/etc/cvsup/standard-supfile`
changed

```
*default release=cvs tag=RELENG_7_1
```
 to 
	
	



```
*default release=cvs tag=RELENG_8_3
```
then did
`csup /usr/local/etc/cvsup/standard-supfile && cd /usr/src && make buildworld`
still no go :/

*A*ny chance to recover from this?


----------



## mecano (May 1, 2013)

`make cleanworld && make cleandir` doesn't help still 
	
	



```
ranlib:No such file or directory
```

`whereis ranlib`

```
ranlib: /usr/src/gnu/usr.bin/binutils/ranlib
```

`set path= ( $path /usr/src/gnu/usr.bin/binutils )`
`echo $path`

```
/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin /root/bin /usr/src/gnu/usr.bin/binutils
```

`/usr/src/gnu/usr.bin/binutils/ranlib`

```
/usr/src/gnu/usr.bin/binutils/ranlib: Permission denied.
```

`make cleanworld && make cleandir`
`make buildworld`

```
rm -f .depend
mkdep -f .depend -a    -I/usr/obj/usr/src/tmp/legacy/usr/include /usr/src/tools/build/dummy.c
cc -O2 -fno-strict-aliasing -pipe   -I/usr/obj/usr/src/tmp/legacy/usr/include -c /usr/src/tools/build/dummy.c
building static egacy library
ranlib libegacy.a
ranlib:No such file or directory
*** Error code 1

Stop in /usr/src/tools/build.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```


----------



## mecano (May 1, 2013)

`ls -la /usr/src/gnu/usr.bin/binutils/ranlib`

```
total 6
Bad system call (core dumped)
```

`ls /usr/src/gnu/usr.bin/binutils/ranlib`

```
Makefile
```

`cd /usr/src/gnu/usr.bin/binutils/ranlib/ && make`

```
Warning: Object directory not changed from original /usr/src/gnu/usr.bin/binutils/ranlib
cc -O2 -fno-strict-aliasing -pipe -march=nocona -DBFD_DEFAULT_TARGET_SIZE=64 -I. -I/usr/src/gnu/usr.bin/binutils/ranlib -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbfd -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbfd -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/include -D_GNU_SOURCE -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbinutils -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/binutils -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/bfd -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/binutils/ar.c
cc -O2 -fno-strict-aliasing -pipe -march=nocona -DBFD_DEFAULT_TARGET_SIZE=64 -I. -I/usr/src/gnu/usr.bin/binutils/ranlib -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbfd -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbfd -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/include -D_GNU_SOURCE -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbinutils -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/binutils -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/bfd -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -c /usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/binutils/is-ranlib.c
cc -O2 -fno-strict-aliasing -pipe -march=nocona -DBFD_DEFAULT_TARGET_SIZE=64 -I. -I/usr/src/gnu/usr.bin/binutils/ranlib -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbfd -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbfd -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/include -D_GNU_SOURCE -I/usr/src/gnu/usr.bin/binutils/ranlib/../libbinutils -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/binutils -I/usr/src/gnu/usr.bin/binutils/ranlib/../../../../contrib/binutils/bfd -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign  -static -o ranlib ar.o is-ranlib.o ../libbinutils/libbinutils.a ../libbfd/libbfd.a ../libiberty/libiberty.a
cc: ../libbinutils/libbinutils.a: No such file or directory
cc: ../libbfd/libbfd.a: No such file or directory
cc: ../libiberty/libiberty.a: No such file or directory
*** Error code 1

Stop in /usr/src/gnu/usr.bin/binutils/ranlib.
```

Indeed.


----------



## mecano (May 1, 2013)

`find / -name libbinutils`

```
/usr/src/gnu/usr.bin/binutils/libbinutils
```

`cd /usr/src/gnu/usr.bin/binutils/libbinutils && ls`

```
Makefile	config.h
```

`make`

```
Warning: Object directory not changed from original /usr/src/gnu/usr.bin/binutils/libbinutils
lex -t  /usr/src/gnu/usr.bin/binutils/libbinutils/../../../../contrib/binutils/binutils/arlex.l > arlex.c
lex: not found
*** Error code 127

Stop in /usr/src/gnu/usr.bin/binutils/libbinutils.
```

`find / -name lex`

```
/usr/src/contrib/file/Magdir/lex
/usr/src/usr.bin/lex
```

`cd /usr/src/usr.bin/lex && make`

```
Warning: Object directory not changed from original /usr/src/usr.bin/lex
lex -t  -is scan.l > scan.c
lex: not found
*** Error code 127

Stop in /usr/src/usr.bin/lex.
```

looped


----------



## mecano (May 1, 2013)

*O*ut of the blue
`nextboot -k GENERIC`
`reboot`

```
reboot: Command not found.
```
`shutdown -r now`

```
shutdown: Command not found.
```
`exit`
`reboot`

*G*uess it will not come back, but let's try.


----------



## mecano (May 1, 2013)

Back to single user mode, can't I get ranlib, sha256 and others through network, sysinstall looks like it is working, should I try it?

[edit] or buildworld from safe boot then chroot to install? One problem though is that /usr/obj is read only :/ How to tell `make buildword` to use another obj folder?


----------



## mecano (May 1, 2013)

I'll just copy over missing bins and rebuild based on RELENG_7_4, I must have skipped some ports update for freebsd-update to behave strangely.


----------



## mecano (May 1, 2013)

*W*ith RELENG_7_4 /usr/src cleaned 

```
mkdep -f .depend -a    -I/usr/obj/usr/src/tmp/legacy/usr/include /usr/src/usr.bin/makewhatis/makewhatis.c
echo makewhatis: /usr/lib/libc.a /usr/lib/libz.a /usr/obj/usr/src/tmp/legacy/usr/lib/libegacy.a >> .depend
cc -O2 -fno-strict-aliasing -pipe  -I/usr/obj/usr/src/tmp/legacy/usr/include -c /usr/src/usr.bin/makewhatis/makewhatis.c
/usr/src/usr.bin/makewhatis/makewhatis.c: In function 'process_mandir':
/usr/src/usr.bin/makewhatis/makewhatis.c:911: warning: passing argument 3 of 'scandir' from incompatible pointer type
cc -O2 -fno-strict-aliasing -pipe  -I/usr/obj/usr/src/tmp/legacy/usr/include  -static -L/usr/obj/usr/src/tmp/legacy/usr/lib -o makewhatis makewhatis.o -lz -legacy
sh /usr/src/tools/install.sh -s -o root -g wheel -m 555   makewhatis /usr/obj/usr/src/tmp/legacy/usr/bin
sh /usr/src/tools/install.sh -o root  -g wheel -m 555  /usr/src/usr.bin/makewhatis/makewhatis.local.sh  /usr/obj/usr/src/tmp/legacy/usr/libexec/makewhatis.local
/usr/obj/usr/src/tmp/legacy/usr/libexec/catman.local -> /usr/obj/usr/src/tmp/legacy/usr/libexec/makewhatis.local
Bad system call (core dumped)
*** Error code 140

Stop in /usr/src/usr.bin/makewhatis.
*** Error code 1
```

*T*hanks for your help.


----------



## mecano (May 1, 2013)

*O*k, after a major cp of libraries and binaries, it's in the process of building world, finger crossed, sorry for the noise.

Looks like there was something weird with M4.


----------

