From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 18 02:12:54 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8A09B37B401; Fri, 18 Jul 2003 02:12:54 -0700 (PDT) Received: from burka.carrier.kiev.ua (burka.carrier.kiev.ua [193.193.193.107]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7819043FB1; Fri, 18 Jul 2003 02:12:52 -0700 (PDT) (envelope-from netch@lucky.net) Received: from netch@localhost [127.0.0.1] (netch@localhost [127.0.0.1]) by burka.carrier.kiev.ua with ESMTP id h6I9Cm6K054057; Fri, 18 Jul 2003 12:12:49 +0300 (EEST) (envelope-from netch@burka.carrier.kiev.ua) Received: (from netch@localhost) by burka.carrier.kiev.ua (8.12.8p1/8.12.8/Submit) id h6I9Cm2F054054; Fri, 18 Jul 2003 12:12:48 +0300 (EEST) (envelope-from netch) Date: Fri, 18 Jul 2003 12:12:48 +0300 From: Valentin Nechayev To: hackers@freebsd.org Message-ID: <20030718091248.GO76126@lucky.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-42: On X-Verify-Sender: verified Subject: complicated downgrade X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: netch@lucky.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2003 09:12:54 -0000 (Cc'ed to phk@ as to main GEOM and DEVFS developer; see corresponding questions below.) Hi, I need to downgrade a remote FreeBSD system from 5.1-release to 4.8-release remotely without any local help (except possible hitting Reset). Don't ask why the collocation provider is too ugly and too far from me; it's given and unchangeable. This system never was 4.* (began from 5.0-DP2). I suppose the following algorith to have chance to succeed. If anybody can check it and fix, please help. 1. Download 4.8-release and untar it to the separate tree in file system. 2. Remove all unneeded for this system (including modules, fore_dlnd, mount_portalfs and other unused programs) from directories placed on root fs; this is due to its small size (~64M). 3. Place directories for 4.8 as /bin4, /sbin4, /etc4, /boot4, /usr/lib4, etc. 4. Place kernel for this system as /kernel; add /kernel.GENERIC also. 5. Run MAKEDEV in /dev4 for all standard entries and entries for specific disks (/dev/ar0s1a, etc.) 6. Add minimal site-specific contents to /etc4, enough to boot and run sshd to allow admin to enter. It includes master.passwd (with admin entry), /etc/ssh/* (copied keys and configs), /etc/resolv.conf, /etc/rc.conf, /etc/fstab, /etc/group (allowing su); what else? 7. (The most horrible step.) Goal is to have /dev on disk (not DEVFS!) appropriate for booting 4.8. Two alternatives are possible: 7a.1. Patch kernel to disable GEOM's protection against writing to devices which is mounted or have mounted subparts. (Here is most foggy place: I don't know how to do it in such way as to disable rereading of disk structure on this place.) 7a.2. Reboot with patched kernel. 7a.3. Use a binary editor and renames root directory entries directly: /dev4 to /dev, /dev to /dev5. (If entry name length matters, use, e.g., de4 instead of dev4.) 7a.4. Immediately reboot as to prevent namei subsystem damage. Result of all this is that devfs is mounted not over empty directory (or only with standard entries, without local specific disks), but over full working one. Alternative variant for step 7: 7b. add code to /sbin/init before mounting devfs: remount root to rw, copy entries to it (/bin/cp -Rp). It will work if mount() allows remounting to rw without correct /dev entry (this may have problems, as I saw on 4.8). Reboot to run this code from init. 8. Disable all processes except sshd and run the following (saying generally): for D in /bin /sbin /etc /boot /usr/bin /usr/sbin /usr/lib /usr/libexec \ /usr/libdata /usr/share /usr/local /var/db do mv ${D} ${D}5 mv ${D}4 {D} done 9. Reboot and hope 4.8 will load and run. I attached some local outputs to check for unexpectedness. -netch- root# less /var/run/dmesg.boot Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.1-RELEASE #1: Wed Jun 25 05:02:36 CDT 2003 root@***.com:/usr/src/sys/i386/compile/TITAN Preloaded elf kernel "/boot/kernel/kernel" at 0xc0438000. Preloaded elf module "/boot/kernel/acpi.ko" at 0xc04380a8. Timecounter "i8254" frequency 1193182 Hz CPU: AMD Duron(TM) MP Processor (1814.84-MHz 686-class CPU) Origin = "AuthenticAMD" Id = 0x680 Stepping = 0 Features=0x383fbff AMD Features=0xc0480000 real memory = 1073659904 (1023 MB) avail memory = 1038475264 (990 MB) Programming 24 pins in IOAPIC #0 IOAPIC #0 intpin 2 -> irq 0 FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs cpu0 (BSP): apic id: 0, version: 0x00040010, at 0xfee00000 cpu1 (AP): apic id: 1, version: 0x00040010, at 0xfee00000 io0 (APIC): apic id: 2, version: 0x00170011, at 0xfec00000 Pentium Pro MTRR support enabled npx0: on motherboard npx0: INT 16 interface acpi0: Other PM system enabled. pcibios: BIOS version 2.10 Using $PIR table, 9 entries at 0xc00f2350 apm0: on motherboard apm0: found APM BIOS v1.2, connected at v1.2 pcib0: at pcibus 0 on motherboard pci0: on pcib0 IOAPIC #0 intpin 17 -> irq 2 agp0: port 0xe800-0xe803 mem 0xfb800000-0xfb800fff, 0xfc000000-0xfdffffff at device 0.0 on pci0 pcib1: at device 1.0 on pci0 pci1: on pcib1 IOAPIC #0 intpin 16 -> irq 5 pci1: at device 5.0 (no driver attached) isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port 0xd800-0xd80f at device 7.1 on pci0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 pci0: at device 7.3 (no driver attached) atapci1: port 0xb000-0xb00f,0xb400-0xb403, 0xb800-0xb807,0xd000-0xd003,0xd400-0xd407 mem 0xed800000-0xed80ffff irq 2 at dev ice 9.0 on pci0 ata2: at 0xd400 on atapci1 ata3: at 0xb800 on atapci1 pcib2: at device 16.0 on pci0 pci2: on pcib2 IOAPIC #0 intpin 19 -> irq 10 IOAPIC #0 intpin 18 -> irq 11 pci2: at device 0.0 (no driver attached) pci2: at device 4.0 (no driver attached) xl0: <3Com 3c905C-TX Fast Etherlink XL> port 0xa400-0xa47f mem 0xec800000-0xec80 007f irq 11 at device 5.0 on pci2 xl0: Ethernet address: 00:e0:18:99:db:5b miibus0: on xl0 ukphy0: on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto orm0: