Welcome! Log In Create A New Profile

Advanced

Initramfs mounting rootfs issue [RESOLVED]

Posted by bodhi 
Initramfs mounting rootfs issue [RESOLVED]
May 03, 2015 04:53PM
This is a minor annoyance, but it bugs me nonetheless :) It seems the old rootfs mounting way is broken in the latest kernel.

Previously in 3.18.5, when we use rootfs label in the kernel parameter, the rootfs is mounted with the label. This was initramfs-tools (0.116).
/dev/disk/by-label/rootfs / ext3 rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered 0 0

Now in 4.0.0, the rootfs is mounted as a regular sdx device:
/dev/sda1 / ext3 rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered 0 0

The new initramfs-tools package (0.120) that was upgraded in the new kernel seems to have changed a bit, and it's better in many areas. However, this change in mounting-by-label behavior is undesirable.

Note that the command should be used for checking:
cat /proc/mounts


UPDATE:

I've contacted the initramfs-tools developer (Ben Hutchings). This was an intended change that was introduced in commit (by Roger Leigh):
http://anonscm.debian.org/cgit/kernel/initramfs-tools.git/commit/?id=be18fee1bd52f4616aa6107fad5a0457a18b3293

Description:

Quote

Canonicalise device names to match util-linux mount behaviour.
This ensures that "mount -a" in mountall does not try to mount
/usr a second time (which it will attempt if the mounted device
does not match the canonical device name). This also fixes a
longstanding annoyance with the output of mount and df using long
UUIDs rather than short device names.

Note that resolve_device may be called more than one; it's done
during options parsing for ROOT, and again immediately
prior to mounting. This is because during options parsing the
device node does not exist, but we still need to construct a
path into /dev from the LABEL or UUID.

So just be aware if you have scripts that rely on /dev/disk/by-label/rootfs being a mounted device then it will need to be revised to accomodate the new behaviour.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 3 time(s). Last edit at 05/07/2015 02:01AM by bodhi.
Re: Initramfs bug in mounting rootfs
May 03, 2015 06:20PM
Ive just baselined all mine to 3.18. So I can't comment on 4.0
Re: Initramfs bug in mounting rootfs
May 05, 2015 11:20PM
If anybody is interested in this, please post the output of:

uname -a
cat /proc/cmdline
cat /etc/fstab
mount
ls -l /dev/disk/by-label/
cat /proc/mounts
df -h

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 05/05/2015 11:36PM by bodhi.
Re: Initramfs bug in mounting rootfs
May 06, 2015 08:56PM
I've updated the 1st post. The issue is resolved.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Initramfs mounting rootfs issue [RESOLVED]
May 07, 2015 02:22PM
so does this mean we will be changing the variables in the uboot settings?
Re: Initramfs mounting rootfs issue [RESOLVED]
May 07, 2015 03:49PM
Gravelrash,

No need to change u-boot envs. It sill works the same way for booting. IOW, the rootfs label is still in effect during boot, the kernel will find it exactly the same way. However, initramfs-tools will execute an extra step in version 120. As the result of this, after the system has booted, if you want to look for an indication that it was used and mounted as such, you will not see that anymore.

initramffs-tools version 116 mount output:
/dev/disk/by-label/rootfs / ext3 rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered 0 0

Now in initramfs-tools 120, the rootfs is mounted as a regular sdx device, because it was "canonicalised" for mounting, i.e. translated into a node that looks like every other drives in the system. This was added in initramfs version later than 116.
/dev/sda1 / ext3 rw,noatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered 0 0

When I read the description for the commit, I realized that the reason for the change is good. The only thing we need to watch for is if you have a script that relies on the fact that /dev/disk/by-label/rootfs is the mounted device then the script will be broken. I do, so I've noticed :)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: