Duplicate entries in /etc/rc.conf?

Hey all,

I am pretty new to FreeBSD. I have been experimenting with it in some qemu vms.
One thing that has confused me is that with the qcow2 releases I have (amd64 and riscv64) there are many duplicate lines in /etc/rc.conf

Code:
$ cat /mnt/etc/rc.conf
hostname="freebsd"
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
growfs_enable="YES"
hostname="freebsd"
zfs_enable="YES"
zpool_reguid="zroot"
zpool_upgrade="zroot"
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
growfs_enable="YES"
hostname="freebsd"
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
growfs_enable="YES"
hostname="freebsd"
zfs_enable="YES"
zpool_reguid="zroot"
zpool_upgrade="zroot"
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
growfs_enable="YES"
hostname="freebsd"
ifconfig_DEFAULT="DHCP inet6 accept_rtadv"
growfs_enable="YES"

Is this supposed to be like this?
 
Hi levitating,
it is not supposed to have duplicate lines in /etc/rc.conf. On the other hand it does not hurt.

Regarding the function, there are variables which are interpreted at start up. The default values are defined in /etc/defaults/rc.conf plus a few possible additional files. The entries in /etc/rc.conf just change the default settings. For example the hostname will be more or less individual. Therefore you will find a hostname entry in (almost) all /etc/rc.conf.

It does not hurt to define it multiple times, even if the name is not the same for each definition. As far as I remember the startup scripts will use the latest entry. BTW, I even had a wrong entry followed by a correct entry for some time. I did not notice that because the latest definition has been the correct one... What a shame...

Please have a look at /etc/defaults/rc.conf. It is interesting to see.
Kind regards,
Christoph
 
No, it's not meant to look like that ... looks as though "something" is adding to it. Or whoever you sourced the qcow2 images from had something going on.
 
chrbr thanks for your helpful reply

I know I didn't create these lines because I have the vm files marked readonly and emulate them with an overlay disk.

I think this is a bug in the generation of the 14.0 release VMs that somehow was never caught?
I can not replicate this with the 14.1 releases.

Steps to reproduce (on my Linux box):
Code:
wget https://download.freebsd.org/releases/VM-IMAGES/14.0-RELEASE/riscv64/Latest/FreeBSD-14.0-RELEASE-riscv-riscv64.raw.xz
xz -d FreeBSD-14.0-RELEASE-riscv-riscv64.raw.xz
sudo losetup -f -P FreeBSD-14.0-RELEASE-riscv-riscv64.raw
sudo mount /dev/loop0p3 /mnt/ -t ufs -o ufstype=ufs2 -o ro
cat /mnt/etc/rc.conf

I have seen it in riscv64.raw, riscv64.qcow2 and amd64.qcow2.
I am assuming it's present in all 14.0 vms.
 
Back
Top