[uml-user] Not possible to enable eth0 in UML: Device or resource busy
Hi all, Sometimes following error occurs in an UML when enabling the ethernet device: uml:~ # ifconfig eth0 up SIOCSIFFLAGS: Device or resource busy This happens when logging in to the uml via a telnet port. The problem is that in this case the /dev/net/tun device remains attached to 3 proceses on the host: host:~ # lsof /dev/net/tun COMMANDPIDUSER FD TYPE DEVICE SIZE NODE NAME in.telnet 7971 hillenr 24u CHR 10,200 4874 /dev/net/tun port-help 7972 hillenr 24u CHR 10,200 4874 /dev/net/tun linux 7974 hillenr 24u CHR 10,200 4874 /dev/net/tun When exiting the telnet session, these 3 processes are terminated and "ifconfig eth0 up" on the uml works again. Following is the complete scenario on how this problem can be reproduced: - After start of an uml instance, a number of processes are attached to the /dev/net/tun device on the host: host:~ # lsof /dev/net/tun COMMAND PIDUSER FD TYPE DEVICE SIZE NODE NAME linux 7621 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7627 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7628 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7629 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7630 hillenr 27u CHR 10,200 4874 /dev/net/tun - Now telnet to the uml port and log on. 3 additional processes are created on the host, each attached to /dev/net/tun: host:~ # lsof /dev/net/tun COMMANDPIDUSER FD TYPE DEVICE SIZE NODE NAME linux 7621 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7627 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7628 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7629 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 7630 hillenr 27u CHR 10,200 4874 /dev/net/tun in.telnet 8496 hillenr 27u CHR 10,200 4874 /dev/net/tun port-help 8497 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 8499 hillenr 27u CHR 10,200 4874 /dev/net/tun - On the uml, take down eth0 with "ifconfig eth0 down". All uml processes are now detached from /dev/net/tun, except the ones related to the telnet session: host:~ # lsof /dev/net/tun COMMANDPIDUSER FD TYPE DEVICE SIZE NODE NAME in.telnet 8496 hillenr 27u CHR 10,200 4874 /dev/net/tun port-help 8497 hillenr 27u CHR 10,200 4874 /dev/net/tun linux 8499 hillenr 27u CHR 10,200 4874 /dev/net/tun Now as long as the telnet session remains open, the status of eth0 can not be manipulated anymore because of "device or recource busy". I'm not sure if this is a bug on how the /dev/net/tun device is attached to the various uml processes or if this is expected behaviour somehow. Any ideas? Thanks, Robert --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 ___ User-mode-linux-user mailing list User-mode-linux-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
RE: [uml-user] Not possible to enable eth0 in UML: Device or resource busy
Thanks Jeff. Your patch seems to fix the problem partly, but I still get the "device busy" error because the tun device still remains attached to one process after eth0 is disabled in the uml. These are the uml related processes on the host after uml is started: [EMAIL PROTECTED]:~> pstree -p 26848 linux(26848)???linux(26855) ??linux(26856) ??linux(26857) ??linux(26858) Each of these processes except 26855 is attached to the tun device: [EMAIL PROTECTED]:~> lsof /dev/net/tun COMMAND PIDUSER FD TYPE DEVICE SIZE NODE NAME linux 26848 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 26856 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 26857 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 26858 hillenr 31u CHR 10,200 4874 /dev/net/tun After starting a telnet session to the uml telnet port, 3 more processes are created on the host: telnetd, port-helper and another "linux" process. [EMAIL PROTECTED]:~> pstree -p 26848 linux(26848)???in.telnetd(27160)???port-helper(27161) ??linux(26855) ??linux(26856) ??linux(26857) ??linux(26858) ??linux(27163) Thanks to your patch the tun device is not attached to the telnetd and port-helper processes anymore, but still to the newly created linux process: [EMAIL PROTECTED]:~> lsof /dev/net/tun COMMAND PIDUSER FD TYPE DEVICE SIZE NODE NAME linux 26848 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 26856 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 26857 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 26858 hillenr 31u CHR 10,200 4874 /dev/net/tun linux 27163 hillenr 31u CHR 10,200 4874 /dev/net/tun And after taking down eth0 in the uml, the tun device remains stuck in that process until the telnet session is terminated: [EMAIL PROTECTED]:~> lsof /dev/net/tun COMMAND PIDUSER FD TYPE DEVICE SIZE NODE NAME linux 27163 hillenr 31u CHR 10,200 4874 /dev/net/tun Many thanks, Robert > -Original Message- > From: Jeff Dike [mailto:[EMAIL PROTECTED] > Sent: Sunday, January 29, 2006 3:39 AM > To: Robert Hillen > Cc: user-mode-linux-user@lists.sourceforge.net > Subject: Re: [uml-user] Not possible to enable eth0 in UML: > Device or resource busy > > > On Sun, Jan 29, 2006 at 12:08:54AM +0100, Robert Hillen wrote: > > This happens when logging in to the uml via a telnet port. > The problem > > is that in this case the /dev/net/tun device remains attached to 3 > > proceses on the host: > > Nice diagnosis - does this patch below help? > > Index: linux-2.6.15-mm/arch/um/os-Linux/drivers/tuntap_user.c > === > --- > linux-2.6.15-mm.orig/arch/um/os-Linux/drivers/tuntap_user.c > 2006-01-03 17:39:46.0 -0500 > +++ linux-2.6.15-mm/arch/um/os-Linux/drivers/tuntap_user.c > 2006-01-28 21:08:13.0 -0500 > @@ -122,6 +122,7 @@ static int tuntap_open_tramp(char *gate, > return(-EINVAL); > } > *fd_out = ((int *) CMSG_DATA(cmsg))[0]; > + os_set_exec_close(*fd_out, 1); > return(0); > } > > @@ -137,7 +138,8 @@ static int tuntap_open(void *data) > return(err); > > if(pri->fixed_config){ > - pri->fd = os_open_file("/dev/net/tun", > of_rdwr(OPENFLAGS()), 0); > + pri->fd = os_open_file("/dev/net/tun", > + > of_cloexec(of_rdwr(OPENFLAGS())), 0); > if(pri->fd < 0){ > printk("Failed to open /dev/net/tun, > err = %d\n", > -pri->fd); > --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 ___ User-mode-linux-user mailing list User-mode-linux-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user
RE: [uml-user] Not possible to enable eth0 in UML: Device or resource busy
> -Original Message- > On Sun, Jan 29, 2006 at 02:27:42PM +0100, Robert Hillen wrote: > > Thanks Jeff. Your patch seems to fix the problem partly, > but I still > > get the "device busy" error because the tun device still remains > > attached to one process after eth0 is disabled in the uml. > > Can you try the attached patch, which replaces the earlier one? This patch solves the problem completely. Thanks a lot for your help. Robert --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 ___ User-mode-linux-user mailing list User-mode-linux-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user