VirtFS: Cannot mount 9p during boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I use as client Debian squeeze i386 with a custom kernel:
Linux (none) 2.6.35.5 #3 Thu Sep 23 18:36:02 UTC 2010 i686 GNU/Linux
And as host Debian squeeze amd64
Linux asd 2.6.32-5-amd64 #1 SMP Fri Sep 17 21:50:19 UTC 2010 x86_64 GNU/Linux
kvm version is:
kvm-88-
Started the client using:
sudo /usr/local/
I noticed that I cannot mount it (mapped or passthrough) using /etc/rc.local or /etc/fstab, but after login as root using
mount /mnt
or
mount -t 9p -o trans=virtio host /mnt
(the same stuff i tried inside /etc/rc.local)
The only output on a failed mount in rc.local/fstab I get is
[ 15.035920] device: '9p-1': device_add
[ 15.038180] 9p: no channels available
[ 15.038937] device: '9p-1': device_unregister
[ 15.049123] device: '9p-1': device_
The stuff in /etc/fstab is:
host /mnt 9p trans=virtio 0 0
I intercepted the boot by adding `set -v; set +e; mount -t 9p -o trans=virtio host_share /mnt; /bin/sh` on top of my /etc/rc.local:
... but than it works quite well... well that is not what I expected. So I changed it to `set -v; mount /mnt || true; /bin/sh`.. and then it doesn't work anymore... mysterios but hey, did you notice that the share is actually called host and not host_share as I wrote inside the rc.local. So why does it work at all? Let me change it to `set -v; set +e; mount -t 9p -o trans=virtio host /mnt; /bin/sh` and reboot again.
What should i say: it says:
[ 8.004754] device: '9p-1': device_add
[ 8.006446] 9p: no channels available
[ 8.007156] device: '9p-1': device_unregister
[ 8.008650] device: '9p-1': device_
mount: No such file or directory
But i have a shell now and can type the mount stuff inside it:
$ mount -v -t 9p -o trans=virtio host /mnt
mount -v -t 9p -o trans=virtio host /mnt
[ 70.982688] device: '9p-2': device_add
[ 70.986508] 9p: no channels available
[ 70.987969] device: '9p-2': device_unregister
[ 70.992937] device: '9p-2': device_
mount: No such file or directory
$ ls -l /sys/bus/
total 0
--w------- 1 root root 4096 Sep 26 12:58 bind
--w------- 1 root root 4096 Sep 26 12:58 uevent
--w------- 1 root root 4096 Sep 26 12:58 unbind
lrwxrwxrwx 1 root root 0 Sep 26 12:58 virtio1 -> ../../.
$ ls -l /sys/devices/
total 0
lrwxrwxrwx 1 root root 0 Sep 26 13:00 bus -> ../../../bus/virtio
-r--r--r-- 1 root root 4096 Sep 26 13:00 device
lrwxrwxrwx 1 root root 0 Sep 26 13:00 driver -> ../../.
-r--r--r-- 1 root root 4096 Sep 26 13:00 features
-r--r--r-- 1 root root 4096 Sep 26 13:00 modalias
-r--r--r-- 1 root root 4096 Sep 26 13:00 mount_tag
drwxr-xr-x 2 root root 0 Sep 26 12:58 power
-r--r--r-- 1 root root 4096 Sep 26 13:00 status
lrwxrwxrwx 1 root root 0 Sep 26 13:00 subsystem -> ../../../bus/virtio
-rw-r--r-- 1 root root 4096 Sep 26 13:00 uevent
-r--r--r-- 1 root root 4096 Sep 26 13:00 vendor
$ cat /sys/devices/
host$ mount -v -t 9p -o trans=virtio host /mnt
[ 340.559853] device: '9p-3': device_add
[ 340.563699] 9p: no channels available
[ 340.565602] device: '9p-3': device_unregister
[ 340.569201] device: '9p-3': device_
mount: No such file or director
$ mount -v -t 9p -o trans=virtio hostA /mnt
[ 406.218462] device: '9p-4': device_add
hostA on /mnt type 9p (rw,trans=virtio)
$ env
CONSOLE=
HOME=/
runlevel=2
INIT_VERSION=
COLUMNS=80
TERM=linux
PATH=/sbin:
RUNLEVEL=2
PREVLEVEL=N
SHELL=/bin/sh
PWD=/
previous=N
LINES=24
VERBOSE=no
$ id
uid=0(root) gid=0(root) groups=0(root)
$ hexdump asd
0000000 6f68 7473 0000 0000 0000 0000 0000 0000
0000010 0000 0000
0000014
I rebooted again and now just ctrl+d in my rc.local shell to get to my real root login with zsh:
$ cat /sys/devices/
$ hexdump asd
0000000 6f68 7473 0000 0000 0000 0000 0000 0000
0000010 0000 0000
0000014
$ id
uid=0(root) gid=0(root) groups=0(root)
$ env
TERM=linux
HOME=/root
SHELL=/bin/zsh
USER=root
LOGNAME=root
PATH=/host/
MAIL=/var/mail/root
HUSHLOGIN=FALSE
SHLVL=1
PWD=/root
OLDPWD=/root
COLORTERM=yes
LINKS_XTERM=screen
EDITOR=vim
PAGER=less -r
BROWSER=iceweasel
LESS=-RIM
LS_COLORS=
HISTFILE=
HISTSIZE=10000
SAVEHIST=10000
_=/usr/bin/env
$ mount -v -t 9p -o trans=virtio host /mnt
[ 224.087952] device: '9p-2': device_add
host on /mnt type 9p (rw,trans=virtio)
So the next step was to change my login shell to /bin/sh (dash) and reboot:
$ id
uid=0(root) gid=0(root) groups=0(root)
$ env
USER=root
MAIL=/var/mail/root
OLDPWD=/root
HOME=/root
HUSHLOGIN=FALSE
PS1=\h:\w\$
LOGNAME=root
TERM=linux
PATH=/host/
SHELL=/bin/sh
PWD=/host
$ mount -v -t 9p -o trans=virtio host /mnt
[ 15.330643] device: '9p-2': device_add
host on /mnt type 9p (rw,trans=virtio)
Next step was to boot up, change my env and then use the correct mount:
$ for i in USER MAIL OLDPWD HOME HUSHLOGIN PS1 LOGNAME TERM PATH SHELL PWD; do unset $i; done
$ env
$ /bin/mount -v -t 9p -o trans=virtio host /mnt
[ 431.742839] device: '9p-2': device_add
host on /mnt type 9p (rw,trans=virtio)
Changed in qemu: | |
status: | In Progress → Fix Committed |
Next steps were to use the old envs:
$ for i in USER MAIL OLDPWD HOME HUSHLOGIN PS1 LOGNAME TERM PATH SHELL PWD; do unset $i; done /dev/console sysvinit- 2.88 /usr/sbin: /bin:/usr/ bin /dev/console sysvinit- 2.88 /usr/sbin: /bin:/usr/ bin
$ export CONSOLE=
$ export HOME=/
$ export runlevel=2
$ export INIT_VERSION=
$ export COLUMNS=80
$ export TERM=linux
$ export PATH=/sbin:
$ export RUNLEVEL=2
$ export PREVLEVEL=N
$ export SHELL=/bin/sh
$ export PWD=/
$ export previous=N
$ export LINES=24
$ export VERBOSE=no
$ /bin/sh
$ env
CONSOLE=
HOME=/
runlevel=2
INIT_VERSION=
COLUMNS=80
TERM=linux
PATH=/sbin:
RUNLEVEL=2
PREVLEVEL=N
SHELL=/bin/sh
PWD=/host
previous=N
LINES=24
VERBOSE=no
$ mount -v -t 9p -o trans=virtio host /mnt
[ 44.554805] device: '9p-2': device_add
host on /mnt type 9p (rw,trans=virtio)
Next step was to strace on rc.local sh: create_ release
/bin/sh: can't access tty; job control turned off
$ strace -o /mount1 mount -v -t 9p -o trans=virtio host /mnt
[ 131.002908] device: '9p-2': device_add
[ 131.006914] 9p: no channels available
[ 131.009720] device: '9p-2': device_unregister
[ 131.013135] device: '9p-2': device_
mount: No such file or directory
And then inside the normal root shell
$ strace -o /mount2 mount -v -t 9p -o trans=virtio host /mnt