wsl2 /bin/sed: cannot rename etc/sedPisP47: Permission denied
Posted sean-zhao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wsl2 /bin/sed: cannot rename etc/sedPisP47: Permission denied相关的知识,希望对你有一定的参考价值。
解决方式:
修改sed的选项
解释:
sed -i -e COMMAND FILE sed: cannot rename /tmp/sed87A28d: Permission denied
*
This occurs most often when there are multiple processes running sed -i on files located in the same directory.
*
The file that sed is complaining about can be in the /tmp directory, the $TMP directory, or in the same directory as the file being edited.
*
One way to prevent this error is to use the -i option with an argument. For example, the following will create a backup of FILE by appending “.bak” to the name: sed -i.bak -e COMMAND FILE
buildroot遇到编译类似的问题,可手动将package下对应包的package.mk临时修改一下
$(SED) ‘/^# %sudo\\tALL=(ALL) ALL/s/^# //’ $(TARGET_DIR)/etc/sudoers
其他解决的思路
比如确实是遇到权限问题,比如多进程占用的问题,参见github and stackoverflow的讨论
https://github.com/opensearch-project/helm-charts/issues/166
https://stackoverflow.com/questions/14313318/permission-denied-when-sed-in-place-edit-in-mingw
可能真的是wsl2的问题??
以上是关于wsl2 /bin/sed: cannot rename etc/sedPisP47: Permission denied的主要内容,如果未能解决你的问题,请参考以下文章
react事件绑定的三种常见方式以及解决Cannot update during an existing state transition (such as within `render`). Ren
Sed 删除匹配行,匹配的字符用Shell变量替换,且变量里含有斜杠“/”时,无法删除