Comments (3)
@ShamrockLee Does running chmod -R 777 .nix-portable
and then running rm -rf .nix-portable
work for you?
Some directories in the nix store do not have the writable bit set; rm -f
will delete "read only" files that are owned by your user but will not delete "read only" directories (afaik), hence the error. Because the folders are owned by your user you have permissions to run chmod
.
from nix-portable.
@rrbutani It works! Thanks a lot!
It would be helpful to document this as a "way to clean-up" and a workaround of #25.
from nix-portable.
maybe run chmod -R +w
after every extraction or build
doing chmod -R +w
too early in the build process would break CA derivations
related nix sources ...
src/libutil/tarfile.cc
static void extract_archive(TarArchive & archive, const Path & destDir)
{
int flags = ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_SECURE_SYMLINKS | ARCHIVE_EXTRACT_SECURE_NODOTDOT;
for (;;) {
struct archive_entry * entry;
int r = archive_read_next_header(archive.archive, &entry);
if (r == ARCHIVE_EOF)
break;
auto name = archive_entry_pathname(entry);
if (!name)
throw Error("cannot get archive member name: %s", archive_error_string(archive.archive));
if (r == ARCHIVE_WARN)
warn(archive_error_string(archive.archive));
else
archive.check(r);
archive_entry_copy_pathname(entry, (destDir + "/" + name).c_str());
// sources can and do contain dirs with no rx bits
if (archive_entry_filetype(entry) == AE_IFDIR && (archive_entry_mode(entry) & 0500) != 0500)
archive_entry_set_mode(entry, archive_entry_mode(entry) | 0500);
// Patch hardlink path
const char * original_hardlink = archive_entry_hardlink(entry);
if (original_hardlink) {
archive_entry_copy_hardlink(entry, (destDir + "/" + original_hardlink).c_str());
}
archive.check(archive_read_extract(archive.archive, entry, flags));
}
archive.close();
}
src/libstore/posix-fs-canonicalise.cc
static void canonicaliseTimestampAndPermissions(const Path & path, const struct stat & st)
{
if (!S_ISLNK(st.st_mode)) {
/* Mask out all type related bits. */
mode_t mode = st.st_mode & ~S_IFMT;
if (mode != 0444 && mode != 0555) {
mode = (st.st_mode & S_IFMT)
| 0444
| (st.st_mode & S_IXUSR ? 0111 : 0);
if (chmod(path.c_str(), mode) == -1)
throw SysError("changing mode of '%1%' to %2$o", path, mode);
}
}
src/libstore/local-store.cc
/* To improve purity, users may want to make the Nix store a read-only
bind mount. So make the Nix store writable for this process. */
void LocalStore::makeStoreWritable()
{
#if __linux__
if (!isRootUser()) return;
/* Check if /nix/store is on a read-only mount. */
struct statvfs stat;
if (statvfs(realStoreDir.get().c_str(), &stat) != 0)
throw SysError("getting info about the Nix store mount point");
if (stat.f_flag & ST_RDONLY) {
if (mount(0, realStoreDir.get().c_str(), "none", MS_REMOUNT | MS_BIND, 0) == -1)
throw SysError("remounting %1% writable", realStoreDir);
}
#endif
}
doc/manual/src/language/derivations.md
- After the build, Nix sets the last-modified timestamp on all files
in the build result to 1 (00:00:01 1/1/1970 UTC), sets the group to
the default group, and sets the mode of the file to 0444 or 0555
(i.e., read-only, with execute permission enabled if the file was
originally executable).
from nix-portable.
Related Issues (20)
- nixpkgs#emacs29-gtk3 with packages ends up with Operation not permitted in fixupPhase
- I cannot start nix-portable as a user HOT 7
- super slow access to webarchive when downloading proot
- [Help Wanted] nix bundle within nix-portable HOT 1
- Ability to simply enter the sandbox HOT 2
- Making Nix-Portable's runner script POSIX HOT 1
- Relative flake input files
- CACert issue?
- Bundler does not work in aarch64_linux
- homeless-shelter writable and causes failure if something writes there HOT 1
- set LOCALE_ARCHIVE for nix-shell
- Fails to run with vfs mount
- nix-portable breaks on symlinked home directory
- Error "nix is unable to build packages" when there's nothing to build HOT 1
- Debugging 'unzip: short read' HOT 2
- Sudo in nix-portable HOT 6
- nix-store no libgssapi_krb5.so.2 HOT 2
- How to update to nixos 23.11? HOT 1
- What is the `nix --store` runtime? HOT 3
- cannot use `nix --store` runtime which is selected by default HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix-portable.