V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  wniming  ›  全部回复第 1 页 / 共 20 页
回复总数  399
1  2  3  4  5  6  7  8  9  10 ... 20  
手机一天 24 小时开免打扰,只有叫桶装水的时候会暂时把免打扰关掉,所以没有这个问题
@also1412 我看维基百科介绍,Imperial College London 和 University of Cambridge 本科生人数都差不多,为啥说 Imperial College London 是 small college 呢?
想起了于軒一...
15 天前
回复了 june4 创建的主题 编辑器 未来最牛编辑器 zed 的 Linux 版终于出来了
想要禁用光标闪烁,还不能通过界面操作,必须得去编辑设置文件,而且我按照他们的官方文档设置还不生效,只能说这就是个垃圾的玩意。
15 天前
回复了 june4 创建的主题 编辑器 未来最牛编辑器 zed 的 Linux 版终于出来了
刚才试了一下觉得做的真垃圾,我用 xfce 桌面,鼠标双击窗口的顶部标题栏从窗口模式切换到最大化模式,切完之后只要动鼠标就自动变成窗口模式,并且跟随鼠标移动,还从来还没见到过哪个 linux 下的 gui 软件能做的这么烂。
17 天前
回复了 saranz 创建的主题 Linux 各位 Linux 用的输入法都是?
我装了 fcitx 但只是作为带历史记录的剪切板用,平常打字(也包括现在回复你的帖子),都是用:

https://chromewebstore.google.com/detail/google-input-tools/mclkkofklkfljcocdinagocijmpgbhab?hl=en

因为开着 hk 的梯子所以打字的输入速度还是很快的,我觉得应该要比任何需要安装的 linux 输入法还要快。
17 天前
回复了 yagamil 创建的主题 生活 将来你老了,你最后悔的会是什么?
别的都不后悔,只后悔投胎
25 天前
回复了 imes 创建的主题 Rust RUST 的未来在哪里?
rust 适合用来开发轻量级 vmm ,cloud-hypervisor ,firecracker microvm 这种,公有云场景下非常注重安全性。
@kiracyan 是,老款的百兆网口的 tp 路由器可以单独关闭 dhcp ,新款的千兆网卡的都不支持,你用的是百兆 x 老款的那种吧?
@kuanat #32

dnf --installroot=/path/to/fedora_rootfs 这个确实不如 chroot /path/to/fedora_rootfs dnf ,dnf --installroot= 这种方式会导致 dnf history 时显示的 Command line 会包含 installroot 相关的几个参数,如果我一次性在命令行指定很多个包时后面的包会显示不出来,dnf --installroot= 更适合在空目录创建全新的 base rootfs 。
@zbinlin #29 可以,在我的这个使用场景下效果和 podman unshare 一样,你这个方法才是我发帖时最想得到的答案
@77ShiORi 这个是在开启无线桥接的情况下才能生效的,已经打算换小米路由器了,tplink 真是在退步,之前我用了好几年的老款 tplink 百兆路由器还支持单独关闭 dhcp ,新款居然不支持,真不知道他们产品经理是咋想的
@yanqiyu #24

dnf --installroot 应该是只需要 root 用户的,但是实测是不行的,不管是 fuse2fs -o fakeroot 还是普通的目录都报一样的错:

d@develop:~$ bwrap --dev-bind / / --unshare-user --uid 0 --gid 0 dnf --installroot=/home/d/.local/mnt/1/ --releasever=/ --config /etc/dnf/dnf.conf install vi
Last metadata expiration check: 0:05:21 ago on Sun 30 Jun 2024 05:57:21 PM CST.
Dependencies resolved.
===================================================================================================================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================================================================================================================
Installing:
vim-minimal x86_64 2:9.1.158-1.fc40 fedora 806 k
Installing dependencies:
vim-data noarch 2:9.1.158-1.fc40 fedora 23 k

Transaction Summary
===================================================================================================================================================================================================================
Install 2 Packages

Total size: 829 k
Installed size: 1.6 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] vim-data-9.1.158-1.fc40.noarch.rpm: Already downloaded
[SKIPPED] vim-minimal-9.1.158-1.fc40.x86_64.rpm: Already downloaded
Running transaction check
Transaction check succeeded.
Running transaction test
RPM: error: Unable to change root directory: Operation not permitted
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
Errors occurred during test transaction.

d@develop:~$
@guo4224 #21
@yanqiyu #22

刚才又试了一下不用 fuse2fs -o fakeroot 这种方式挂载的目录,就用普通的目录作为 rootfs 会怎样,结果还是不行:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 11 MB 00:06
Fedora 40 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0xA15B79CC:
Userid : "Fedora (40) <[email protected]>"
Fingerprint: 115D F9AE F857 853E E844 5D0A 0727 707E A15B 79CC
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-40-x86_64
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
RPM: error: Unable to change root directory: Permission denied
[Errno 13] Permission denied: '/home/d/.local/mnt/2/var/lib/dnf/rpmdb_lock.pid'
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Failed to store expired repos cache: [Errno 13] Permission denied: '/home/d/.local'
[Errno 13] Permission denied: '/home/d/.local'
d@develop:~$
@guo4224 #21
@yanqiyu #22

实际上 setuid 是无法满足我的这个需求的,原因跟我 #8 楼说的一样,比如我给 python 设置了 s 标志:

chmod u+s /usr/bin/python3.12

然后执行 dnf:

d@develop:~$ dnf --installroot=/home/d/.local/mnt/0/ --releasever=/ --config /etc/dnf/dnf.conf install tar
Config error: [Errno 13] Permission denied: '/home/d/.local/mnt/0/var': '/home/d/.local/mnt/0/var'
d@develop:~$
@0o0O0o0O0o #19 用 podman 比 docker rootless 更好,主要有以下 2 点

1 ,podman 的安装比 docker rootless 更方便,一条 dnf 命令搞定
2 ,docker 貌似没有类似 podman 的 unshare 子命令,用 docker 的话我就必须再依赖一个 fedora 的 container , 还要做个目录共享,例如:

docker run --name fedora4 -itd -p 2223:22 -v /home/d/.local/mnt/0/:/mnt/0 fedora:latest

然后用如下命令来实现:

docker exec -it fedora4 dnf --installroot=/mnt/0/ --releasever=/ --setopt=reposdir=/etc/yum.repos.d/ --setopt=cachedir=/var/cache/dnf --config /etc/dnf/dnf.conf install tar


如果用 bwrap 也能做到类似 podman unshare 的效果的话我也很乐意尝试一下,但暂时不打算研究了。
@yanqiyu 你的这种方法完美解决了我的问题:

podman unshare dnf --installroot=/home/d/.local/mnt/0/ --releasever=/ --config /etc/dnf/dnf.conf install tar
@sduoduo233 这个不提供 x86_64 架构下的安装包,而且我比较倾向于用 fedora 官方支持的工具来实现。
@0o0O0o0O0o fakeroot 的不是基于命名空间技术实现的,虽然可以用这个命令来骗过 dnf 命令, 让 dnf 命令不报那个需要特权用户的错,但执行到一半还是会报错:

d@develop:~$ fakeroot dnf --installroot=/home/d/.local/mnt/0 --releasever=/ --config /etc/dnf/dnf.conf install tcpdump
Last metadata expiration check: 0:04:10 ago on Sun 30 Jun 2024 02:58:04 PM CST.
Dependencies resolved.
===================================================================================================================================================================================================================
Package Architecture Version Repository Size
===================================================================================================================================================================================================================
Installing:
tcpdump x86_64 14:4.99.4-6.fc40 fedora 501 k

Transaction Summary
===================================================================================================================================================================================================================
Install 1 Package

Total size: 501 k
Installed size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] tcpdump-4.99.4-6.fc40.x86_64.rpm: Already downloaded
Running transaction check
Transaction check succeeded.
Running transaction test
RPM: error: Unable to change root directory: Operation not permitted
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
Errors occurred during test transaction.

d@develop:~$
1  2  3  4  5  6  7  8  9  10 ... 20  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2373 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 41ms · UTC 04:51 · PVG 12:51 · LAX 21:51 · JFK 00:51
Developed with CodeLauncher
♥ Do have faith in what you're doing.