How to change opkg configuration

Everything started from the need to install vsftpd. It's supposed to be very easy, just run opkg install vsftpd but it didn't work. I spent a while until understood why it doesn't find it. It turned out that /etc/opkg/distfeeds.conf contains only these two lines

src/gz openwrt_core http://downloads.openwrt.org/snapshots/targets/x86/generic/packages
src/gz openwrt_base http://downloads.openwrt.org/snapshots/packages/i386_pentium4/base

I build for x86 VM. As I understand this configuration file shows opkg where to look for the packages. vsftpd resides in ......./i386_pentium4/packages. How to add this URL to the source so that after the build and installation of the image this configuration file would contain this line and opkg install vsftpd would work?

Thank you,
Alex

The config setting for it in make menuconfig is called CONFIG_FEED_packages. It's under

     -> Image configuration
       -> Separate feed repositories

It's normally selected by default so I don't know why you don't have it.

That looks like a result from a faulty build, maybe compiled without updating and installing feeds before compilation.

I looked at Image configuration > Separate feed repositories. It indeed was not selected but even after I selected it I didn't find configuration for the opkg sources.
That is an interesting question about feeds. If you are talking about this

alex@AlexVM:~/Development/openwrt$ ./scripts/feeds update -a
Updating feed 'AddOnPackage' from '/home/alex/Development/AddOnPackage' ...
Create index file './feeds/AddOnPackage.index' 

alex@AlexVM:~/Development/openwrt$ ./scripts/feeds install -a
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libgnutls', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libopenldap', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libidn2', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libssh2', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/network/utils/nftables/Makefile' has a dependency on 'jansson', which does not exist
Installing all packages from feed AddOnPackage.

I did this before the build. AddOnPackage is my feed which I created accordingly to this instructions https://openwrt.org/docs/guide-developer/helloworld/chapter4. Is it possible that when I did this it broke the other part of default feeds or something?

which won't be available in the OpenWrt package archives.

You'll either need to host it on your own server, adding the repo's URL to /etc/opkg/customfeeds.conf, or copy it and its dependencies to your router manually, then install them by file name, rather than by package name.

I guess this is what I'm looking for but not on the target running system, I'm looking for how to change it before building OpenWRT so that I would have certain additional URL opkg could use after it is installed. I checked the source code directory and found customfeeds.conf in the package/system/opkg/files. I didn't test it yet but I hope if change it there it will be in the target image.

Files in any hierarchy beneath ./files/ of your build tree get mapped to the root of the ROM's filesystem.

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#custom_files

That is the right direction file to edit. You can edit it in the source

Alternatively, you can follow Jeff's advice about custom files and inclde edited version of it as custom file to the build. If I remember correctly, the file is /etc/opkg/customfeeds.conf in the final system.

Take a look at

feeds.conf.default

enable needed feeds or add some by default unsupported and build your image again.
dont forget update and install the feeds prior to the make menuconfig

Wy dont you add your repositories from gui after flashing, or add any file to /etc/opkg/ as a conf file. They will be parsed by opkg. For example addonpackage.conf. under Version configuration options you could change your main repository in menuconfig.
But the hints above should be sufficent