[Libguestfs] Guestfish command - "copy-out" not working for symbolic links

Nikolay Ivanets stenavin at gmail.com
Sat Jun 29 07:49:21 UTC 2019


I think that your link target does not exist.
I've made the following test configuration:

ll /etc
lrwxrwxrwx   1 root root     10 Jun 29 07:35 zzz -> /root/test
lrwxrwxrwx   1 root root     12 Jun 29 07:38 zzz1 -> ../root/test
lrwxrwxrwx   1 root root     18 Jun 29 07:39 zzz2 -> ../root/non-exists

/root/test is existing file.
/root/non-exists is not existent file.

The following commands works as expected:

download /etc/zzz /path/on/host/zzz
download /etc/zzz1 /path/on/host/zzz1

Next one fails:

download /etc/zzz2 /path/on/host/zzz2
libguestfs: error: download: /etc/zzz2: No such file or directory

Can you make sure link target exists? What is the output of this command?

exists /run/systemd/resolve/stub-resolv.conf

Can you download your target directly?

download /run/systemd/resolve/stub-resolv.conf /path/on/host/stub-resolv.conf

--
    +380979184774
    Mykola Ivanets

пт, 28 черв. 2019 о 23:30 Chintan Patel <chintan.r.patel at outlook.com> пише:
>
> guestfish --ro -a /path/to/disk run : mount /dev/your-blkdev / :
> download /etc/resolv.conf /path/on/host/dst.file
>
> Is also not working for symbolic link - as "/etc/resolv.conf" is symbolic link.
> ________________________________
> From: Nikolay Ivanets <stenavin at gmail.com>
> Sent: Friday, June 28, 2019 11:34 AM
> To: Chintan Patel
> Cc: Chintan Patel; libguestfs at redhat.com
> Subject: Re: [Libguestfs] Guestfish command - "copy-out" not working for symbolic links
>
> guestfish --ro -a /path/to/disk run : mount /dev/your-blkdev / :
> download /etc/resolv.conf /path/on/host/dst.file
>
> --
>     +380979184774
>     Mykola Ivanets
>
> пт, 28 черв. 2019 о 21:29 Nikolay Ivanets <stenavin at gmail.com> пише:
> >
> > All API is exposed as gustfish commands
> >
> > --
> >   Mykola Ivanets
> >
> > пт, 28 черв. 2019, 21:28 користувач Chintan Patel <chintan.r.patel at outlook.com> пише:
> >>
> >> This no going to work.
> >> AS I told you I need something under guestfish command list not from guestfs commands.
> >>
> >> Thanks,
> >> Chintan
> >> ________________________________
> >> From: Nikolay Ivanets <stenavin at gmail.com>
> >> Sent: Friday, June 28, 2019 10:58 AM
> >> To: Chintan Patel
> >> Cc: Chintan Patel; libguestfs at redhat.com
> >> Subject: Re: [Libguestfs] Guestfish command - "copy-out" not working for symbolic links
> >>
> >> Chintan,
> >>
> >> Use 'download' (http://libguestfs.org/guestfs.3.html#guestfs_download)
> >>
> >> --
> >>   Mykola Ivanets
> >>
> >> пт, 28 черв. 2019, 18:55 користувач Chintan Patel <chintan.r.patel at outlook.com> пише:
> >>
> >> Hi Nikolay,
> >>
> >> We use guestfish, so I preferred to use commands supported by guestfish.
> >> I tried as below but "realpath" is not working after I have the target path from symlink.
> >> --> Check if the path has a symlink.
> >> is-symlink path
> >> Ex. - is-symlink "/etc/resolv.conf"   -> return true
> >>
> >> --> If it's true then get target link path
> >> readlink path
> >> ex. - readlink "/etc/resolv.conf"  --> return "../run/systemd/resolve/stub-resolv.conf"
> >>
> >> --> Which return's target path but it's not a full path, so needs to get full path to access the target file.
> >> Tried to use realpath as below using target path from above return but it's giving None
> >>
> >> ex. - realpath "../run/systemd/resolve/stub-resolv.conf"  --> return None
> >>
> >>
> >> Can you tell me how can I get the real path as without the full canonicalized absolute path I can't do anything with that file.
> >>
> >>
> >> Thanks,
> >> Chintan
> >> ________________________________
> >> From: libguestfs-bounces at redhat.com <libguestfs-bounces at redhat.com> on behalf of Nikolay Ivanets <stenavin at gmail.com>
> >> Sent: Friday, June 28, 2019 2:00 AM
> >> To: Chintan Patel
> >> Cc: libguestfs at redhat.com
> >> Subject: Re: [Libguestfs] Guestfish command - "copy-out" not working for symbolic links
> >>
> >> If it is one time operation you can call 'realpath'
> >> (http://libguestfs.org/guestfs.3.html#guestfs_realpath) first to
> >> resolve symlink.
> >>
> >> --
> >>     +380979184774
> >>     Mykola Ivanets
> >>
> >> пт, 28 черв. 2019 о 11:11 Chintan Patel <Chintan.Patel at microsoft.com> пише:
> >> >
> >> > HI,
> >> >
> >> > I’m trying to use copu-out command to copy files from remote disk but it’s not working if the file is symbolic link.
> >> >
> >> > copy-out giving an error like below.
> >> > libguestfs: error: ‘/etc/resolv.conf’ is not a file or directory
> >> > This file is there but it's a symbolic link
> >> >
> >> > Do you have any other way to copy remote symbolic link files?
> >> >
> >> > Thanks,
> >> >
> >> > Chintan
> >> >
> >> > _______________________________________________
> >> > Libguestfs mailing list
> >> > Libguestfs at redhat.com
> >> > https://www.redhat.com/mailman/listinfo/libguestfs
> >>
> >> _______________________________________________
> >> Libguestfs mailing list
> >> Libguestfs at redhat.com
> >> https://www.redhat.com/mailman/listinfo/libguestfs




More information about the Libguestfs mailing list