From owner-freebsd-questions Fri Sep 14 7:38:23 2001 Delivered-To: freebsd-questions@freebsd.org Received: from vmail.clickcom.com (vmail.clickcom.com [209.198.22.7]) by hub.freebsd.org (Postfix) with ESMTP id 8D07E37B40B for ; Fri, 14 Sep 2001 07:38:13 -0700 (PDT) Received: from fishbowl (dhcp-1.clt.clickcom.com [209.198.22.65]) by vmail.clickcom.com (8.11.1/8.11.1) with SMTP id f8EEc5e57909; Fri, 14 Sep 2001 10:38:06 -0400 (EDT) (envelope-from jks@clickcom.com) From: "John Straiton" To: Subject: How I screwed up my system (buildworld)and how I got it back. Date: Fri, 14 Sep 2001 10:36:39 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Since I wasn't really able to find any verbatim descriptions of using the fixit disk, nor easily find answers to a couple of problems that were preventing me from repairing my machine last night, I thought I'd send what I did to the list to help others: I was doing a 4.3-STABLE -> 4.4-RC upgrade of a machine, and was using the makebuildworld/installworld, make kernel KERNCONF= method. After completing the buildworld, kernel build, mergemaster and MAKEDEV all, I rebooted the machine to be greeted with: no such device 'da' setrootbyname failed ffs_mountroot: can't find rootvp Root mount failed: 6 Maunal root filesystem specifications: mountroot> Uhh, this looks bad. So I rebooted and tried boot -s. Useless as I had guessed. So I rebooted with kernel.old (by typing "unload kernel", then "load kernel.old", then "boot"). However what I had forgotten is that I had priorly done the installworld/kernel but never reboot. So by doing the procedure again, I had replaced my kernel.old with an equally useless kernel. Whooops! So I tried again with kernel.GENERIC, which booted as 4.0-STABLE. No such luck there either. What to do? Well I knew that I had a fixit floppy, and that it was intended for situations like this so I booted from the install cd, picked the fixit option and used the floppy. Upon getting to the Fixit# prompt, I tried to mount /dev/da0s1a /mnt The problem was that there is no /dev/da0s1a. So I tried Fixit#cd /dev;./MAKEDEV /da0s1a If memory serves, there was no MAKEDEV there. However, there was when I Fixit#cd /mnt2/dev;./MAKEDEV /da0s1a but the problem is that it would come back as rm: da0s1 Operation not Permitted(read only) Fixit# Erg. This is on the floppy which has been mounted read only, worse yet, it's completely full so we'd have to start deleting things to make room for a new device even if we re-mounted it. Unable to figure out a way to make MAKEDEV put it in /dev instead of /mnt2/dev, I finally found an article that described how to manually create the devices using mknod. The problem with this method is that I don't know how you arrive at the major:minor numbers without having a machine to look at. I will paste a few devices at the end of this email for those of you who don't have a few machines to look/compare with. However, since I did, I looked at another machine and did a ls -l /dev/da0s1a and got: crw-r----- 1 root operator 13, 0x00020000 Jun 29 2000 da0s1a So, going back to the floppy, I did: Fixit#cd /dev; mknod /dev/da0s1a c 13 0x00020000 which created the da0s1a that I needed. Now in some cases, when you look at another machine the 0x00020000 will actually be in base-10, so either get a pad and paper or use a calculator to translate it to hex. Now that I had the device, I could: Fixit#mkdir /mnt3;mount -w /dev/da0s1a /mnt3 and find my / partition of the hardrive now mounted to /mnt3. So I immediately: Fixit#fsck /dev/da0s1a to which it came back clean. Hrm. Well my next idea was to copy a kernel from another machine and try it out. Since kernels nowadays are 2MB+ and I don't know any practical way to gzip it and extract it later, I could either burn it to a CD and mount the CD-ROM drive, or in my case, I would just nfs_mount my other FreeBSD machine. So, ifconfig -a reported that the Fixit had found my network card. A simple: ifconfig (nic-device) (ip address) netmask (netmask) would fix my problem Fixit#ifconfig fxp0 10.0.0.2 netmask 255.255.255.0 and then I went to my other FreeBSD machine and added the file /etc/exports that contained this information: / 10.0.0.3 then I (on the good bsd box) #nfsd -u -t -n 4 #mountd -r Then I went to our broken machine and Fixit#nfsiod -n 4; mkdir /mnt4 Fixit#mount -v 10.0.0.3:/ /mnt4 Now I have my good-machine's / sitting on /mnt4. This is good except I couldn't seem to find chflags on my Fixit floppy, so I (on the good machine) #cp /usr/bin/chflags / Then I went to the bad machine and typed Fixit#/mnt4/chflags noschg /mnt3/kernel which made the kernel writeable. Now a simple Fixit#cp /mnt4/kernel /mnt3/ will copy our working kernel to the broken machine. Dont forget to go back later and clean chflags out of your / partition..it doesn't belong there. Now with all that done, I typed exit and rebooted. The machine worked and we're able to try that buildworld again. I hope this helps anyone with any kind of "Fixit" problem. I found it very hard to find any information on using the fixit other than how to get to the Fixit# prompt. (I think people forget that if you can use a FreeBSD machine running in multi-user that you won't necessarily know how to mount devices manually, or understand /dev very well.) John Straiton ClickCom, Inc. jks@clickcom.com Here are some common boot device nodes, from a FreeBSD-4.3 machine: crw-r----- 1 root operator 13, 0x00020000 Jun 29 2000 da0s1a crw-r----- 1 root operator 13, 0x00020001 Jun 29 2000 da0s1b crw-r----- 1 root operator 13, 0x00020002 Jun 29 2000 da0s1c crw-r----- 1 root operator 13, 0x00020003 Jun 29 2000 da0s1d crw-r----- 1 root operator 13, 0x00020004 Jun 29 2000 da0s1e crw-r----- 1 root operator 13, 0x00020005 Jun 29 2000 da0s1f crw-r----- 1 root operator 13, 0x00020006 Jun 29 2000 da0s1g crw-r----- 1 root operator 13, 0x00020007 Jun 29 2000 da0s1h crw-r----- 1 root operator 116, 0x00020000 Mar 16 2000 ad0s1a crw-r----- 1 root operator 116, 0x00020001 Mar 16 2000 ad0s1b crw-r----- 1 root operator 116, 0x00020002 Mar 16 2000 ad0s1c crw-r----- 1 root operator 116, 0x00020003 Mar 16 2000 ad0s1d crw-r----- 1 root operator 116, 0x00020004 Mar 16 2000 ad0s1e crw-r----- 1 root operator 116, 0x00020005 Mar 16 2000 ad0s1f crw-r----- 1 root operator 116, 0x00020006 Mar 16 2000 ad0s1g crw-r----- 1 root operator 116, 0x00020007 Mar 16 2000 ad0s1h crw-r----- 1 root operator 133, 0x00020000 Jun 9 2000 amrd0s1a crw-r----- 1 root operator 133, 0x00020001 Jun 9 2000 amrd0s1b crw-r----- 1 root operator 133, 0x00020002 Jun 9 2000 amrd0s1c crw-r----- 1 root operator 133, 0x00020003 Jun 9 2000 amrd0s1d crw-r----- 1 root operator 133, 0x00020004 Jun 9 2000 amrd0s1e crw-r----- 1 root operator 133, 0x00020005 Jun 9 2000 amrd0s1f crw-r----- 1 root operator 133, 0x00020006 Jun 9 2000 amrd0s1g crw-r----- 1 root operator 133, 0x00020007 Jun 9 2000 amrd0s1h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message