Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Removal of hostconfig file will prevent OS X booting System
After messing about trying to get SMB sharing to work with Windows XP, I had restarted SMB services several times (using a third-party Samba prefspane and config tool). I eventually rebooted the machine and got that awful feeling after seeing the #sh blah blah prompt scrawl itself over my Jaguar boot screen.

It turns out that Samba has a penchant for deleting and replacing the /etc/hostconfig file. Fortunately, I had found out this information beforehand following a similar incident last week after I'd spent two days trying to fix everything. This time, however, I had partitioned my drive and had an OS 9 disk to boot from. Using FileBuddy, I renamed /etc/hostconfig.old to /etc/hostconfig, and the computer booted into X fine.

It seems bizarre to me that the absence of this one file can cause OS X to totally fall on its face in this way. Now potentially this could happen when the system is interrupted doing anything which rewrites this file, I suppose. That might include changing any Network Settings or turning off and on any sharing options.

So just in case you do ever get that nasty prompt and the sinking heart feeling try to get onto your drive and see if the hostconfig file exists. It might just save you a bit of time.

[robg adds: This is a particularly nasty effect. I tested it on an iBook 500 (creating a backup of hostconfig first), and sure enough, delete hostconfig, and the system is unusable. You can't even boot into single user mode. Well, you can, but you can't do anything useful like replace the hostconfig file. I booted the iBook in FireWire target disk mode from my desktop Mac, restored the backed up hostconfig, and then rebooted the iBook. All was fine. I'm not sure how you'd recover a machine that lacked OS 9 or another machine to boot it with -- thoughts?]
    •    
  • Currently 1.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[13,886 views]  

Removal of hostconfig file will prevent OS X booting | 19 comments | Create New Account
Click here to return to the 'Removal of hostconfig file will prevent OS X booting' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Removal of hostconfig file will prevent OS X booting
Authored by: altglbrs on Feb 25, '03 10:40:50AM

boot off an old OS9 bootable CD and make your changes, unless of course you have a newer mac that can't boot 9...

I guess you could boot off a OS X bootable CD if you had one that gave you access to the Finder, Terminal or some other way of manipulating your files. I don't think the Jaguar install CDs give you any such options.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: leenoble_uk on Feb 25, '03 10:48:21AM

I tried that. I think you'll find it impossible without something like FileBuddy. I stand to be corrected but the /etc folder was invisible and there is no way in from the regular finder. FileBuddy could see through to the files but is unable to save a new file to that location, so you just better hope you have a spare hostconfig file in there already.

Other invisifile navigators must be available.



[ Reply to This | # ]
Use "Go to Folder..." [Shift-Command-G]
Authored by: firthy374 on Feb 25, '03 11:02:19AM
You can use the "Go to Finder..." menu selection (in the Go menu) to get to any directory (hidden or otherwise) you have permission to view. Type "/etc" (without the quotes) in the drop down dialog box. You can also use Tab completion and "~username" shortcuts.

[ Reply to This | # ]
Use "Go to Folder..." [Shift-Command-G]
Authored by: leenoble_uk on Feb 25, '03 11:14:29AM

Not from within OS9 you can't. Which is the problem.

Also, yes I understand that deleting files from the system will cause problems but this one is relatively easy to delete. Using just GUI software to configure SAMBA (admittedly 3rd party) deleted this file. It's not such a stretch of the imagination to see this file getting corrupted if say there was a power cut or you rip the plug out of the wall accidentally just as you're restarting file sharing in the System Preferences.

This is only intended as a heads up *should* you ever be greeted by the #sh prompt on the jaguar boot screen. Rather than opting for a full re-install you may be able to restore functionality by restoring this file. You may at least want to check it out first.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: charlietuna on Feb 25, '03 10:53:56AM

it wouldn't be right to call this a bug. the absense of the /etc/hostconfig file will cause problems just as removing any number of vital items from an OS 9 System Folder will cause problems.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: robg on Feb 25, '03 11:18:57AM

Sorry, wrong term ... I changed it to 'effect.' It still seems odd that you can't even get into a usable single user mode when the file is missing ... especially given that the file is nothing more than a list of services to start or not start. It's not like deleting a binary executable or anything; it's a text file.

I would also hope that, given the critical nature of this file, it would have an automatic backup of some sort that loads if the original is missing or damaged.

-rob.



[ Reply to This | # ]
How to fix without booting to anything!
Authored by: jk806 on Feb 25, '03 11:33:29AM

It IS possible to fix this without booting to OS 9, or otherwise fiddling with your hard drive from remote.

All you have to do is type this at the sh-2.05a# prompt:

sh-2.05a# mount -u -o rw /

Then you can copy the /etc/hostconfig~ file to /etc/hostconfig

sh-2.05a# cp /etc/hostconfig~ /etc/hostconfig
sh-2.05a# exit

and Viola! your system is back to booting normally.

[for the interested 'mount -u -o rw /' remounts your drive read-write so you can replace/edit the file that's causing the trouble. also, it appears that the utilities that manage the hostconfig file make a backup called hostconfig~. - I'm not sure if an empty file will do anything, but creating it empty might be worth a shot if you don't have anything else. Another option is to copy your existing hostconfig into /etc/defaults so you have it in an emergency. ]

-Cheers!

[ Reply to This | # ]
Correction - and update
Authored by: jk806 on Feb 25, '03 11:45:22AM

[Rob, please fix the typo in the above posting?!]

The mount command above should read:

sh-2.05a# mount -u -o rw /

Without the -o it doesn't work. typo on my part.

Also, I just checked and the file does NOT have to contain anything. Which means that all you have to do is issue the command:

sh-2.05a# touch /etc/hostconfig
sh-2.05a# exit

and things will be good to go!



[ Reply to This | # ]
How to fix without booting to anything!
Authored by: timzilla23 on Jun 03, '03 03:09:34AM

What a NIGHTMARE!!

I have this sh-2.05a# problem here tring to install Jaguar on my Blueberry iMac.

I've followed your instructions to the tee, but ony get 'command not found'

Any ideas?

Thanks in advance! I'm pulling my hair out!

Tim



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: BraindeadMac on Feb 25, '03 11:48:28AM

Samba does not delete or replace the /etc/hostconfig file. The SMBSERVER in the /etc/hostconfig flag may be changed by the Sharing preference panel. If you enabled samba via the sharing pref panel and your /etc/hostconfig file was lost, then you should definitely report this as a bug to Apple. If you edited /etc/hostconfig yourself, then you probably screwed something up or your editor had a bug.

/etc/hostconfig is called by a number of the boot shell scripts to read configuration parameters; those scripts (e.g., /etc/rc.common) expect hostconfig to exist and will not proceed without it. I suppose they could be made more robust so that they do not hang when /etc/hostconfig doesn't exist but this is unusual.

Repeat, Samba, does not, does not, alter /etc/hostconfig--don't start myths like this!

The /etc/hostconfig file can get munged; mine did so under 10.1, probably from file corruption, and made the machine very unstable.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: leenoble_uk on Feb 25, '03 12:05:23PM

Just to clarify...
It was identifiably SAMBA which removed the hostconfig file. As indicated it was not the default System Preference pane which caused the issue but the third party version with more sharing options which I'd had installed since 10.1. I can't find the exact distribution I was using but I believe it was at one stage connected to Xamba as found at Sourceforge. It consists of a PreferencePane called Samba Sharing and an application called Samba Sharing Config Tool. There are forum messages relating to this issue there.

I merely point out that this file *IS* written to by the system and that *POTENTIALLY* you *MIGHT* corrupt the file if power failed when you changed your settings. *SHOULD* you at any stage be greeted by the #sh prompt after a reboot you *MIGHT* want to see if your hostconfig file is missing, damaged or truncated.

Personally I wasn't aware you could do anything from that prompt and I'll be taking note of the above instructions. I just won't be storing them on my Mac. I'll keep a written copy somewhere.

[robg: you might just want to delete my submission and replace it with the above hint]



[ Reply to This | # ]
Hint's fine...
Authored by: robg on Feb 25, '03 12:10:49PM

I think the hint and related comments make a good archive and discussion, and I see no need to replace what you sent in. I did, however, add some emphasized text around the "third party" bit in the original hint...it seemed clear to me when I read it, but apparently it's not as clear as I thought it was!

-rob.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: BraindeadMac on Feb 25, '03 02:29:18PM

No, it was identifiably the 3rd party software, not samba, which hosed the /etc/hostconfig file. The samba software itself never reads the contents of /etc/hostconfig. Instead the value of SMBSERVER is parsed from /etc/hostconfig at boot by the startup script /System/Library/StartupItems/Samba/Samba. The point is that one shouldn't blame samba for this--let the developer of the 3rd party implementation know about it--but it's simply wrong to start blaming widely used, stable product (SAMBA) when it isn't the fault.



[ Reply to This | # ]
While we're on the samba topic...
Authored by: tcurtin on Feb 25, '03 02:37:05PM

Does anyone know if Apple fixed the finder-hang when servers (like samba, ftp, etc) suddenly disappear due to dropped or changed network connection? While I've put off upgrading to 10.2.4, this problem continues to ruin my day on a regular basis, and if 10.2.4 fixes it, that alone will make the download worth the time.



[ Reply to This | # ]
While we're on the samba topic...
Authored by: weird_ed on Feb 25, '03 05:21:19PM

This is still a problem in 10.2.4.



[ Reply to This | # ]
While we're on the samba topic...
Authored by: ihafro on Feb 26, '03 07:44:26PM

Yes and no. The Finder will hand, but after 2-3 minutes, it will time out and show you an error message. You just have to wait. Now, the question is, how do you change the timeout period to something more reasonable, like 45 seconds. Or better yet, don't tie up the Finder with just the reconnect task. DUH, it's a multi-threaded, multi-tasking OS.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: Chris Haynes on Feb 25, '03 12:57:54PM

I had this with the Samba Sharing Package. It hosed the hostconfig file :(

---
darkpaw



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: Gonzonia on Feb 25, '03 01:38:58PM

Well, it's a little late, but I figured out connecting to XP. The problem is on the XP side. You need to turn OFF simple file sharing. To do this, go to Tools-->Folder Options--View Tab, at the bottom, uncheck simple file sharing. Click apply to all folders.

Works like a charm now.



[ Reply to This | # ]
Removal of hostconfig file will prevent OS X booting
Authored by: Chris Haynes on Feb 25, '03 05:55:26PM
Yes, funny that it says "Simple File Sharing (RECOMMENDED)" when in actual fact, it stops the really useful stuff from working :rolleyes:

---
darkpaw

[ Reply to This | # ]