Fulgurance | 2024-09-30 13:53:51 UTC | #1 Hi guys, I have a question. Recently when I tested my package manager write in Crystal , I noticed if the files my package manager try to move are mounted in tmpfs like this: ```bash tmpfs /tmp tmpfs rw,nosuid,noatime,nodev,mode=1777 0 0 tmpfs /var/tmp tmpfs rw,nosuid,noatime,nodev,mode=1777 0 0 ``` It fail with the error that the file can't be found . Why ? ------------------------- beta-ziliani | 2024-09-19 17:54:31 UTC | #2 Hard to tell, can you reduce the example to something we can run? ------------------------- Fulgurance | 2024-09-30 13:53:04 UTC | #3 I try to. This is the error I get: ``` [!] Failed to move /tmp/ism/builtsoftwares/KdeSoftwares-Main/Dolphin/23.8.0/usr/lib/libdolphinvcs.so.5 to /usr/lib/libdolphinvcs.so.5 [!] Error opening file with mode 'r': '/tmp/ism/builtsoftwares/KdeSoftwares-Main/Dolphin/23.8.0/usr/lib/libdolphinvcs.so.5': No such file or directory ``` And the function called from my software: ```crystal def runSystemCommand(command : String, path = Ism.settings.installByChroot ? "/" : Ism.settings.rootPath, environment = Hash(String, String).new, environmentFilePath = String.new) : Process::Status environmentCommand = String.new if environmentFilePath != "" environmentCommand = "source \"#{environmentFilePath}\" && " end environment.keys.each do |key| environmentCommand += " #{key}=\"#{environment[key]}\"" end Ism.recordSystemCall(command, path, environment) if Ism.settings.installByChroot chrootCommand = <<-CODE #!/bin/bash cd #{path} && #{environmentCommand} #{command} CODE process = runChrootTasks(chrootCommand) else process = Process.run( command, output: :inherit, error: :inherit, shell: true, chdir: (path == "" ? nil : path), env: environment) end return process end def moveFile(path : String, newPath : String) requestedCommands = "mv #{path} #{newPath}" process = runSystemCommand(requestedCommands) if !process.success? Ism.notifyOfRunSystemCommandError(requestedCommands) Ism.exitProgram end end ``` ------------------------- kojix2 | 2024-10-02 10:00:54 UTC | #4 Hi, Your question seems more related to Linux systems than to Crystal, which might be why you're not getting many replies. I wasn't sure either, so I asked ChatGPT for some insight. I know it can be a bit annoying when people share AI-generated answers, so I hope you don't mind. Here's what it suggested: *It might be due to the chroot environment affecting access to `/tmp` or `/var/tmp`. Since chroot environments can't access files outside their own directory structure, the files in `/tmp` might not be available inside the chroot. You might want to check if those directories are properly mounted within the chroot.* Hope this helps! ------------------------- kojix2 | 2024-10-02 10:07:03 UTC | #5 Trivia It's easy to download a Discourse discussion in Markdown text format. You can easily download the Markdown text for this page from the following URL. https://forum.crystal-lang.org/raw/7185 ------------------------- robmullr | 2024-10-02 11:27:06 UTC | #6 @kojix2 That is an interesting bit of trivia. Might be interesting enough to be its own topic and not so buried. ------------------------- Fulgurance | 2024-10-02 14:48:59 UTC | #7 It's interesting, but actually this installation didn't use the chroot mode. :sweat_smile: -------------------------