我在 TS412 (QNAP) 上运行 Debian Bookworm;它将内核和 initrd 存储在闪存中。它总共有 16MB 闪存。因此,即使在调整 MD 分区之后,我能得到的最好的也是 12MB initrd 。我正在使用 xz 压缩。但即便如此,最初的 initrd 也有 12.5MB。我知道常见的解决方法是减少模块,但它们不是真正的问题。
2984 .../usr/lib/modules
6036 .../usr/share
18824 .../usr/lib/arm-linux-gnueabi
Run Code Online (Sandbox Code Playgroud)
在arm-linux-gnueabi中查看它有像libX11这样的东西...这台机器甚至没有控制台(即使获得串行线也很困难)它当然不需要“X”。
因此,我完全删除了很多软件包(apt-get remove ...),实际上比我应该删除的要多。但结果是一个小得多的 initrd(大约 5MB IIRC),它启动和运行得很好。
问题是,如果我 ssh 到盒子上并运行 emacs(1) ,那么将 GUI 版本投影回我的普通桌面(有大量内存和大显示器等)会很好,但这需要安装TS412 上的 X 客户端库。
现在我不明白为什么仅仅因为我安装了带有 X 客户端库的软件包,就需要在 initrd 上保留一个副本,而在启动过程中不需要它们。有没有办法限制其他东西进入 initrd,而不仅仅是模块(这不是罪魁祸首)
我已经尝试过在文档中搜索限制 initrd 的指南。
在我的 QNAP 设备出现问题之后,我不得不对数据进行大量手动恢复,并且只能获取我的加密数据。
似乎 QNAP 使用 eCryptFS 来做到这一点。我设法设置了密码短语(使用ecryptfs-add-passphrase --fnek)并使用以下命令安装了文件系统:
mount /mnt/md3/.__eN__securedocs/ /mnt/md3/documents/Secure/ -t ecryptfs \
-o rw,ecryptfs_sig=b04b010ba4c32521,ecryptfs_fnek_sig=4f23065f483e5b1c,ecryptfs_unlink_sigs,relatime,ecryptfs_cipher=aes,ecryptfs_key_bytes=32
Run Code Online (Sandbox Code Playgroud)
我可以看到我的文件,但权限处于我以前从未见过的状态,使它们无法与之交互,甚至不足以复制:
[~] # ll /mnt/md3/documents/Secure/
/bin/ls: cannot access /mnt/md3/documents/Secure/battle.net.txt: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/steam.txt: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Work: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Passport Application Declaration.pdf: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Bills: No such file or directory
/bin/ls: cannot access /mnt/md3/documents/Secure/Car: No such file or directory …Run Code Online (Sandbox Code Playgroud) 我的 Qnap NAS 被一个find缺少-exec参数的命令诅咒,所以我必须通过管道传输某些东西。外壳是:GNU bash,版本 3.2.57(2)-release-(arm-unknown-linux-gnueabihf)
我试图在当前目录的所有子目录(不是文件)上设置 setgid 位。
这不起作用:
find . -type d | xargs chmod g+s $1
Run Code Online (Sandbox Code Playgroud)
使用"$1","$(1)",$("1")等将不能工作。它们都表示chmod正在传递一个包含空格作为两个或多个参数的目录名称(它会输出有关支持哪些参数的标准帮助消息)。
xargs如果我不需要,我不在乎使用;我认为无论如何它都会被长名字窒息,不是吗?
这些及其变体不起作用:
find . -type d | chmod g+s
find . -type d | chmod g+s "$1"
Run Code Online (Sandbox Code Playgroud)
我想过使用awk或sed注入引号,但我必须认为有一种更简单的方法来做到这一点。人们以前是做什么的-exec?(可悲的是,我可能早在 1995 年左右就知道,但早已忘记了。)
PS:这些目录名称中的许多将包含 Unicode 字符、?符号等。它们最初来自 macOS,这是相当宽松的。也就是说,我可能应该?用 Unicode 字符之类的东西替换所有实例,?这样 Windows 就不会被它们阻塞。但这也需要find对这个残缺软件版本的find.