LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Server Inaccessible Because of Duplicate /etc/sysconfig/network-scripts/ifcfg-eth0 (https://www.linuxquestions.org/questions/linux-newbie-8/server-inaccessible-because-of-duplicate-etc-sysconfig-network-scripts-ifcfg-eth0-875490/)

JRomeo 04-17-2011 02:22 PM

Server Inaccessible Because of Duplicate /etc/sysconfig/network-scripts/ifcfg-eth0
 
I learned a hard lesson today about Linux.

I'm nearly at the end of creating a shell script that automates changing network settings by prompting the user for desired settings, then applying them.

In the course of my development, I created temporary copies of /etc/sysconfig/network-scripts/ifcfg-eth0 (/etc/sysconfig/network-scripts/ifcfg-eth0_tmp1, for example) so as to not alter the original file. Little did I know that on boot the system would attempt to load each of these kinds of files and associate it with an ethernet connection, in this case eth0.

So..... now there are multiple copies in the /etc/sysconfig/network-scripts diretory that essentially have the same settings. They are..

/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth0_tmp1
/etc/sysconfig/network-scripts/ifcfg-eth0_tmp2

Now when the system boots, it attempts to load them all. The boot doesn't appear to complete, and I can't ping, login, or otherwise access the system through convention routes (putty, etc.).

The easy solution would be to delete the tmp files and reboot. Now, how do I do that without being able to log in to the server. It's a VM by the way, if that makes a difference.

When you're done laughing at my act of newbie-ism, please offer any suggestions you may have that might help. Thanks very much.

Franciozzy 04-17-2011 02:24 PM

If it's a VPS, you probably have console access through your control panel.

It is usually a Java Applet, but you can also ssh into a particular IP address provided by your ISP and, upon using the correct username, get redirected to your machine as if you were logged in by the console.

Otherwise, submit a ticket to your ISP and ask them to move those _tmp files away.

JRomeo 04-17-2011 02:37 PM

Thanks very much for your reply. I am, however, the owner of this machine. It's on a VPN that I manage.

paulsm4 04-17-2011 02:47 PM

Yes, it's possible to lock yourself out of ANY system.

For a physical server, the solution is generally to hard-boot the system with an install CD (or Knoppix, or ERD Commander, or something similar).

For a VM, the solution should be the same: you should be able to hard-boot your VM from an .iso of your install CD, and recover from there.

With a VM, you might also be able to revert to an earlier snapshot.

JRomeo 04-17-2011 02:53 PM

Ok, crisis averted. The boot up has an option to enter interactive mode and select which processes to load, one by one. I disabled the extra ethernet file loads, and it went right through. I deleted the extra files. Lesson learned. Thanks everyone.

kitgerrits 04-18-2011 05:14 AM

I would suggest putting the temporary files in an alternate directory.
I keep them in ".." myself.

Franciozzy 04-18-2011 06:35 AM

Quote:

Originally Posted by JRomeo (Post 4327273)
Ok, crisis averted. The boot up has an option to enter interactive mode and select which processes to load, one by one. I disabled the extra ethernet file loads, and it went right through. I deleted the extra files. Lesson learned. Thanks everyone.

Yeah I guess there were a number of things you could have done. Depending on the virtualisation scheme you are using, you could also mount the disk of your VM on the host OS and fix the scripts. Well done!

vrao0304 04-18-2011 10:47 AM

Edit the temporary ifcfg-eth configuration files and add 'ONBOOT=NO'. After rebooting it doesn't load them.


All times are GMT -5. The time now is 06:25 AM.