Problems running dhclient
Solution 1
Turns out the problem was AppArmour related; apparmor_status
showed that a profile sbin.dhclient
had been loaded, so running:
~$ sudo ln -s /etc/apparmor.d/sbin.dhclient /etc/apparmor.d/disable/
~$ sudo /etc/init.d/apparmor reload
Solved the problem. I could then bring up the interface as gertvdijk suggested
(No idea why/when that profile appeared - I suspect it might have something to do with the upgrade I ran just before)
Solution 2
I've used dhclient to manually bring up an interface on this computer
It is not advisable to do a DHCP request from the command line as that isn't managed by the system anymore. Instead, configure /etc/network/interfaces
to have your interface configured:
auto eth0
iface eth0 inet dhcp
Then reload the configuration:
sudo ifup eth0
Replace eth0
with the interface name on your system of course.
For more information, see the manpage of interfaces.
Check with
ifconfig -a
for interfaces not up, but available on your system.
[...] Permission denied
You got this, because you aren't running dhclient
as root/sudo. Just prepend the command with sudo
.
Related videos on Youtube
digitalPhonix
Updated on September 18, 2022Comments
-
digitalPhonix over 1 year
After running
apt-get upgrade
and restarting an Ubuntu Server install I noticed the computer didn't have a network connection.I checked
ifconfig
~$ ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:7376 errors:0 dropped:0 overruns:0 frame:0 TX packets:7376 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1424 (1.4 KB) TX bytes:1424 (1.4 KB)
The interface 'em1' was missing :/
So I tried
ifconfig em1 up
which brought the interface up and thendhclient em1
to get an IP address, but I ran into this error:~$ dhclient em1 dhclient: error while loading shared libraries: libc.so.6: failed to map segment from shared object: Permission denied ~$ dhclient dhclient: error while loading shared libraries: libc.so.6: failed to map segment from shared object: Permission denied
Does anyone have any idea what could be wrong? A number of people seemed to have issues with SELinux blocking dhclient, but even with
setenforce 0
I get this issue.I've used dhclient to manually bring up an interface on this computer before so I'm not sure what suddenly changed (and what changed to stop the interfacing auto-setting up on startup).
EDIT: The network adapter is fine and everything works when the ip/route/nameservers are set manually
Reinstalling
isc-dhcp-client
andisc-dhcp-common
didn't help, nor did reinstallinglibc6
EDIT2: I tried gertvdijk's suggestions. My
/etc/network/interfaces
is:auto lo iface lo inet loopback allow-hotplug em1 iface em1 inet dhcp
I tried
sudo ifup em1
but I get the same error :(~$ sudo ifup em1 dhclient: error while loading shared libraries: libc.so.6: failed to map segment from shared object: Permission denied Failed to bring up em1.
-
digitalPhonix almost 11 yearsThanks for your answer :) I tried bringing up em1 the way you suggested, but I get the same problem (even with sudo and sudo su)