• is there a bug in cp command ?

    From [email protected]@21:1/5 to All on Tue Mar 11 00:20:01 2025
    hi,

    i try to use

    cp -ax / /mnt
    (cp space -ax space / space /mnt)

    which in debian 9,10,11 worked fine

    but in debian 12 (and lmde 6 (LinuxMintDebianEdition)) it does not work.

    the error is:

    #root@Server001:~# cp -ax / /mnt
    #cp: das Verzeichnis '/mnt/' kann nicht angelegt werden: Datei oder
    Verzeichnis nicht gefunden

    translated: the subdir /mnt/ cannot be created. file or subdir not found.

    i try to copy a ext4 filesystem to an second disk with ext4 filesystem.

    you can try with and without mounting a disk to /mnt

    the error is always the same.

    is it a bug or a new feature ?

    best regards

    uwe t

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Frank Guthausen@21:1/5 to [email protected] on Tue Mar 11 10:50:01 2025
    On Mon, 10 Mar 2025 23:56:47 +0100
    "[email protected]" <[email protected]> wrote:

    #root@Server001:~# cp -ax / /mnt
    #cp: das Verzeichnis '/mnt/' kann nicht angelegt werden: Datei oder Verzeichnis nicht gefunden

    # LANG=C.UTF-8 cp -ax / /mnt

    provides English error messages.

    Are you sure you mounted something to the /mnt target?

    To achieve your goal you might try:

    mkdir /srv/rootfs
    mount --bind / /srv/rootfs
    mount ${yourdevice} /mnt
    rsync -au /srv/rootfs/ /mnt/
    umount /mnt
    umount /srv/rootfs
    rmdir /srv/rootfs

    The trailing slash at the end of rootfs in
    the rsync line is mandatory for your use case.

    You can repeat this to copy newer data and it will run faster, since
    the rsync -u option will prevent copying files which weren't changed.
    The -a option archives permissions, ownership etc. as maybe expected
    from the cp command.
    --
    regards
    Frank

    -----BEGIN PGP SIGNATURE-----

    iQGzBAEBCgAdFiEE86z15c6qwvuAkhy+zDIN/uu9BloFAmfQBQIACgkQzDIN/uu9 BloEAgv/SHn96aanXTO53jNzZqPIyDsUK7u0A0mWBvMheCoIYqk973pjfhmG5jPx Ha13rYHdGhvPttGeObV8Rv4/EXv4icnMtOp9BQj4i+2hQaS61fF7Qy7060UM6Y7c efj+vjKiP9ypXeUNLMCmfhvCAnRMiKocpp1dHC2CoVt3u73Gf3b8xU3NUSxFCRZJ FRNpN4B7u/FOaqVO3niT4IJneQ3BfJA16WGiFIVFEB5KRC45NWemhhKeXeFV2c9t wdOJFue17pq2Rp3AQ5YHbEA7vIgIyPm0cn0J3qcL/PisTP34xGlk0XKTxmXmEsT7 xRsaPXU7jNoCc0u+ggm39t/JGFg6Wpp3Gw1VoxKjvDz90yjIebQX1728OhBHOyCg a4Szr5fsuptkeZwVpt1CjLMmbTzyt4IgZfs1c+euQtU+Gx2hEIibA9tXjbvML+LO 1zpuSk8Q+WDK5/XUGimK+orwScn8aB3oonPD53JjLF1Z+ZMWgD/xLFsrRzFo62uF
    8evbizoY
    =1kV2
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [email protected]@21:1/5 to All on Tue May 20 19:50:01 2025
    I solved the Problem for me by copy the File /usr/bin/cp from Debian 11
    to /usr/bin/cp2 on Debian 12

    Now i can run "cp2 -ax / /mnt" and it works like expected.

    "cp -ax / /mnt" with original debian 12 cp brings error on this point.

    You can test it.

    So there must be a difference between the old and the new cp Program or
    a Bug.

    cp is my way to clone a disk to a second disk with different size.

    i do it this way many years with no Problems.

    i create Partition, format with ext4, mount on /mnt, copy all Files with
    cp -ax, install Grub, boot and have fun.

    So i can make a copy of my running System on bigger or smaller Disks to
    test programs and installations on a test system.

    i'm sure, this is a bug in cp program.


    best regards

    Uwe

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to [email protected] on Tue May 20 20:10:01 2025
    On Tue, May 20, 2025 at 19:21:50 +0200, [email protected] wrote:
    I solved the Problem for me by copy the File /usr/bin/cp from Debian 11 to /usr/bin/cp2 on Debian 12

    Now i can run "cp2 -ax / /mnt" and it works like expected.

    "cp -ax / /mnt" with original debian 12 cp brings error on this point.

    You can test it.

    It's more likely to be something in your environment. What does
    "type -a cp" say?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)