[Merge] lp:~mvo/ubuntu/wily/initramfs-tools-ubuntu-core/new into lp:ubuntu/initramfs-tools-ubuntu-core

Stéphane Graber stgraber at stgraber.org
Wed Sep 2 16:29:38 UTC 2015


One concern here is that your / is now effectively backed by a read-write filesystem which you can't unmount, so that may well lead to dataloss unless your shutdown sequence has extra logic to remount every layer read-only properly, killing any task with r/w fds open and only then shutdown.

If you can confirm that your shutdown sequence succeeds at remounting everything read-only prior to system shutdown, then except for the few things I listed in-line, this should be fine.

Diff comments:

> === modified file 'scripts/ubuntu-core-rootfs'
> --- scripts/ubuntu-core-rootfs	2015-08-24 13:54:01 +0000
> +++ scripts/ubuntu-core-rootfs	2015-09-02 16:06:20 +0000
> @@ -226,9 +176,60 @@
>  
>  	echo "$(date '+%s'): end" >> "$logfile" || true
>  
> -	echo "initrd: mounting $writable_label partition" >/dev/kmsg || true
> -	mount "$path" "$writable_mnt"
> +}
> +
> +#---------------------------------------------------------------------
> +# XXX: Entry point - called by the initramfs "/init" script.
> +#---------------------------------------------------------------------
> +mountroot()
> +{
> +	pre_mountroot
> +
> +	[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
> +	run_scripts /scripts/local-premount
> +	[ "$quiet" != "y" ] && log_end_msg
> +        
> +        # find what snappy-os version to use
> +        for x in $(cat /proc/cmdline); do
> +		case "${x}" in
> +		snappy_os=*)
> +			snappy_os="${x#*=}"
> +			;;
> +		snappy_kernel=*)
> +			snappy_kernel="${x#*=}"
> +			;;
> +		esac
> +	done
> +
> +        # always ensure writable is in a good state
> +        local writable_label="writable"
> +        local writable_mnt="/tmpmnt_${writable_label}"
> +	mkdir -p "$writable_mnt"
> +        fsck_writable "$writable_label" "$writable_label"
> +
> +        # mount writable rw
> +        path=$(get_partition_from_label "$writable_label")
> +        mount "$path" "$writable_mnt"
>  	mkdir -p "${rootmnt}/writable"

this doesn't seem useful when you're then bind-mounting something on top of rootmnt

> +
> +        # FIXME: hardcoded "ubuntu-core.sideload"
> +        mount -o bind "${writable_mnt}/system-data/os/ubuntu-core.sideload/${snappy_os}/" "$rootmnt"
> +        # workaround the fact that the kernel does not understand
> +        #  "-o bind,ro" directly
> +        mount -o bind,remount,ro "$rootmnt"
> +
> +        # now add a kernel bind mounts to it
> +        #   FIXME: "ubuntu-kernel.sideload"
> +        for d in modules firmware; do 
> +            mkdir -p  "$rootmnt/lib/$d"

isn't rootmnt read-only at that point?

> +            mount -o bind "${writable_mnt}/system-data/kernel/ubuntu-kernel.sideload/${snappy_kernel}/lib/$d" "$rootmnt/lib/$d"
> +        done
> +        
> +        # mount /run
> +	echo "initrd: mounting /run" >/dev/kmsg || true
> +	mount -o rw,nosuid,noexec,relatime,mode=755 -t tmpfs tmpfs "${rootmnt}/run"
> +
> +        # move /writable to its final destination
>  	mount --move "$writable_mnt" "${rootmnt}/writable"
>  
>  	# Prepare the fstab


-- 
https://code.launchpad.net/~mvo/ubuntu/wily/initramfs-tools-ubuntu-core/new/+merge/269945
Your team Ubuntu branches is requested to review the proposed merge of lp:~mvo/ubuntu/wily/initramfs-tools-ubuntu-core/new into lp:ubuntu/initramfs-tools-ubuntu-core.



More information about the Ubuntu-reviews mailing list