Bug 406711 - /dev to be mounted in tmpfs, not on snapshot NFS server
/dev to be mounted in tmpfs, not on snapshot NFS server
Product: Fedora
Classification: Fedora
Component: system-config-netboot (Show other bugs)
i386 Linux
low Severity low
: ---
: ---
Assigned To: Radek Brich
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-11-30 12:35 EST by Ondrej Valousek
Modified: 2008-04-16 23:48 EDT (History)
0 users

See Also:
Fixed In Version: 0.1.42-2.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-04-16 23:48:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch against disklessrc (1.56 KB, patch)
2007-12-21 06:35 EST, Ondrej Valousek
no flags Details | Diff

  None (edit)
Description Ondrej Valousek 2007-11-30 12:35:56 EST
Description of problem:
/dev partition should be mounted in tmpfs to speedup booting of the diskless
machines. With udev, the content of /dev does not need to be placed on the
premanent storage so tmpfs is just ideal here.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
Actual results:
/dev is mounted in the snapshot area on the NFS server

Expected results:
/dev should be mounted on tmpfs

Additional info:
Comment 1 Ondrej Valousek 2007-12-21 05:43:08 EST
Suggesting the following (grabbed from RHEL-5 initrd):

echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
Comment 2 Ondrej Valousek 2007-12-21 06:35:29 EST
Created attachment 290227 [details]
Patch against disklessrc

This patch makes a diskless workstation to mount /dev via tmpfs and thus speeds
up booting. Also solves other mystical problems.
Comment 3 Radek Brich 2008-01-08 05:12:43 EST
I tried this and there was lot of errors from SElinux unable to set context on

Also, I don't see /dev mounted on tmpfs when I list mounted devices in my
Fedora. Maybe those lines in initrd are just temporary stuff?

This will need further investigation.
Comment 4 Ondrej Valousek 2008-01-08 05:38:25 EST

I was also confused about the /dev in Fedora/RHEL:
[ondrejv@deneb ~/banka]$ cd /dev
[ondrejv@deneb /dev]$ df -m .
Filesystem           1M-blocks      Used Available Use% Mounted on
-                         3967         1      3967   1% /dev
which tells us nothing about the filesystem.
But in the standard initrd from RHEL-5 we can see:
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev

I understand it the way that /dev is mounted via tmpfs during the init boot
stage and the switchroot command switches the root filesystem while preserving
/dev as tmpfs.

The diskless setup should do the same (more or less). That's why the proposed patch.
Regarding the SELinux:
1. it is very strange as (as I said) /dev is commonly mounted via tmpfs
2. in the diskless setup must be the SELinux disabled anyway otherwise some
services like at and cron do not work well.

Comment 5 Radek Brich 2008-01-08 10:07:05 EST
Yes, you are right about /dev in Fedora/RHEL5. It can even be seen as tmpfs in
mounts, I was just looking in bad place, i.e. "mount" instead of "cat
/proc/mounts" :)

I adjusted few things and everything now work fine for me.
These changes were needed:

* remove /dev/ from diskless files
  (which caused many errors due to read-only /dev -> it was still mounted from
nfs, so switch_root does not seem to preserve /dec)

* add "mount --bind /mnt/dev /dev" to disklessrc right before exec

* also it seems better to create /dev as one of first things, right after
mounting /proc

Anyway, thanks for patch and suggestion, it is really faster now.
Comment 6 Ondrej Valousek 2008-01-08 10:41:37 EST
Hi Radek,

2 minor things:
- RHEL5 initrd uses switchroot whereas disklessrc uses pivot_root. That's
(probably) the answer to the /dev mountpoint persistence. Maybe we should use
switchroot as well? (I do not know)
- probably not all mknod's (see above in the patch) are actually necessary - I
just grabbed what I found in the rhel-5 initrd. 
- agree with the rest

Many thanks for your help.
Comment 7 Radek Brich 2008-03-25 10:40:14 EDT
This bug is now fixed (as described above) in rawhide and the fix is going to
RHEL5 as well. I'm now backporting this and few other fixes to F8 so the report
could be closed.

Regarding the pivot_root vs switchroot: s-c-netboot uses switchroot since the
initrd to initramfs transition, so this should not be a problem.
The mknod's seem ok and work fine, so I'm letting that all here.
Comment 8 Fedora Update System 2008-03-25 10:41:37 EDT
system-config-netboot-0.1.42-2.fc8 has been submitted as an update for Fedora 8
Comment 9 Fedora Update System 2008-03-26 13:18:19 EDT
system-config-netboot-0.1.42-2.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-netboot'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-2741
Comment 10 Ondrej Valousek 2008-04-07 06:25:24 EDT
Tried the both system-config-netboot-cmd-0.1.45 and
system-config-netboot-0.1.42-2 and I noticed one problem:
* Both packages now use /sbin/switch_root instead of the old pivot_root which is
only available in the newest busybox-anaconda. There is nothing wrong on it but
I am aiming to build (on RHEL-5 box) a diskless image of RHEL-4.
Busybox-anaconda for RHEL-4 does not contain switch_root :-(.

I thought system-config-netboot was supposed to be able to create a working
diskless image even from the old versions of RHEL (it still contains all the
patches for rc.sysinit and other init scripts which are now not relevant -
starting from RHEL-4 no significant changes need to be done to make diskless

So, for, me I would either propose:
* cleaning system-config-netboot from those irrelevant patches for older OSes
and state clearly that the package is supposed to make a diskless image only
from the same OS version it has been run from (+ maybe some trivial check of

or (for me better :-):

* Spend some minimal effort to make it working even with some older OSes. For
example, to make it working with RHEL-4, only 2 things are needed:
- do not complain if mount.nfs is missing (it is missing on RHEL-4)
- push some updated busybox-anaconda package into RHEL-4

Otherwise the package looks pretty good now.

Comment 11 Fedora Update System 2008-04-16 23:48:22 EDT
system-config-netboot-0.1.42-2.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.