guestfs_mount_local api test: have to 'mount' before calling it?
Hi I`ve been trying this guestfs_mount_local api for quite a few days, but still can`t get over it. Now it seems to have enter the fuse loop but have some problems with 'mount', and stops at guestfs_mount_local_run(g). Here`s corresponding code in the test program: …… if(guestfs_mount_local(g,"/mnt/libg")==-1) exit(EXIT_FAILURE); else guestfs_mount_local_run(g); …… Below is a part of the debug dump information, …… version = 1.17.40.Root device: /dev/vda1 (this is test output) libguestfs: guestfs__mount_local: fuse_mount /mnt/libg libguestfs: guestfs__mount_local: fuse_new libguestfs: guestfs__mount_local: leaving fuse_mount_local libguestfs: guestfs__mount_local_run: entering fuse_loop libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 00 | ... guestfsd: main_loop: proc 11 (lvs) took 0.04 seconds guestfsd: main_loop: new request, len 0x34 guestfsd: error: lstat_stub: you must call 'mount' first to mount the root filesystem guestfsd: main_loop: proc 53 (lstat) took 0.00 seconds libguestfs: recv_from_daemon: 116 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 01 | 00 12 34 36 | ... libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 00 | ... guestfsd: main_loop: new request, len 0x34 …… Any idea what might be wrong with it?the fuse? Thanks Nok
On Sun, May 13, 2012 at 11:55:34AM +0800, Nok wrote:
Hi
I`ve been trying this guestfs_mount_local api for quite a few days, but still can`t get over it. Now it seems to have enter the fuse loop but have some problems with 'mount', and stops at guestfs_mount_local_run(g).
Here`s corresponding code in the test program: …… if(guestfs_mount_local(g,"/mnt/libg")==-1) exit(EXIT_FAILURE); else guestfs_mount_local_run(g); ……
Below is a part of the debug dump information,
…… version = 1.17.40.Root device: /dev/vda1 (this is test output)
libguestfs: guestfs__mount_local: fuse_mount /mnt/libg libguestfs: guestfs__mount_local: fuse_new libguestfs: guestfs__mount_local: leaving fuse_mount_local libguestfs: guestfs__mount_local_run: entering fuse_loop libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 00 | ... guestfsd: main_loop: proc 11 (lvs) took 0.04 seconds guestfsd: main_loop: new request, len 0x34 guestfsd: error: lstat_stub: you must call 'mount' first to mount the root filesystem
Are you actually mounting any filesystem before calling guestfs_mount_local? I'll try to write a small example program and send it.
guestfsd: main_loop: proc 53 (lstat) took 0.00 seconds libguestfs: recv_from_daemon: 116 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 01 | 00 12 34 36 | ... libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 00 | ... guestfsd: main_loop: new request, len 0x34
……
Any idea what might be wrong with it?the fuse?
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
See the example program here: https://github.com/libguestfs/libguestfs/blob/master/examples/mount_local.c ---------------------------------------------------------------------- $ ./run ./examples/mount_local /tmp/test.img This is the 'mount-local' demonstration program. Follow the instructions on screen. Creating and formatting the disk image, please wait a moment ... The _current directory_ is a FUSE filesystem backed by the disk image which is managed by libguestfs. Any files or directories you copy into here (up to 512 MB) will be saved into the disk image. You can also delete files, create certain special files and so on. When you have finished adding files, hit ^D or exit to exit the shell and return to the mount-local program. sh-4.2$ ls lost+found sh-4.2$ ls -l total 12 drwx------. 2 root root 12288 May 13 22:49 lost+found sh-4.2$ cp -r /usr/share/doc/libguestfs-devel-1.17.36 . sh-4.2$ exit Any files or directories that you copied in have been saved into the disk image called '/tmp/test.img'. Try opening the disk image with guestfish to see those files: guestfish -a /tmp/test.img -m /dev/sda1 $ guestfish -a /tmp/test.img -m /dev/sda1 Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> ll / total 18 drwxr-xr-x 4 root root 1024 May 13 22:49 . drwxr-xr-x 23 1000 1000 4096 May 13 22:51 .. drwxr-xr-x 2 root root 1024 May 13 22:49 libguestfs-devel-1.17.36 drwx------ 2 root root 12288 May 13 22:49 lost+found
<fs>
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On 05/14/2012 05:16 AM, Richard W.M. Jones wrote:
On Sun, May 13, 2012 at 11:55:34AM +0800, Nok wrote:
Hi
I`ve been trying this guestfs_mount_local api for quite a few days, but still can`t get over it. Now it seems to have enter the fuse loop but have some problems with 'mount', and stops at guestfs_mount_local_run(g).
Here`s corresponding code in the test program: …… if(guestfs_mount_local(g,"/mnt/libg")==-1) exit(EXIT_FAILURE); else guestfs_mount_local_run(g); ……
Below is a part of the debug dump information,
…… version = 1.17.40.Root device: /dev/vda1 (this is test output)
libguestfs: guestfs__mount_local: fuse_mount /mnt/libg libguestfs: guestfs__mount_local: fuse_new libguestfs: guestfs__mount_local: leaving fuse_mount_local libguestfs: guestfs__mount_local_run: entering fuse_loop libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 00 | ... guestfsd: main_loop: proc 11 (lvs) took 0.04 seconds guestfsd: main_loop: new request, len 0x34 guestfsd: error: lstat_stub: you must call 'mount' first to mount the root filesystem Are you actually mounting any filesystem before calling guestfs_mount_local? I just realized that I didn`t mount the /dev/sda to guestfs appliance mount point as you wrote in the example " guestfs_mount_options(g,"acl,user_xattr","/dev/sda1","/")". i guess that must be the problem in my testcase and the reason why it kept prompting "must call' mount' first".
I'll try to write a small example program and send it.
guestfsd: main_loop: proc 53 (lstat) took 0.00 seconds libguestfs: recv_from_daemon: 116 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 01 | 00 12 34 36 | ... libguestfs: error: lstat: lstat_stub: you must call 'mount' first to mount the root filesystem libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 35 | 00 00 00 00 | ... guestfsd: main_loop: new request, len 0x34
……
Any idea what might be wrong with it?the fuse? Rich.
Thanks for your nice example program! Nok
participants (2)
-
Nok -
Richard W.M. Jones