** Changed in: qemu Status: In Progress => Fix Committed -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/648128
Title: VirtFS: Cannot mount 9p during boot Status in QEMU: Fix Committed 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-5908-gdd67374 Started the client using: sudo /usr/local/kvm/bin/qemu-system-x86_64 -m 1024 -kernel linux-2.6.35.5.qemu -drive file=root.img,if=virtio -net nic,macaddr=02:ca:ff:ee:ba:be,model=virtio,vlan=1 -net tap,ifname=tap1,vlan=1,script=no -virtfs local,path=/host,security_model=passthrough,mount_tag=host -nographic 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_create_release 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_create_release 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_create_release mount: No such file or directory $ ls -l /sys/bus/virtio/drivers/9pnet_virtio 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 -> ../../../../devices/virtio-pci/virtio1 $ ls -l /sys/devices/virtio-pci/virtio1 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 -> ../../../bus/virtio/drivers/9pnet_virtio -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/virtio-pci/virtio1/mount_tag 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_create_release 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=/dev/console HOME=/ runlevel=2 INIT_VERSION=sysvinit-2.88 COLUMNS=80 TERM=linux PATH=/sbin:/usr/sbin:/bin:/usr/bin 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/virtio-pci/virtio1/mount_tag > asd $ 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/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 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=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: HISTFILE=/root/.zsh_history 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/usr/bin:/host/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 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)