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

Fail to acquire DHCP IP in 58-start-dhclient.sh #1274

Closed
styerd opened this issue Mar 30, 2017 · 9 comments
Closed

Fail to acquire DHCP IP in 58-start-dhclient.sh #1274

styerd opened this issue Mar 30, 2017 · 9 comments
Assignees
Milestone

Comments

@styerd
Copy link
Contributor

styerd commented Mar 30, 2017

Relax-and-Recover (ReaR) Issue Template

Fill in the following items before submitting a new issue
(quick response is not guaranteed with free support):

  • rear version (/usr/sbin/rear -V): Relax-and-Recover 1.17.2
  • OS version (cat /etc/rear/os.conf or lsb_release -a): RHEL 7.2
  • rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):
    OUTPUT=PXE
    OUTPUT_URL=nfs://172.17.5.2/var/lib/tftpboot/rear
    BACKUP=NETFS
    BACKUP_URL=nfs://172.17.5.2/var/lib/tftpboot/rear
    BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/var/tmp' '/var/crash'
    '/erambr.log*' '/backup_restore.ksh.log*'
    '/etc/sysconfig/network-scripts/ifcfg-et*'
    '/etc/sysconfig/network-scripts/ifcfg-en*')
  • Are you using legacy BIOS or UEFI boot? UEFI
  • Brief description of the issue: Processor fails to acquire DHCP IP address
  • Work-around, if any: mods to "58-start-dhclient.sh"

On occasion our HP Proliant ML30 Gen9 reorders the interfaces as shown by "ip addr show" and the NFS mount fails with "network unreachable". In that case no network interfaces are configured which prompted a closer look. In "58-start-dhclient.sh" the following behavior was noted:

Press ENTER to run 58-start-dhclient.sh

  • source /etc/scripts/system-setup.d/58-start-dhclient.sh
    ++ dhclient -lf /var/lib/dhclient/dhclient.leases.eno1 -pf /var/run/dhclient.pid -cf /etc/dhclient.conf eno1
    ++ dhclient -lf /var/lib/dhclient/dhclient.leases.eno1 -pf /var/run/dhclient.pid -cf /etc/dhclient.conf eno1
    dhclient(519) is already running - exiting.
    ++ dhclient -lf /var/lib/dhclient/dhclient.leases.eno1 -pf /var/run/dhclient.pid -cf /etc/dhclient.conf eno1
    dhclient(519) is already running - exiting.
    ++ dhclient -lf /var/lib/dhclient/dhclient.leases.eno1 -pf /var/run/dhclient.pid -cf /etc/dhclient.conf eno1
    dhclient(519) is already running - exiting.
    ++ dhclient -lf /var/lib/dhclient/dhclient.leases.eno1 -pf /var/run/dhclient.pid -cf /etc/dhclient.conf eno1
    dhclient(519) is already running - exiting.
    ++ dhclient -lf /var/lib/dhclient/dhclient.leases.eno1 -pf /var/run/dhclient.pid -cf /etc/dhclient.conf eno1
    dhclient(519) is already running - exiting.

This actually is the functioning case since eno1 did in fact acquire an IP address and that interface is up. In the failure case ens2f0 is listed first and so replaces all instances of "eno1" above but there is no server available there and no cable attached. It appears that perhaps this code was intended to start dhclient on each interface which likely would work if the device changed for each invocation and also the '-pf' parameter was changed to avoid the "already running" complaint. As coded '$DEVICE' never changes.

A simple work around was to replace all this with a simple "dhclient" invocation which without parameters tries to acquire IPs on all interfaces. Perhaps we should specify "USE_DHCIENT=y" but the existing configuration was working for us most of the time.

@jsmeix
Copy link
Member

jsmeix commented Mar 31, 2017

@styerd
only a hint what you can use in newer ReaR versions,
see NETWORKING_PREPARATION_COMMANDS
in the current usr/share/rear/conf/default.conf
https://raw.githubusercontent.com/rear/rear/master/usr/share/rear/conf/default.conf

There have been some adaptions and enhancements
regarding network devices setup in the rescue/recovery system
since Relax-and-Recover 1.17.2 see the current release notes
https://raw.githubusercontent.com/rear/rear/master/doc/rear-release-notes.txt

Regarding specifically ReaR 1.17.2 on RHEL 7.2
you may better ask the Red Hat support people.

@styerd
Copy link
Contributor Author

styerd commented Mar 31, 2017

We had briefly tried with "USE_DHCLIENT" but that didn't work either and we haven't debugged in that path. In this path we find that clearing "DEVICE, DEVICETYPE, and REALDEVICE inside the "for dev in get_device_by_hwaddr" and making the pid file parameter unique in 58-start-dhclient.sh results in starting dhclient on each interface which seems to be the intention of this code. Timeouts on the uncabled ports costs about 5 minutes so our simplest/fastest solution is to simply replace the "58-start-dhclient.sh" code with a single "dhclient" command with no device parameter which at least on RHEL7 tries DHCP on each network interface and works equally as well as starting "dhclient" on each interface.

@gdha
Copy link
Member

gdha commented Apr 6, 2017

@styerd Could you explain a bit more in detail what you mean with clearing "DEVICE, DEVICETYPE, and REALDEVICE inside the "for dev in get_device_by_hwaddr" and making the pid file parameter unique in 58-start-dhclient.sh results in starting dhclient on each interface which seems to be the intention of this code. I see what you mean with the pid file...
The time-outs on the un-cabled interface - we could introduce a timeout call to reduce the amount of time

@gdha gdha self-assigned this Apr 6, 2017
@gdha gdha added the minor bug An alternative or workaround exists label Apr 6, 2017
@kyle-walker
Copy link

@gdha
I believe the code snippet that @styerd is referring to is:

/usr/share/rear/skel/default/etc/scripts/system-setup.d/58-start-dhclient.sh

    # IPv4 DHCP clients
    case $DHCLIENT_BIN in
            (dhclient)
                    dhclient -lf /var/lib/dhclient/dhclient.leases.${DEVICE} -pf /var/run/dhclient.pid -cf /etc/dhclient.conf ${DEVICE}
            ;;
            (dhcpcd)
                    dhcpcd ${DEVICE}
            ;;
    esac

The needed change to keep dhclient from failing is:

    # IPv4 DHCP clients
    case $DHCLIENT_BIN in
            (dhclient)
                    dhclient -lf /var/lib/dhclient/dhclient.leases.${DEVICE} -pf /var/run/dhclient.${DEVICE}.pid -cf /etc/dhclient.conf ${DEVICE}
            ;;
            (dhcpcd)
                    dhcpcd ${DEVICE}
            ;;
    esac

@styerd Is that correct?

@styerd
Copy link
Contributor Author

styerd commented Apr 10, 2017 via email

@jsmeix jsmeix added this to the ReaR v2.4 milestone Dec 1, 2017
@jsmeix
Copy link
Member

jsmeix commented Dec 1, 2017

Probably nothing that needs to be done for ReaR 2.3
so that I set the milestone to ReaR 2.4.

@gdha gdha added enhancement Adaptions and new features and removed minor bug An alternative or workaround exists labels May 10, 2018
@gdha gdha modified the milestones: ReaR v2.4, ReaR future May 10, 2018
@gdha
Copy link
Member

gdha commented May 10, 2018

Changed label 'minor bug' to 'enhancement' as it is not really a bug (it doesn't break the rescue system). Not urgent to fix so change milestone '2.4' to 'future'

@gerhard-tinned
Copy link

Having the same issue when trying to perform a restore from a from a machine with multiple interfaces (all dhcp). The first call to "dhclient" seems to work and the interface is receiving an IP. All following calls to dlclient fail. I believe the missing "${DEVICE}" in the pid-file name is causing the dhclient to exit with the "already running" error.

Ensuring a seperat pid-file for each dhclinet instance should fix this issue.

@gdha
Copy link
Member

gdha commented Feb 26, 2019

With the committed PRs this issue can be closed

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

No branches or pull requests

5 participants