Solved Corrupt base.

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

I was able to shoot myself in the foot and got base corrupt.
What i did was to solve (as most as possible):
chflags -R noschg /
Download the tars from the freebsd ftp site and untar in /.
tar xvf base.txz
tar xvf kernel.txz
tar xvf lib32.txz
tar xvf src.txz
tar xvf tests.txz

Any other thoughts ?
 

jbodenmann

Aspiring Daemon

Reaction score: 307
Messages: 552

I have no idea what you're talking about - but that might just be lack of experience on my side. However, I do assume that it might be worth your wile to add more information such as the extend of the corrupted base, errors you get to see and stuff like that.
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

Sirdice would strongly disadvice of doing so, but i had put too many WITHOUT's (without underlying knowledge) in /etc/src.conf in other to build a small kernel and base system.
The global effect after installworld was that almost no library in base loaded anymore because of missing symbols. Even tar did not worked anymore.
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

I had a backup of /etc.
Currently trying to rebuild base, using the bootstrap compiler in /usr/src.
Code:
WITHOUT_SYSTEM_COMPILER=yes
WITHOUT_SYSTEM_LINKER=yes
WITH_CLANG_BOOTSTRAP=yes
WITH_CROSS_COMPILER=yes
 

bakul

Active Member

Reaction score: 90
Messages: 164

If /bin /lib etc. are corrupted (that can only happen if you did a make installworld) than recovering from base.xtz etc would make sense. But if they are fine, I'd start with
Code:
git clone --depth 1 -b release/13.0.0 --single-branch https://git.freebsd.org/src.git
cd src
make -j8 buildworld buildkernel && make installkernel
etc. And use bectl to recover from a crashing kernel.
For a small kernel you need to start with a copy of /sys/amd64/conf/MINIMAL and adjust as per your needs.
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

My PC is haunted by a form of DOOM.
I removed /bin /lib /libexec /usr/bin and untarred at new the .txzs of 13.0

Compiling kernel (makekernel) works fine. But when i compile base (makeworld) i always get:


install -U -d -m 0755 -o root -g wheel /usr/obj/usr/src/amd64.amd64/tmp/usr/share/nls
===> lib/libc_nonshared (obj,all,install)
Building /usr/obj/usr/src/amd64.amd64/lib/libc_nonshared/__stub.o
Building /usr/obj/usr/src/amd64.amd64/lib/libc_nonshared/__iconv.o
In file included from /usr/src/lib/libc/iconv/__iconv.c:33:
/usr/src/lib/libc/iconv/iconv-internal.h:37:48: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
int __bsd___iconv_get_list(char ***, size_t *, __iconv_bool);
^
/usr/src/lib/libc/iconv/__iconv.c:36:1: error: no previous prototype for function '__iconv' [-Werror,-Wmissing-prototypes]
__iconv(iconv_t a, char **b, size_t *c, char **d,
^
/usr/src/lib/libc/iconv/__iconv.c:35:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
size_t
^
static
2 errors generated.
*** Error code 1

Stop.
make[4]: stopped in /usr/src/lib/libc_nonshared
.ERROR_TARGET='__iconv.o'
.ERROR_META_FILE='/usr/obj/usr/src/amd64.amd64/lib/libc_nonshared/__iconv.o.meta'
.MAKE.LEVEL='4'
MAKEFILE=''
.MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose'
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

The solution seemed to be rather simple.
Use "su -" instead of "su" before the build, in order to have a clean environment, without additional flags,setting&path which could interfere with the building process.
 
  • Like
Reactions: mer

mer

Aspiring Daemon

Reaction score: 441
Messages: 706

That is a subtle little thing about the "su" command. When you add the dash it acts like you are logging in for that user, so it starts blank then runs all the init scripts (.profile, .login, whatever) for that user before you wind up in the SHELL that is configured for that user. Without it, you become that user but with your environment.

As a rule, I almost always add the dash.
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

For he who might be interested my current src.conf:

Code:
WITH_BHYVE=yes
WITHOUT_BLUETOOTH=yes

WITH_CCACHE_BUILD=yes
WITH_CLANG=yes
WITH_CLANG_BOOTSTRAP=yes
WITH_CPP=yes
WITH_CROSS_COMPILER=yes

WITHOUT_DEBUG_FILES=yes
WITHOUT_DMAGENT=yes
WITHOUT_DOCCOMPRESS=yes

WITH_ELFTOOLCHAIN_BOOTSTRP=yes


WITHOUT_FLOPPY=yes
WITH_FP_LIBC=yes

WITH_GPIO=yes

WITHOUT_HYPERV=YES

WITHOUT_INETD=yes
WITHOUT_IPX=yes

WITH_KDUMP=yes
WITHOUT_KVM=yes
WITHOUT_KVM_SUPPORT=yes

WITH_LIB32=yes
WITH_LIBCPLUSPLUS=yes
WITH_LLD=yes
WITH_LLD_BOOTSTRAP=yes
WITH_LLVM_TARGET_X86=yes
WITHOUT_LLVM_TARGET_AARCH64=yes
WITHOUT_LLVM_TARGET_ALL=yes
WITHOUT_LLVM_TARGET_ARM=yes
WITHOUT_LLVM_TARGET_BPF=yes
WITHOUT_LLVM_TARGET_MIPS=yes
WITHOUT_LLVM_TARGET_POWERPC=yes
WITHOUT_LLVM_TARGET_RISCV=yes
WITHOUT_LLVM_TARGET_SPARC=yes
WITH_LOADER_ZFS=yes
WITHOUT_LOCATE=yes
WITHOUT_LPR=yes

WITH_MAILWRAPPER=yes
WITH_MALLOC_PRODUCTION=yes
WITH_MAN=yes
WITHOUT_MANCOMPRESS=yes
WITH_MAN_UTILS=yes
WITHOUT_NDIS=yes
WITH_NIS=yes
WITH_NTP=yes
WITHOUT_NVME=yes

WITHOUT_OPENSSH=yes

WITH_PIE=yes

WITHOUT_RPCBIND_WARMSTART_SUPPORT=yes

WITH_SAFESTACK=yes
WITHOUT_SENDMAIL=yes
WITH_SSP=yes
WITH_SVN=yes
#WITHOUT_SYSTEM_COMPILER=yes
#WITHOUT_SYSTEM_LINKER=yes


WITHOUT_TCP_WRAPPERS=yes

WITHOUT_WIRELESS=yes
WITHOUT_WIRELESS_SUPPORT=yes
WITHOUT_WPA_SUPPLICANT_EAPOL=yes

WITH_ZFS=yes
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

In my shell script I've added in the second last line:
Code:
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/x/bin:$PATH
So system directories come before user directories.
 
OP
Alain De Vos

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

It seems to have nothing to do with PATH variable, i.e. some other environment variable makes buildworld fail using my user environment instead of root environment.
Remains which one and why ?
 
Top