[lxc-users] lxc exec - cp: Value too large for defined data type
Michael Peek
peek at nimbios.org
Tue Oct 4 15:05:19 UTC 2016
I could be completely wrong about everything, but here's what I think is
going on:
If I'm correct then the version of cp you have inside the container was
compiled without large file support enabled. What constitutes a "large"
file is dependent on whether you're using a 32-bit or 64-bit system. If
your container is running a 32-bit image, then a large file is any file
whose size is 2GB or larger in size. For containers running a 64-bit
image a large file any file of size 4GB or larger. To support large
files programs usually only need to be compiled with certain compiler
flags enabled to tell the compiler to activate "large file"-specific
code within the source, either that or the libraries that the program
depends upon need to support large files by default.
I can't assume your distribution, but for me, /bin/cp is in the
coreutils package (Ubuntu). If I download the source for the coreutils
package and compile by hand I can see that the autoconf script prints
the following:
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
[...]
checking whether stdin defaults to large file offsets... yes
If I understand this correctly, then this means that on my system, the
underlying libraries that cp uses are compiled to handle large files
already (as shown in the last line), so no compiler flag was needed for
me (as shown the first three lines). But if I had needed it, then I
think the appropriate flag is -D_FILE_OFFSET_BITS=64. I'd need to do
some more research on that to be sure though. That may be system dependent.
For reading data serially this doesn't make any difference, hence the
file copied just fine and only printed out a warning. But if you tried
to write a piece of C code to open the file and seek the file pointer to
some point at or beyond the 2GB limit, then the seek would fail.
Michael
On 10/04/2016 09:30 AM, Tomasz Chmielewski wrote:
> I'm getting a weird issue with cp used with "lxc exec container-name
> /bin/bash /some/script.sh".
>
> /some/script.sh launches /some/other/script.sh, which in turn may run
> some other script.
> One of them is copying data with cp.
>
> In some cases, cp complains that "Value too large for defined data
> type", for example:
>
> '/vagrant/scripts/provision/shell/initial_deploy/rootfs/etc/php5/pool.d/phpmyadmin.conf'
> -> '/etc/php5/fpm/pool.d/phpmyadmin.conf'
> '/vagrant/scripts/provision/shell/initial_deploy/rootfs/etc/php5/pool.d/www.conf'
> -> '/etc/php5/fpm/pool.d/www.conf'
> '/vagrant/scripts/provision/shell/initial_deploy/rootfs/etc/nginx/conf.d/default.conf'
> -> '/etc/nginx/conf.d/default.conf'
> cp:
> '/vagrant/scripts/provision/shell/initial_deploy/rootfs/etc/nginx/conf.d/default.conf':
> Value too large for defined data type
> cp:
> '/vagrant/scripts/provision/shell/initial_deploy/rootfs/etc/nginx/conf.d':
> Value too large for defined data type
>
>
> "/vagrant/" is a bind-mount directory within LXD:
>
> vagrant:
> path: /vagrant
> source: /home/vagrantvm/Desktop/vagrant
> type: disk
>
>
> Anyone else seeing this?
>
> The files are copied, just the warning is a bit strange.
>
>
> Tomasz Chmielewski
> https://lxadm.com
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
More information about the lxc-users
mailing list