CD-ROM saga (a funny story)After much delay, for what reason, I don’t know, I finally dropped into Quay Computers and bought a CD-ROM. Not a flash one, just an old 24x speed which had a 30 day warranty. A decent deal for NZ$95. I planned to install it that night, but something else came up.
When I got home later that day, I found that the FreeBSD box had rebooted. At first I thought ‘power cut’. Then I saw that NT1 was still running. And both used the same UPS. So it wasn’t a power problem. There was no reason for the reboot that I could see. So I decided to ignore it and press on with other things. Namely, the CD-ROM.
I switched off the firewall and installed the CD-ROM. When I switched on the machine, the screen filled with Ys. Lots of them. Continuously filling the screen. Line by line. I couldn’t figure it out. So I disconnected the drive from the IDE controller. The machine then ran OK. But I couldn’t connect from NT1 through the firewall to the Internet. And my DNS was stuffed. What was going on here!
I figured something really serious had gone wrong. Anything from someone hacking into my system and changing something to a power surge blowing some code on the hard drive. I spent 4 hours trying to get it running again. Finally, I sent a message to the FreeBSD Questions mailing list and headed off to bed. Very annoyed!
10 July 1998 – InspirationThe next day I figured it out during a lull at work (actually, I was staring out the window at the harbour wondering why I wasn’t out there riding my bike). Master. Slave. Can’t have two masters. DOH.
That night, I got it right. I swapped the little plug thing at the back of the CD-ROM and converted it from a master to a slave. You see, the IDE controller was already looking after the hard drive. Which is normally the master. And the machine booted.
The next step was mounting the drive. Which was a journey in own right.
Mounting the CD-ROM DriveI received one suggestion about making sure the network cards where both working. They were. So I gave up on the firewall problem and decided to install the CD-ROM.
The FreeBSD site was down and I couldn’t search for instructions on how to mount the drive. It’s not like Windows where the thing is just there. You actually have to issue commands in order to see the drive.
I rang up Jay, who had a guest, but helped anyway. We found out what device the drive was mapped to. By using the command dmesg, you can see the boot time messages. We found wcd0. He told me to try:
mount -t cd9660 /dev/wcd0 /cdrom
It didn’t work. We tried the MAKEDEV command on the device in order to make sure it’s there. It still didn’t work.
So I tried searching the web. Eventually I found
mount_cd9660 /dev/wcd0c /cdrom
And tried it. It works. I could read the CD-ROM. Yea!
Where’s my file system?After the CD-ROM was mounted and I proved to myself that I could read the contents, I unmounted the drive and rebooted. I placed the drive into the final resting place, dropping a few screws underneath the motherboard in the process. Getting them out was a real pain. I had to shake the box really hard to dislodge them.
I wired everything up, put it all back together again. And rebooted the machine.
Oh. What’s that message mean:
swapon: /dev/wd0s1b: No such file or directory
Automatic Reboot in progress
/dev/rwd0a: clean, 16327 free (183 frags, 2018 blocks, 0.6% fragmentation)
/dev/wd0s1f: No such file or directory
Can't stat /dev/we0s1f
BAD DISK NAME /dev/wd0s1f
/dev/wd0s1e: No such file or directory
can't stat /dev/wd0s1e
BAD DISK NAM /dev/wd0s1e
Automatic file system check failed... help!
Enter pathname of shell or RETURN for sh:
Well. I was annoyed. I couldn’t figure out why this was happening now.
Restoring my botched systemI bypassed the firewall and connected to EFnet IRC Network and into #freebsd. Here’s the chat session, just for a laugh. I’ve removed the extraneous stuff and changed other names to protect identity. JunkMale is my nickname, and xyz is the person that offered help.
<JunkMale> Ummm: I just installed a cd-rom, mounted it. did a umount. then rebooted. now I get this: swapon: /dev/wd0s1b: No such file or directory
<JunkMale> searching the website didnt find me a clue. Any ideas as to what to check/look for?
[21:45] <xyz> JunkMale: I’d say you did a lot more than that. 🙂
<JunkMale> reckon? 🙂
[21:45] <xyz> JunkMale: ‘fess up – before or after you mounted the CD, you did something *else*. What was that? 🙂
<JunkMale> ./MAKEDEV all
[21:46] <xyz> JunkMale: yep.
<JunkMale> I blame Jay. it’s all his fault.
[21:46] <xyz> JunkMale: you screwed the pooch, sir.
<JunkMale> oh. and I didn’t even enjoy it.
<JunkMale> so I should ring Jay and tell him it’s his fault?
[21:46] <xyz> JunkMale: doing `all’ rebuilds all the wd* and sd* targets, and those remove all the *slice* entries by default so that the disk entry list is nice and clean. 🙂
[21:47] <xyz> JunkMale: you’re only supposed to do all once.
<JunkMale> it’s all gone.
[21:47] <xyz> JunkMale: try this: cd /dev && ./MAKEDEV wd0s1a
[21:47] <xyz> JunkMale: if you’re lucky, you can get back. but don’t do that again! 🙂
<JunkMale> got a lot of file exists, and readonly file system. then "chgrp: not found"
<JunkMale> and yes, I won’t be doing that again!
[21:48] <xyz> JunkMale: oh. you’re in single user mode aren’t you? 😉
<JunkMale> i’ll reboot
[21:48] <xyz> JunkMale: no
[21:48] <xyz> JunkMale: won’t help
[21:49] <xyz> JunkMale: you need to go with a fixit floppy now
[21:49] <xyz> JunkMale: you don’t have your commands without /usr and you can’t have /usr with a cleaned /dev
<JunkMale> I think I have one here. jas. I’ll try that.
[21:50] <xyz> no, wait.
[21:50] <xyz> what am I saying.
[21:50] <xyz> there’s the compat slice
[21:50] <xyz> mount -u /
[21:50] <xyz> (make root read/write, as per the FAQ)
[21:50] <xyz> and now where was your /usr mounted?
<JunkMale> where are you getting this from?
<JunkMale> ummm, not sure. i dunno.
<JunkMale> i have only 1 drive.
[21:51] <xyz> JunkMale: section 8.2 of the FAQ. http://www.freebsd.org/FAQ
[21:52] <xyz> JunkMale: look in your fstab
<JunkMale> 8.2 for me is how to add a user
<JunkMale> fstab? (I admit I’ve only been using unix for three weeks)
<JunkMale> found /etc/fstab
[21:54] <xyz> JunkMale: no, it’s for dealing with a root password problem and ALSO tells you about single-user mode tricks like you just asked about. 🙂
[21:54] <xyz> JunkMale: this is Unix, you have to learn to take your tips wherever you find them because there aren’t that many. 🙂
[21:54] <xyz> JunkMale: right, now where’s /usr being mounted?
<JunkMale> sorry, but I don’t understand the question.
[21:55] <xyz> JunkMale: in your /etc/fstab. Which device. /dev/wd…something?
[21:55] <xyz> JunkMale: hint: it’s one of the files you blew away.
<JunkMale> yep. How can I view fstab?
[21:56] <xyz> JunkMale: cat
<JunkMale> found a line like this:
<JunkMale> .. /dev/wd0s1f /usr ufs rw 2 2
[21:57] <xyz> JunkMale: good, so now we know that the compat slice (which you should have) is /dev/wd0f
[21:57] <xyz> JunkMale: mount /dev/wd0f /usr
[21:58] <xyz> JunkMale: now do the MAKEDEV you previously did again. chgrp and stuff should work
[21:58] * xyz is fading out.
[21:59] <xyz> zzzz…
[21:59] <xyz> time for bed.
<JunkMale> don’t fade yet!
[21:59] <xyz> JunkMale: you are now resurrected. reboot.
<JunkMale> well, when I hit the USA in 1999, I owe you a crate of beer.
<JunkMale> and when/if you hit New Zealand, you got a place to stay and a tour guide.
[22:00] <XX> xyz: you can go to bed – I’ll take over if necessary
<JunkMale> looks much better.
[22:00] <xyz> JunkMale: 🙂
<JunkMale> thanks XX.
[22:00] <xyz> XX: Thanks. 🙂
[22:01] <XX> xyz: good night, sleep tight, don’t let the bedbugs bite.
[22:01] * xyz goes to bed.
<JunkMale> reboot works. Cheers xyz.
In short, what I did was:
mount -u /
cat fstab # found out where /usr is mapped
mount /dev/wd0f /usr
then I rebooted. And all was well. I had the system back and my CD-ROM worked.
7 August 1998I’ve just noticed that I haven’t actually indicated how to mount the cdrom. Here’s the command I use now:
mount -t cd9660 /dev/wcd0c /cdrom
To unmount the above:
/dev/wcd0c /cdrom cd9660 ro,noauto 0 0
With such a line, you can mount your cdrom with just the following command: