Router won't boot if config directory is symlinked to overlay-boot

Router fails to boot if /etc/config/ is a symbolic link pointing to /overlay-boot/upper/etc/config/ (ln -s /overlay-boot/upper/etc/config/ /etc/config). Presumably because the device tries to access the config directory in the middle of mounting the USB stick and the old overlay /overlay-boot

# /etc/config/fstab on /overlay-boot, symlinked on /overlay
config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'

# Original overlay partition, mounted as /overlay during boot
config 'mount'
        option  target  '/overlay-boot'
        option  device  '/dev/mtdblock3'
        option  fstype  'jffs2'
        option  options 'rw,sync'
        option  enabled '1'
        option  enabled_fsck    '0'

# External overlay partition, increases the available disk space on the router
config 'mount'
        option  target  '/overlay'
        option  uuid    '186f37df-2f8f-4283-919e-cb4a14b59097'
        option  enabled '1'

config 'swap'
        option  uuid    'd98414f9-a8e7-4df0-b353-fb4677d511a7'
        option  enabled '1'

What is causing this? I need to deduplicate the config directory so that the router can operate under the same configs with or without the the USB stick.

One approach might be to just overlay the "USB config" on top of the "stock" overlay.

This is what I do currently, the problem is that when I take the usb stick out, the configuration for things like vlans becomes outdated and generates problems. The idea is that config files should always be read from internal memory, so I don't have to sync them manually.

Ah, so you want the USB stick to overlay everything except /etc/config/ (or perhaps all of /etc/, as there is "config" there as well, or perhaps "the following directories" or ... ).

If only a few directories, I'd handle that with specific overlay mounts. I'll have to think if there's a "clever" way to achieve a few "holes" so that the writes go to the underlying file system instead.

1 Like