From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 2C9C61381F3 for ; Thu, 6 Dec 2012 14:24:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 830C921C053; Thu, 6 Dec 2012 14:24:05 +0000 (UTC) Received: from mta-1.ms.rz.rwth-aachen.de (mta-1.ms.rz.rwth-aachen.de [134.130.7.72]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E500121C02D for ; Thu, 6 Dec 2012 14:22:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-version: 1.0 Content-disposition: inline Content-type: text/plain; charset=UTF-8; DelSp=Yes; Format=Flowed Received: from mx-out-1.rwth-aachen.de ([134.130.5.186]) by mta-1.ms.rz.RWTH-Aachen.de (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008)) with ESMTP id <0MEM0092259Q7J20@mta-1.ms.rz.RWTH-Aachen.de> for gentoo-user@lists.gentoo.org; Thu, 06 Dec 2012 15:22:38 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.84,230,1355094000"; d="scan'208";a="202601153" Received: from relay-2.ms.rz.rwth-aachen.de (HELO relay.rwth-aachen.de) ([134.130.7.75]) by mx-1.rz.rwth-aachen.de with ESMTP; Thu, 06 Dec 2012 15:22:38 +0100 Received: from numa-i.igpm.rwth-aachen.de (numa-i.igpm.rwth-aachen.de [134.130.161.252]) by relay.rwth-aachen.de (8.14.4+Sun/8.13.8/1) with ESMTP id qB6EMcwT012321 for ; Thu, 06 Dec 2012 15:22:38 +0100 (CET) Received: from numa-i (localhost [127.0.0.1]) by numa-i.igpm.rwth-aachen.de (Postfix) with ESMTP id 722F222EC for ; Thu, 06 Dec 2012 15:22:39 +0100 (CET) Date: Thu, 06 Dec 2012 15:22:39 +0100 From: Helmut Jarausch Subject: [gentoo-user] hard disk name changes within initramfs To: gentoo-user@lists.gentoo.org X-Mailer: Balsa 2.4.91-2-g6b9dc83 Message-id: <1354803759.26624.0@numa-i> Content-transfer-encoding: quoted-printable X-Archives-Salt: 9c401537-2a34-42b6-bd1f-10864d5ec5dc X-Archives-Hash: 0870c593b18d0889e6b578740bc97923 Hi, on one of several machines I have a problem with initramfs. The machine has a single SATA drive. When the kernel boots it shows =20 that it is called /dev/sda,.... Now, within the init script of my initramfs it tries to mount /dev/sda2 =20 as root but fails. Since the initramfs spawns a shell (busybox) I can see the device files =20 for /dev/sda? but fdisk /dev/sda fails. As it turns out, the harddisk is now named /dev/sdb with /dev/sdb? =20 partition names. Since this setup is identical to that of several other machines where =20 it just works, I'm puzzled. Has anybody an idea what might be going on? Many thanks, Helmut. This is my init script #!/bin/busybox sh rescue_shell() { echo "$@" echo "Something went wrong. Dropping you to a shell." busybox --install -s exec /bin/sh }=E2=80=8B uuidlabel_root() { for cmd in $(cat /proc/cmdline) ; do case $cmd in root=3D*) type=3D$(echo $cmd | cut -d=3D -f2) echo "Mounting rootfs" if [ $type =3D=3D "LABEL" ] || [ $type =3D=3D "UUID" ] ; then uuid=3D$(echo $cmd | cut -d=3D -f3) mount -o ro $(findfs "$type"=3D"$uuid") /mnt/root else mount -o ro $(echo $cmd | cut -d=3D -f2) /mnt/root fi ;; esac done }=E2=80=8B check_filesystem() { # most of code coming from /etc/init.d/fsck local fsck_opts=3D check_extra=3D RC_UNAME=3D$(uname -s) # FIXME : get_bootparam forcefsck if [ -e /forcefsck ]; then fsck_opts=3D"$fsck_opts -f" check_extra=3D"(check forced)" fi echo "Checking local filesystem $check_extra : $1" if [ "$RC_UNAME" =3D Linux ]; then fsck_opts=3D"$fsck_opts -C0 -T" fi trap : INT QUIT # using our own fsck, not the builtin one from busybox /sbin/fsck ${fsck_args--p} $fsck_opts $1 case $? in 0) return 0;; 1) echo "Filesystem repaired"; return 0;; 2|3) if [ "$RC_UNAME" =3D Linux ]; then echo "Filesystem repaired, but reboot needed" reboot -f else rescue_shell "Filesystem still have errors; =20 manual fsck required" fi;; 4) if [ "$RC_UNAME" =3D Linux ]; then rescue_shell "Fileystem errors left =20 uncorrected, aborting" else echo "Filesystem repaired, but reboot needed" reboot fi;; 8) echo "Operational error"; return 0;; 12) echo "fsck interrupted";; *) echo "Filesystem couldn't be fixed";; esac rescue_shell }=E2=80=8B # temporarily mount proc and sys mount -t proc none /proc mount -t sysfs none /sys echo /sbin/mdev > /proc/sys/kernel/hotplug mdev -s # only do this if you've built devtmpfs support into your kernel # mount -t devtmpfs none /dev HJ: done by the kernel itself # disable kernel messages from popping onto the screen echo 0 > /proc/sys/kernel/printk # clear the screen # clear # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D start = doing stuff # mounting rootfs on /mnt/root uuidlabel_root || rescue_shell "Error with uuidlabel_root" btrfs device scan # space separated list of mountpoints that ... mountpoints=3D"/usr" # ... we want to find in /etc/fstab ... # ln -s /mnt/root/etc/fstab /etc/fstab # ... to check filesystems and mount our devices. for m in $mountpoints ; do check_filesystem $m echo "Mounting $m" # mount the device and ... mount $m || rescue_shell "Error while mounting $m" # ... move the tree to its final location mount --move $m "/mnt/root"$m || rescue_shell "Error while moving =20 $m" done echo "All done. Switching to real root." # =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D end do= ing stuff mount -o remount,rw /mnt/root cp /proc/mounts /mnt/root/mtab # clean up. The init process will remount proc sys and dev later umount /proc umount /sys # umount /dev # fails, since it's automounted by the kernel # switch to the real root and execute init exec switch_root /mnt/root /sbin/init "$@" =