Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install pkg from pkglist with vnet and DHCP #766

Open
alvistar opened this issue Apr 22, 2024 · 2 comments
Open

Unable to install pkg from pkglist with vnet and DHCP #766

alvistar opened this issue Apr 22, 2024 · 2 comments
Assignees

Comments

@alvistar
Copy link

Mandatory info for bug reports:

FreeBSD version ( uname -a ):
14.0-RELEASE

CBSD version ( cbsd version ):

14.0.7

Hello,
With vnet=1 and ip4_addr="REALDHCP", I can't manage to install pkg from pkglist.

It has some resolution issue:

pkg install, attempt: 1/2
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly/Latest/pkg.txz: Host does not resolve
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly.
Consider changing PACKAGESITE.
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait...
Trying to pkg update..
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly/Latest/pkg.txz: Host does not resolve
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly.
Consider changing PACKAGESITE.
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait...
pkg install, attempt: 2/2
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly/Latest/pkg.txz: Host does not resolve
Address resolution failed for http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly.
Consider changing PACKAGESITE.
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait...

Interestingly if I don't add pkgs machines starts correctly with correct ip from dhcp server. Anyway if I try to bootstrap pkg from within the jail it doesn't work, it complains that pkg is already installed. I had to resort to boostrap using pkg-static.

Now if ip4_addr=0 everything works, but then I have to dhclient eth0 inside the jail. Or to change ip4_addr="REALDHCP" after the jail creation.

I am not familiar with CBSD and I am trying to migrate from iocage so perhaps I am missing something, but I have tried to go through docs and issues before reporting.

Thanks,
Alessandro

@olevole
Copy link
Member

olevole commented Apr 22, 2024

Installation of packages via pkglist occurs before the container receives an address. For this reason, static configuration works correctly (when the network settings are correct), e.g..

cbsd jcreate jname=test1 allow_raw_sockets=1 vnet=1 runasap=1 ip4_addr="10.0.100.212" ci_gw4="10.0.100.1" pkglist="net/fping"

As far as I understand, static configuration is not suitable for you. In this case, you can use the post-create function. This is convenient if you are using a CBSDfile method and it works after the container has started, e.g. CBSDfile:

jail_test1()
{
        allow_raw_sockets=1
        vnet=1
        runasap=1
        devfs_ruleset=99                # unhide /dev ( /dev/bpf for dhclient ), for test only
        sysrc="ifconfig_eth0=DHCP syslogd_flags='-ss' sendmail_enable=NO sendmail_submit_enable=NO sendmail_outbound_enable=NO sendmail_msp_queue_enable=NO cron_enable=NO"
}

postcreate_test1()
{
        jexec <<EOF
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
pkg install -y net/fping
EOF
}
cbsd up

I'll try to see if we can make the pkg dependency on 'dhclient' in vnet-based jails

@olevole olevole self-assigned this Apr 22, 2024
@alvistar
Copy link
Author

Thanks for the quick reply and much appreciated for providing a workaround.

I'll try to see if we can make the pkg dependency on 'dhclient' in vnet-based jails
But yet il will definitively be streamlined if you can integrate in normal flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants