Skip to content

Commit

Permalink
Merge pull request apptainer#2456 from DrDaveD/add-fakeroot-command-m…
Browse files Browse the repository at this point in the history
…essage

Add message suggesting workarounds for fakeroot mode 3 errors
  • Loading branch information
DrDaveD authored Aug 27, 2024
2 parents 5f668bc + 4016a30 commit b954073
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ For older changes see the [archived Singularity change log](https://github.com/a
an oci container, retry the operation up to five times.
- Make fakeroot Recommended for SUSE rpms.
- Allow bind mounts onto existing files on r/o NFS filesystems.
- If an error is seen in the %post section when building a container
using fakeroot mode 3 (with the fakeroot command) then show a message
suggesting using `--ignore-fakeroot-command` and referring to the
documentation about how to install and use it inside the container
definition file.

## v1.3.3 - \[2024-07-03\]

Expand Down
5 changes: 5 additions & 0 deletions cmd/internal/cli/build_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ func runBuildLocal(ctx context.Context, cmd *cobra.Command, dst, spec string, fa
}

if err = b.Full(ctx); err != nil {
if fakerootPath != "" && strings.Contains(err.Error(), " %post section") && os.Getuid() == 0 {
sylog.Infof("If error was from fakeroot, try --ignore-fakeroot-command and")
sylog.Infof(" maybe use fakeroot inside the %%post section as described at")
sylog.Infof(" https://apptainer.org/docs/user/latest/fakeroot.html#fakeroot-inside-def")
}
sylog.Fatalf("While performing build: %v", err)
}
}
Expand Down
3 changes: 3 additions & 0 deletions internal/pkg/build/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func (s *stage) runPostScript(sessionResolv, sessionHosts string) error {
if len(fakerootBinds) > 0 {
s.cleanFakerootBindpoints(fakerootBinds)
}
if err != nil {
return fmt.Errorf("while running %%post section: %s", err)
}
return err
}
return nil
Expand Down

0 comments on commit b954073

Please sign in to comment.