[systemd-devel] using /dev/root in fstab

microcai microcai at fedoraproject.org
Mon Jul 7 04:53:55 PDT 2014


在 2014年7月7日 星期一 11:14:40,Samuli Suominen 写道:
> On 07/07/14 07:29, microcai wrote:
> >  a long ago, /dev/root is an symblic to real root device. no matter it is
> >  on
> > 
> > NFS or HDD, we can use
> > 
> > /dev/root / auto defaults     0 0
> > 
> > in fstab to mount / as readwrite.
> > 
> > recently, I recall this old feature, and tryed to use it, but the system
> > failed to boot, waiting for /dev/root that never come up.
> > 
> > how to bring back the good old feature that re-use the root device
> > assigned on kernel command line ?
> 
> (This is ugly, I know.)
> 
> We restore the /dev/root symlink in Gentoo same way Debian is restoring
> it on non-systemd
> systems that still use sysvinit using a "workaround" like,
> 
> #!/bin/sh -e
> #
> # dev-root-link.sh: create /dev/root symlink
> #
> # Distributed under the terms of the GNU General Public License v2
> #
> # This is here because some software expects /dev/root to exist.
> # For more information, see this bug:
> # https://bugs.gentoo.org/show_bug.cgi?id=438380
> 
> RULESDIR=/run/udev/rules.d
> 
> [ -d $RULESDIR ] || mkdir -p $RULESDIR
> 
> eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/
> 
> || true)
> 
> [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || exit 0
> 
> # btrfs filesystems have bogus major/minor numbers
> [ "$ROOT_MAJOR" != 0 ] || exit 0
> 
> echo 'ACTION=="add|change", SUBSYSTEM=="block",
> ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'",
> SYMLINK+="root"' > $RULESDIR/61-dev-root-link.rules
> 

that hack is bloody urgly, I hate to use that stupid hack.

I am not talk about bring back /dev/root, but just a way of refereing 
"whatever root device specified on kernel commandline" in fstab or in -.mount 
unit.

deserize root filesystem and configure the bootloader, and installation 
complete. Hate to change target fstab again.

also, I think it's rather stupid to specify root device twice, once in boot 
loader, once in fstab. keeping them sync is a burden.



More information about the systemd-devel mailing list