Debian Bug report logs - #698451
qemubuilder mounts rootfs as read-only

version graph

Package: qemubuilder; Maintainer for qemubuilder is Junichi Uekawa <dancer@debian.org>; Source for qemubuilder is src:cowdancer.

Reported by: Steffen Vogel <post@steffenvogel.de>

Date: Fri, 18 Jan 2013 18:51:07 UTC

Severity: important

Tags: patch

Found in versions cowdancer/0.70, qemubuilder/0.73

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Junichi Uekawa <dancer@debian.org>:
Bug#698451; Package qemubuilder. (Fri, 18 Jan 2013 18:51:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steffen Vogel <post@steffenvogel.de>:
New Bug report received and forwarded. Copy sent to Junichi Uekawa <dancer@debian.org>. (Fri, 18 Jan 2013 18:51:09 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Steffen Vogel <post@steffenvogel.de>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: qemubuilder mounts rootfs as read-only
Date: Fri, 18 Jan 2013 19:46:55 +0100
Package: qemubuilder
Version: 0.70
Severity: important

Hey :-)

I'm trying to use qemubuilder to build my packages for the armel
architecture.

I'm using an official kernel (kernel-image-3.2.0-4-versatile) from the archives.

The initrd has been created in a chroot with qemu-arm-static as
described here:
http://lists.debian.org/debian-mentors/2012/03/msg00276.html

Maybe this should be added the the wiki. Most of the other kernels and
descriptions I've found in the internet are unusable..

Creating the base image was easy with: qemubuilder --create

When using the base image I faced a problem:
qemubuilder mount the rootfs as read-only:

$ sudo qemubuilder --update --configfile pbuilderrc

  [...]

forking qemu: qemu-system-arm -nodefaults -nographic -M versatilepb -m 1024 -kernel
 /home/stv0g/pbuilder/armel/vmlinuz-3.2.0-4-versatile
 -initrd initrd.img-3.2.0-4-versatile -drive
 file=/home/stv0g/pbuilder/armel/build/qemu.7431.cowdev,index=0,media=disk,cache=writeback
 -drive file=/home/stv0g/pbuilder/armel/build/qemu.7431.dev,index=1,media=disk,cache=writeback
 -append root=/dev/sda quiet init=/pbuilder-run console=ttyAMA0,115200n8 -serial stdio
 -net user -net nic 

Uncompressing Linux... done, booting the kernel.
Loading, please wait...

-> qemu-pbuilder first-stage
mount: proc already mounted
mount: can't find / in /etc/fstab or /etc/mtab
cp: cannot create regular file `/etc/mtab': Read-only file system

-> qemu-pbuilder second-stage
-> setting time to Fri Jan 18 18:07:23 2013

  [...]

The /pbuilder-run script reports in line 6:
$ mount -n -o rw,remount /
mount: can't find / in /etc/fstab or /etc/mtab

So the files /etc/fstab and /etc/mtab are still not existant at this
stage of booting...
I suggest creating a symlink before trying to remount the rootfs:
$ ln -s /proc/mounts /etc/mtab

Regards,

Steffen

-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.6.9-custom-rt21 (SMP w/8 CPU cores; PREEMPT)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages qemubuilder depends on:
ii  debootstrap     1.0.44
ii  libc6           2.13-37
ii  pbuilder        0.213
ii  qemu-kvm [kvm]  1.1.2+dfsg-3
ii  qemu-system     1.1.2+dfsg-3

qemubuilder recommends no packages.

qemubuilder suggests no packages.

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Junichi Uekawa <dancer@debian.org>:
Bug#698451; Package qemubuilder. (Wed, 04 Sep 2013 13:21:09 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Smirnov <onlyjob@debian.org>:
Extra info received and forwarded to list. Copy sent to Junichi Uekawa <dancer@debian.org>. (Wed, 04 Sep 2013 13:21:09 GMT) Full text and rfc822 format available.

Message #10 received at 698451@bugs.debian.org (full text, mbox):

From: Dmitry Smirnov <onlyjob@debian.org>
To: 698451@bugs.debian.org
Subject: Re: Bug:#698451: qemubuilder mounts rootfs as read-only
Date: Wed, 4 Sep 2013 23:16:44 +1000
Control: tags -1 patch

At least on "mipsel" Steffen's workaround doesn't work because rootfs
is already read-only which makes it impossible to create symlink
`/etc/mtab` before remounting root as read-write.

Here is what I do to fix remount:

    sudo qemubuilder --config /var/cache/pbuilder/qemubuilderrc-mipsel --login --save-after-login
    mount -v -n -o rw,remount /dev/root /
    perl -pi -E 's{mount -n -o rw,remount /}{mount -v -n -o rw,remount /dev/root /}' /pbuilder-run
    exit

To fix it permanently the following patch could be applied:

####################
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -673,9 +673,9 @@
          "echo \n"
          "echo ' -> qemu-pbuilder first-stage' \n"
          "export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\n"
          "mount -n /proc /proc -t proc\n"
-         "mount -n -o rw,remount /\n"
+         "mount -v -n -o rw,remount /dev/root /\n"
          "cp /proc/mounts /etc/mtab\n"
          "export PBUILDER_MOUNTPOINT=/var/cache/pbuilder/pbuilder-mnt\n"
          "mkdir -p $PBUILDER_MOUNTPOINT\n"
          "mount -n -t ext3 /dev/%sb $PBUILDER_MOUNTPOINT \n"
####################

Because I checked this only for "mipsel" the alternative super-safe
patch could be applied to use new remount command as fallback only
when old style remount didn't work:

####################
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -673,9 +673,9 @@
          "echo \n"
          "echo ' -> qemu-pbuilder first-stage' \n"
          "export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\n"
          "mount -n /proc /proc -t proc\n"
-         "mount -n -o rw,remount /\n"
+         "mount -n -o rw,remount / || mount -v -n -o rw,remount /dev/root /\n"
          "cp /proc/mounts /etc/mtab\n"
          "export PBUILDER_MOUNTPOINT=/var/cache/pbuilder/pbuilder-mnt\n"
          "mkdir -p $PBUILDER_MOUNTPOINT\n"
          "mount -n -t ext3 /dev/%sb $PBUILDER_MOUNTPOINT \n"
####################

-- 
Cheers,
 Dmitry Smirnov
 GPG key : 4096R/53968D1B



Added tag(s) patch. Request was from Dmitry Smirnov <onlyjob@debian.org> to 698451-submit@bugs.debian.org. (Wed, 04 Sep 2013 13:21:09 GMT) Full text and rfc822 format available.

Marked as found in versions qemubuilder/0.73. Request was from Dmitry Smirnov <onlyjob@debian.org> to control@bugs.debian.org. (Wed, 04 Sep 2013 13:24:04 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Junichi Uekawa <dancer@debian.org>:
Bug#698451; Package qemubuilder. (Fri, 18 Oct 2013 21:03:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thorsten Alteholz <debian@alteholz.de>:
Extra info received and forwarded to list. Copy sent to Junichi Uekawa <dancer@debian.org>. (Fri, 18 Oct 2013 21:03:05 GMT) Full text and rfc822 format available.

Message #19 received at 698451@bugs.debian.org (full text, mbox):

From: Thorsten Alteholz <debian@alteholz.de>
To: 698451@bugs.debian.org
Cc: Dmitry Smirnov <onlyjob@debian.org>
Subject: Re: Bug:#698451: qemubuilder mounts rootfs as read-only
Date: Fri, 18 Oct 2013 22:45:26 +0200 (CEST)
Hi Dmitry,

are you sure that your super safe version of the patch really works?

I applied it here and still got the "Read-only file system"-error.

  Thorsten




Information forwarded to debian-bugs-dist@lists.debian.org, Junichi Uekawa <dancer@debian.org>:
Bug#698451; Package qemubuilder. (Sat, 19 Oct 2013 20:30:23 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Smirnov <onlyjob@debian.org>:
Extra info received and forwarded to list. Copy sent to Junichi Uekawa <dancer@debian.org>. (Sat, 19 Oct 2013 20:30:23 GMT) Full text and rfc822 format available.

Message #24 received at 698451@bugs.debian.org (full text, mbox):

From: Dmitry Smirnov <onlyjob@debian.org>
To: Thorsten Alteholz <debian@alteholz.de>
Cc: 698451@bugs.debian.org
Subject: Re: Bug:#698451: qemubuilder mounts rootfs as read-only
Date: Sun, 20 Oct 2013 07:21:07 +1100
On Sat, 19 Oct 2013 07:45:26 Thorsten Alteholz wrote:
> are you sure that your super safe version of the patch really works?
> 
> I applied it here and still got the "Read-only file system"-error.

Yes, it work for me on 'mipsel'. Remember that patch will only fix new
images (i.g. '--create'). You will get read-only root if image (i.e.
'pbuilder-run') was created by unpatched qemubuilder. In this case try
to '--login' and fix problem manually as described in message#10:

    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698451#10

I hope this helps.

--
All the best,
 Dmitry.



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 16:25:00 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.