Open enkore opened 8 years ago
Can't get it to work, neither do the command line utilities (listextattr(1) etc). Everything's a EOPNOTSUP, independent of file system (FFS, UDF, ext2fs). Looking at the kernel code and config it should work with at least FFS and UDF (after initattr etc)
If someone uses NetBSD and Borg, feel free to test it whether it actually works (db6ce4812a3)
src/borg/xattr.py:
elif sys.platform.startswith(('freebsd', 'netbsd')):
"whether it actually works" <-- (if you run the tests and the one test in src/borg/testsuite/xattr passes and is not skipped - then it works)
https://mail-index.netbsd.org/tech-kern/2022/05/24/msg028105.html
Looks like we have to wait for netbsd 10.
Hmm, guess like the xattr stuff is already in the pre-release netbsd 10 code (and also the fs corruption issues seem to be solved), so if someone has time, that could be worked on.
After getting that to work on netbsd 10 pre, behaviour of the new code should be also tested on netbsd < 10 again, so it works there as expected (== without supporting xattrs, but not crashing or malfunctioning).
NetBSD 10 is released:
Vagrant machine - is netbsd 10 already available?:
https://app.vagrantup.com/boxes/search?architecture=amd64&provider=virtualbox&q=netbsd&sort=created
Still no vagrant box, no netbsd user caring for this. Guess I'll remove it from milestone.
Thinking of trying to test this, on NetBSD 10, and only just noticed, that extended attributes aren't enabled, out-of-the-box, according to https://wiki.netbsd.org/tutorials/acls_and_extended_attributes_on_ffs/, on FFS volumes. It might also be interesting, to see how the latest version of the ZFS implementation behaves.
Yeah, please try it! If you want to work on the borg code and have questions, either ask here or on #borgbackup on liberachat IRC.
Seems that the official public/final release of NetBSD 10, for x86-64 is a total trainwreck, in terms of actually being able to reliably install it, on a VMware Workstation, or QEMU VM, without configuration files being missing, the root file system being corrupted, random number generator seeds not being created, or some other weird, and wonderful issue arising.
However, if I install a Daily build (uname -a
says NetBSD demohost.localdomain 10.99.12 NetBSD 10.99.12 (GENERIC) #0: Tue Oct 22 00:23:42 UTC 2024 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
), and do modload compat_linux
, and pkgin install suse_base
, I can try to run the Linux binaries of BorgBackup 1.4.0:
demohost# ./borg-linux-glibc228
[ 802.7201775] linux_sys_rt_sigaction: setting signal 64 ignored
[ 802.7403330] linux_sys_rt_sigaction: setting signal 64 ignored
[ 804.0004830] linux_sys_rt_sigaction: setting signal 64 ignored
usage: borg-linux-glibc228 [-V] [-h] [--critical] [--error] [--warning] [--info] [--debug] [--debug-topic TOPIC] [-p]
[--iec] [--log-json] [--lock-wait SECONDS] [--bypass-lock] [--show-version] [--show-rc]
[--umask M] [--remote-path PATH] [--remote-ratelimit RATE] [--upload-ratelimit RATE]
[--remote-buffer UPLOAD_BUFFER] [--upload-buffer UPLOAD_BUFFER] [--consider-part-files]
[--debug-profile FILE] [--rsh RSH]
<command> ...
Borg - Deduplicated Backups
options:
-V, --version show version number and exit
Common options:
-h, --help show this help message and exit
--critical work on log level CRITICAL
--error work on log level ERROR
--warning work on log level WARNING (default)
--info, -v, --verbose
work on log level INFO
--debug enable debug output, work on log level DEBUG
--debug-topic TOPIC enable TOPIC debugging (can be specified multiple times). The logger path is
borg.debug.<TOPIC> if TOPIC is not fully qualified.
-p, --progress show progress information
--iec format using IEC units (1KiB = 1024B)
--log-json Output one JSON object per log line instead of formatted text.
--lock-wait SECONDS wait at most SECONDS for acquiring a repository/cache lock (default: 1).
--bypass-lock Bypass locking mechanism
--show-version show/log the borg version
--show-rc show/log the return code (rc)
--umask M set umask to M (local only, default: 0077)
--remote-path PATH use PATH as borg executable on the remote (default: "borg")
--remote-ratelimit RATE
deprecated, use ``--upload-ratelimit`` instead
--upload-ratelimit RATE
set network upload rate limit in kiByte/s (default: 0=unlimited)
--remote-buffer UPLOAD_BUFFER
deprecated, use ``--upload-buffer`` instead
--upload-buffer UPLOAD_BUFFER
set network upload buffer size in MiB. (default: 0=no buffer)
--consider-part-files
treat part files like normal files (e.g. to list/extract them)
--debug-profile FILE Write execution profile in Borg format into FILE. For local use a Python-compatible file can
be generated by suffixing FILE with ".pyprof".
--rsh RSH Use this command to connect to the 'borg serve' process (default: 'ssh')
required arguments:
<command>
benchmark benchmark command
break-lock break repository and cache locks
check verify repository
compact compact segment files / free space in repo
config get and set configuration values
create create backup
debug debugging command (not intended for normal use)
delete delete archive
diff find differences in archive contents
export-tar create tarball from archive
extract extract archive contents
info show repository or archive information
version display borg client version / borg server version
init initialize empty repository
key manage repository key
list list archive or repository contents
mount mount repository
prune prune archives
recreate Re-create archives
rename rename archive
serve start repository server process
umount umount repository
upgrade upgrade repository format
with-lock run user command with lock held
import-tar Create a backup archive from a tarball
[ 804.3000918] linux_sys_rt_sigaction: setting signal 64 ignored
demohost# ./borg-linux-glibc236
[ 830.4105295] linux_sys_rt_sigaction: setting signal 64 ignored
[2399] Error loading Python lib '/tmp/_MEIbcp6zY/libpython3.11.so.1.0': dlopen: /lib64/libm.so.6: version `GLIBC_2.35' not found (required by /tmp/_MEIbcp6zY/libpython3.11.so.1.0)
[ 830.4105295] linux_sys_rt_sigaction: setting signal 64 ignored
Obviously, the Linux ABI compatibility later is not a faithful, 100%-compatible clone of the "real" Linux ABI, and doesn't represent the behaviour of the native NetBSD ABI surface, but until I get around to actually building a native version of Borg, it could be useful, for some testing...
Seems that I can at least create a repository, using the NetBSD compatibility layer, and add a file to it, after adding an extended attribute, in the "user" namespace:
demohost# setextattr user TestAttribute "The attribute contents" TestFile
demohost# getextattr
usage: getextattr [-fhq] [-s | -x | -v style] attrnamespace attrname filename ...
demohost# getextattr user TestAttribute TestFile
TestFile The attribute contents
demohost# ./borg-linux-glibc228 create --stats --list BSDTest::1 TestFile
[ 1279.0418533] linux_sys_rt_sigaction: setting signal 64 ignored
[ 1279.0621692] linux_sys_rt_sigaction: setting signal 64 ignored
[ 1280.3224948] linux_sys_rt_sigaction: setting signal 64 ignored
A TestFile
------------------------------------------------------------------------------
Repository: /root/BSDTest
Archive name: 1
Archive fingerprint: a5f618c2aee8fad143a1b1f501ee58ed1f296d737f90a983205daf5f1eaa7b50
Time (start): Tue, 2024-10-22 23:16:21
Time (end): Tue, 2024-10-22 23:16:21
Duration: 0.02 seconds
Number of files: 1
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
Original size Compressed size Deduplicated size
This archive: 504 B 474 B 474 B
All archives: 0 B 0 B 586 B
Unique chunks Total chunks
Chunk index: 2 2
------------------------------------------------------------------------------
[ 1281.1023886] linux_sys_rt_sigaction: setting signal 64 ignored
Doesn't look like the extended attribute is actually accessed, when I look at the contents of BSDTest/data/0/, with "strings":
demohost# ls BSDTest/data/0/
BSDTest/data/0/0 BSDTest/data/0/1 BSDTest/data/0/2 BSDTest/data/0/3 BSDTest/data/0/4 BSDTest/data/0/5
demohost# ls BSDTest/data/0/
demohost# strings BSDTest/data/0/* | grep contents
demohost#
Briefly trying to install PIP, and a native version of BorgBackup, from it:
demohost# pkgin install py312-pip-24.2
calculating dependencies...done.
4 packages to install:
libffi-3.4.6 libuuid-2.32.1nb2 py312-pip-24.2 python312-3.12.6
0 to remove, 0 to refresh, 0 to upgrade, 4 to install
25M to download, 166M of additional disk space will be used
proceed ? [Y/n] y
[1/4] libffi-3.4.6.tgz 100% 34KB 33.8KB/s 00:00
[2/4] libuuid-2.32.1nb2.tgz 100% 29KB 29.2KB/s 00:00
[3/4] py312-pip-24.2.tgz 100% 2514KB 2.5MB/s 00:01
[4/4] python312-3.12.6.tgz 100% 22MB 1.9MB/s 00:12
[1/4] installing libffi-3.4.6...
[2/4] installing libuuid-2.32.1nb2...
[3/4] installing python312-3.12.6...
[4/4] installing py312-pip-24.2...
pkg_install warnings: 4, errors: 0
pkg_install error log can be found in /var/db/pkgin/pkg_install-err.log
reading local summary...
processing local summary...
demohost# pip-3.12 install "borgbackup==1.4.0"
Collecting borgbackup==1.4.0
Downloading borgbackup-1.4.0.tar.gz (3.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 6.2 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
Traceback (most recent call last):
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/pkgconfig/pkgconfig.py", line 91, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/pkgconfig/pkgconfig.py", line 125, in exists
return call(cmd) == 0
^^^^^^^^^
File "/usr/pkg/lib/python3.12/subprocess.py", line 389, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pkg/lib/python3.12/subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/pkg/lib/python3.12/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/pkg/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/usr/pkg/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pkg/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
exec(code, locals())
File "<string>", line 134, in <module>
File "<string>", line 122, in lib_ext_kwargs
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/pkgconfig/pkgconfig.py", line 198, in installed
if not exists(package):
^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-x0v8amev/overlay/lib/python3.12/site-packages/pkgconfig/pkgconfig.py", line 93, in _wrapper
raise EnvironmentError("pkg-config probably not installed: %r" % e)
OSError: pkg-config probably not installed: FileNotFoundError(2, 'No such file or directory')
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Looks like I probably need more things adding, to a virgin installation of NetBSD, to get further, but I'm not going to have time, to dig into this, tonight.
Looks like I can cleanly install the dependencies, and Borg itself, at least, using - which seems promising...
demohost# pip-3.12 install "borgbackup==1.4.0"
Collecting borgbackup==1.4.0
Using cached borgbackup-1.4.0.tar.gz (3.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting msgpack<=1.1.0,>=1.0.3 (from borgbackup==1.4.0)
Downloading msgpack-1.1.0.tar.gz (167 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting packaging (from borgbackup==1.4.0)
Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Building wheels for collected packages: borgbackup, msgpack
Building wheel for borgbackup (pyproject.toml) ... done
Created wheel for borgbackup: filename=borgbackup-1.4.0-cp312-cp312-netbsd_10_99_12_amd64.whl size=944839 sha256=8c934d93be1629a715c66ccc69c05e6132b2c7e9719da514a3f8c551b4336bd2
Stored in directory: /root/.cache/pip/wheels/8d/bc/90/75c20f255a5e63e6e7d74107fc1c8a9f0ffe225d9bb1c88d49
Building wheel for msgpack (pyproject.toml) ... done
Created wheel for msgpack: filename=msgpack-1.1.0-cp312-cp312-netbsd_10_99_12_amd64.whl size=93734 sha256=5c0959d882406a55018acfca5339ae9f976fc0536000963ec8ac6c5828dda9b8
Stored in directory: /root/.cache/pip/wheels/ce/85/00/b70cc8138e31b02808f742d6d46987a568e96fe90a229e1cb2
Successfully built borgbackup msgpack
Installing collected packages: packaging, msgpack, borgbackup
Successfully installed borgbackup-1.4.0 msgpack-1.1.0 packaging-24.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
demohost#
I haven't tried to use the Vagrant stuff, but I didn't seem to need anything additional, for this release.
Seems that the new, native Borg binary will run, and I can create an archive with it - but, it says there's no new unique chunks, when I try to use it to archive the TestFile
file, and I can't see either TestAttribute
, or its contents (The attribute contents
), in the strings of the repository's data blobs:
demohost# borg create --stats --list BSDTest::2 TestFile
A TestFile
------------------------------------------------------------------------------
Repository: /root/BSDTest
Archive name: 2
Archive fingerprint: 75e1440d9a175cad909516681ae53d009f5d44e51d1917954c3ada3a646e9a40
Time (start): Wed, 2024-10-23 19:00:21
Time (end): Wed, 2024-10-23 19:00:21
Duration: 0.04 seconds
Number of files: 1
Utilization of max. archive size: 0%
------------------------------------------------------------------------------
Original size Compressed size Deduplicated size
This archive: 500 B 470 B 470 B
All archives: 0 B 0 B 1.18 kB
Unique chunks Total chunks
Chunk index: 4 4
------------------------------------------------------------------------------
demohost# strings BSDTest/data/0/
BSDTest/data/0/0 BSDTest/data/0/2 BSDTest/data/0/4 BSDTest/data/0/6 BSDTest/data/0/8
BSDTest/data/0/1 BSDTest/data/0/3 BSDTest/data/0/5 BSDTest/data/0/7 BSDTest/data/0/9
demohost# strings BSDTest/data/0/* | grep TestAttribute
demohost#
For what it's worth, the version of TAR shipped with NetBSD 10 stores the attributes in a seemingly Linux-compatible way, when called with tar --xattrs --acls
:
30 mtime=1729638943.560194053
70 LIBARCHIVE.xattr.user.TestAttribute=VGhlIGF0dHJpYnV0ZSBjb250ZW50cw
58 SCHILY.xattr.user.TestAttribute=The attribute contents
The pax implementation defaults to ustar, and it doesn't seem to be possible, to have it include ACLs/xattrs in an archive.
Attaching a GZip'd copy of the TAR archive, for testing TAR imports, in the future - NetBSD-Attributes.tar.gz
I don't claim massive amounts of expertise with the internals of NetBSD, or Borg itself, but from comparing system call traces, from dtruss "borg create BSDTest::3 TestFile"
, and dtruss "tar --xattrs --acls -cvf Test5.tar TestFile"
, it appears that Borg never even tries to call __acl_get_fd()
, extattr_list_fd()
, or extattr_get_fd()
, when reading a file.
tar
seems to do this, when it requests an ACL/xattr, for reading:
fstat(0x6, 0x7F7FFF708190, 0x0) = 0 0
dtrace: error on enabled probe ID 1033 (ID 392: syscall::read:return): invalid address (0x796e20094000) in action #12 at DIF offset 20
: No such file or directory
close(0x6) = 0 0
dtrace: error on enabled probe ID 1022 (ID 1320: syscall::openat:return): invalid address (0x104) in action #11 at DIF offset 12
: No such file or directory
mmap(0x0, 0x5000, 0x3) = 537378816 0
__acl_get_fd(0x6, 0x4, 0x796E2007C000) = 0 0
mmap(0x0, 0x5000, 0x3) = 537358336 0
munmap(0x796E20077000, 0x5000) = 0 0
mmap(0x0, 0x6000, 0x3) = 537354240 0
munmap(0x796E2007B000, 0x1000) = 0 0
__acl_get_fd(0x6, 0x2, 0x796E20076000) = 0 0
extattr_list_fd(0x6, 0x1, 0x0) = 14 0
extattr_list_fd(0x6, 0x1, 0x796E201280A0) = 14 0
extattr_get_fd(0x6, 0x1, 0x7F7FFF708975) = 22 0
extattr_get_fd(0x6, 0x1, 0x7F7FFF708975) = 22 0
extattr_list_fd(0x6, 0x2, 0x0) = 0 0
close(0x6) = 0 0
write(0x2, "a TestFile\0", 0xA) = 10 0
issetugid(0x0, 0x0, 0x0) = 0 0
Unsure if it's down to a compilation-time issue, missing headers/libraries, or something else, right now...
@vmlemon IIRC we have install docs for NetBSD and there is also the Vagrantfile
which contains the required commands to set the system up so borg can be built / installed.
Can you please compare the steps you needed with our install docs / Vagrantfile?
If there is "nothing new", then please remove all the console logs about your unsuccessful first tries from this issue. If you found differences, please file a separate documentation issue and then also remove the console log from this issue. This issue is NOT about installing borg on NetBSD, but about xattr support for NetBSD.
borg needs a code change to do xattrs on NetBSD, see the first few comments in this issue.
After doing that code change:
Also, guess we don't want to test NetBSDs Linux ABI, but rather run borg natively and check whether it works correctly on NetBSD.
Annoyingly, dtruss
can't see inside a Linux ABI-flavoured process, beyond the return call, so I can't look into why it fails to handle xattrs, there.
Thanks, @ThomasWaldmann. I wasn't sure if the change was already in one of the latest releases of Borg, but I'll go through, and tidy things up.
As you use borg 1.4.0, this is the relevant code:
https://github.com/borgbackup/borg/blob/1.4-maint/src/borg/platform/__init__.py
Guess there could be some is_netbsd
flag and that would activate the same code as is_freebsd
?
https://github.com/borgbackup/borg/blob/1.4-maint/setup.py#L195
This is then needed on netbsd also.
We have automated tests for xattrs. Have a look so they get run on netbsd also.
NetBSD has a compatibility layer to Linux' xattr API: https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/xattr.h (w/ no access to the system namespace, whatever that's used for)
The native mechanism is sys/extattr.h - this then also allows access to the system namespace.
Edit: In fact, it seems that NetBSD's extattr API is identical to FreeBSD's. So this might just be a matter of adding "netbsd" in xattr to the platform check.
Note: OpenBSD has neither ACLs nor xattrs.