When adding mac_eth0="00:0c:76:1b:2c:5e" to /etc/conf.d/net macchanger can change the MAC when starting /etc/init.d/net.eth0 manualy after boot ( # /etc/init.d/net.eth0 start ) but fails to do so during boot when net.eth0 is added to the dafult runlevel with an error message saying: eerror "Failed to set MAC address" After that net.eth0 is not started and system continous to start with no network configured. Reproducible: Always Steps to Reproduce: 1. having ~x86 system, using new style network configuration 2. emerge net-analyzer/macchanger 3. add mac_eth0="00:0c:76:1b:2c:5e" to the /etc/conf.d/net to have the MAC of the NIC changed when eth0 is brought up 4. reboot Actual Results: macchanger fails to set the specified MAC when entering the default runlevel with massege saying: eerror "Failed to set MAC address" and eth0 is not started Expected Results: macchanger should change the MAC to the specified value and eth0 should be set up. (via dhcp) This happends only at boot when entering default runlevel. When starting the script manually after the system is up and running, eth0 is started as it should with the specified MAC. Don't know if this is relevant, but I have nforce2 400 ultra chipset, using the forcedeth NIC driver, kernel gentoo-dev-sources 2.6.9-r3
post emerge info. Which baselayout version are you using? latest ~x86 to date (=baselayout-1.11.6-r1) ? Did it occur before (old style net config)?
I believe the problem is that at boot time eth0 is not present. make this change in your /lib/rcscripts/net.modules.d/macchanger: line 80: instead of: eerror "Failed to set MAC address" put: eerror "Failed to set MAC address : ${e}" if, on boot it will output "set device name: No such device" then this is as I suspected.
Yes, I am using baselayout-1.11.6-r1 I can't tell yopu if this problem was here with the old style net configuration, 'cos I only last friday bought new motherboard and now I need changing MAC of the new NIC on the new mobo to the MAC of the old one to get my box online. I did not use it before. Changing the line 80 in /lib/rcscripts/net.modules.d/macchanger did Change the error message to the following: Failed to set MAC adress: ERROR: Can't change MAC: interface up or no permission: Device or resource busy My emerge info: Portage 2.0.51-r3 (gcc34-x86-2004.2, gcc-3.4.3, glibc-2.3.4.20041102-r0, 2.6.9-gentoo-r3 i686) ================================================================= System uname: 2.6.9-gentoo-r3 i686 AMD Athlon(tm) Gentoo Base System version 1.6.6 distcc 2.18.2 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] ccache version 2.3 [enabled] Autoconf: sys-devel/autoconf-2.59-r5 Automake: sys-devel/automake-1.8.5-r1 Binutils: sys-devel/binutils-2.15.92.0.2-r1 Headers: sys-kernel/linux26-headers-2.6.8.1-r1 Libtools: sys-devel/libtool-1.5.2-r7 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distlocks sandbox" GENTOO_MIRRORS="http://gentoo.ynet.sk/pub " MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://mirror.gentoo.sk/gentoo-portage" USE="3dnow 3dnowex GAPING_SECURITY_HOLE X Xaw3d aac aalib accessibility acl acpi adns aim alsa amd ansi ared aredmem artworkextra athena atlas audiofile avi bcmath bdf berkdb bidi bigger-fonts bitmap-fonts blas blender-game bluetooth bmp bonobo bzlib c cairo canna cap caps cddb cdf cdinstall cdparanoia cdr cgi chroot cjk clamav codecs cpdflib cross crypt cscope ctype cups curl dbase dedicated dga dhcp dio directfb divx4linux djbfft dmx dnd dts dv dvd dvdr dvdread editor emacs emacs-w3 emoticon encode erandom escreen esd etwin evo examples exif f77 faac faad fam fastcgi fbcon fbdev fdftk ffmpeg fftw fla flac flatfile flood font-server foomaticdb fortran freetype freewnn frxp fs ftp gatos gcj gd gdbm ggi gif gimp gimpprint ginac gkrellm glut gmp gnokii gnuplot gnustep gnutls gphoto2 gpm graphviz gs gstreamer gtk gtk2 guile hdf icon iconv icq image imagekits imagemagick imlib immqt-bc inifile intl iodbc ipv6 irda irmc ithreads jabber jack java javascript jbig jikes joystick jpeg jpeg2k kerberos krb4 ladcca lcms ldap leim libg++ libgda libwww live lm_sensors lucid lzo lzw lzw-tiff mad maps matroska matrox mcal md5sum memlimit messages mha mikmod mime ming mmx mmx2 mng motif mozilla mp3 mpeg mpeg4 mpi mplayer msession msn mule music mythtv nas ncurses net netcdf nethack network nis nls nocd nptl nvidia objc oggvorbis openal opengl opens oscar oss pam pcntl pcre pda pdf pdfkit pdflib perl pic pie plotutils png portaudio posix povray ppds print pthreads python qdbm qt quicktime radeon readline real recode ruby samba sdl session sftplogging simplexml slang slp sms sndfile snmp sockets socks5 sounds speedo speex spell sse sse2 ssl svg svga szip tcltk tcpd tga theora tidy tiff truetype type1 unicode usb v4l v4l2 videos wddx wmf wxwindows x86 xanim xchatdccserver xemacs xface xfs xine xml xml2 xmlrpc xmms xosd xpm xprint xscreensaver xsl xv xvid xvmc yahoo zlib"
basesys: any of you guys know what could cause a "Device or resource busy" at boot time but not afterwards?
Ah - the interface isn't up when attempting to change MAC address Try adding the below line at line 80 ish - may be different in your version - it needs to go right after the "esac" line interface_up ${iface}
If I understood you correctly, than this did not help, after changing this: ... esac e=$( /sbin/macchanger ${opts} ${iface} 2>&1 1>/dev/null || echo failed ) ... to this: ... esac # interface_up ${iface} e=$( /sbin/macchanger ${opts} ${iface} 2>&1 1>/dev/null || echo failed ) ... The problem was not solved, and also I was not able to start net.eth0 manually, as this resulted the same error as during boot ...
Ooops, the line was not commented ...I commented that out after it did not help and forget about that comment when cpopying and pasting ...
OK, I found a solution. The problem was not that the interface wasnt up ('cos it was) but that it was up ... instead of adding interface_up ${iface} I added interface_down ${iface} and it worked, macchanger (and also ifconfig) are not able to change the MAC adress if the interface is allreday up and they give you: ERROR: Can't change MAC: interface up or no permission: Device or resource busy This solution is pretty dirty, now it would be good to find out, why is the interface up, before changing MAC and fix it.
How are you loading your kernel module for the driver? If it's aliased as "eth0 forcedeth", then remove it and add "forcedeth" to /etc/modules.autoload.d/kernel-2.6
I have only forcedeth in /etc/modules.autoload/kernel-2.6 maybe coldplug is somehow influencig how the driver is loaded. I really would like to now, why the NIC is up while booting before, and then it is not when the system is up and running (if I remove net.eth0 from default runlevel offcourse)
Does it work if you don't use coldplug?
Nope, disabling coldplug & hotplug did not chnge a thing. Starting net.eth0 at boot fails with the non hacked /lib/rcscripts/net.modules.d/macchanger file. I think the problem will be somewhere in the one of those scripts bringing eth0 up sooner than they should.
Or maybe some forcedeth driver issue ... My knowledge of programing and software development is very limited, do you have an idea ?
I have since discovered that some interfaces need to be UP and others DOWN for macchanger to work Fixed in CVS - will be in baselayout-1.11.8
baselayout-1.11.8 is out
Well, the solution with the if's is great, and seems to be working (solving the iface up and down problem), but the script once again does not work for me. I found this strange thingy, with the opts variable ( I added the "; opts_is: ${opts}" to one of the printed outputs in /lib/rcscripts/net.modules.d/macchanger ): ebegin "Changing MAC address of ${iface}; opts_is: ${opts}" mac=$( /sbin/macchanger ${opts} ${iface} 2>/dev/null | awk '/Faked MAC:/ { print toupper($3) }' ) And I got this: vanzoo w4tch0 # /etc/init.d/net.eth0 start * Starting eth0 * Changing MAC address of eth0; opts_is: start stop restart --mac=00:0c:76:1b:2c:5e ... * Failed to set MAC address This is present also at boot, and also when running it manualy .... I think those "start stop restart" words should not be present there :D (they where not in the 1.11.7-r2 baselayout version). Well, the old problem with the up & down iface seems to be solved, so now I am confused. Should I submit a new bug or reopen this one ?
Also doing: ebegin "Changing MAC address of ${iface}; opts_is: ${opts}" opts="--mac=${mac}" mac=$( /sbin/macchanger ${opts} ${iface} 2>/dev/null | awk '/Faked MAC:/ { print toupper($3) }' ) Does: vanzoo w4tch0 # /etc/init.d/net.eth0 start * Starting eth0 * Changing MAC address of eth0; opts_is: start stop restart --mac=00:0c:76:1b:2c:5e ... [ ok ] * changed to 00:0C:76:1B:2C:5E * Bringing up eth0 * Configuration not set for eth0 - assuming dhcp * dhcp * Running dhcpcd ... [ ok ] * eth0 received address 147.175.171.182 Hmm, now I also noticed those "..." at the end of the original opts, those should not be there 2.
*** Bug 92802 has been marked as a duplicate of this bug. ***
The extra dots are caused by your use of the "ebegin" command. baselayout-1.11.12 is now out, re-open if this bug still applies