Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Denied Error #171

Open
abhisekp opened this issue Feb 18, 2023 · 16 comments
Open

Permission Denied Error #171

abhisekp opened this issue Feb 18, 2023 · 16 comments

Comments

@abhisekp
Copy link

Describe the bug:

▶ fyne-cross linux -arch="*"  
[i] Target: linux/amd64
[i] Cleaning target directories...
[✓] "bin" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/bin/linux-amd64
[✓] "dist" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/dist/linux-amd64
[✓] "temp" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/tmp/linux-amd64
[i] Checking for go.mod: /home/abhisek/go/src/my-app/go.mod
[✓] go.mod found
[i] Building binary...
failed to initialize build cache at /go/go-build: mkdir /go/go-build: permission denied
[✗] exit status 1
▶ fyne-cross windows -arch="*"
[i] Target: windows/amd64
[i] Cleaning target directories...
[✓] "bin" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/bin/windows-amd64
[✓] "dist" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/dist/windows-amd64
[✓] "temp" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/tmp/windows-amd64
[i] Checking for go.mod: /home/abhisek/go/src/my-app/go.mod
[✓] go.mod found
2023/02/18 12:02:09 could not create the rc file: open /app/fyne-cross/tmp/windows-amd64/main.rc: permission denied
[✗] could not package the Fyne app: exit status 1

To Reproduce:

Steps to reproduce the behaviour:

  1. Go to 'command line'
  2. Run the command the given commands
  3. See error

Device and debug info (please complete the following information):

Device info
  • OS: Linux
  • Version: Ubuntu 20.04.5 LTS
  • Go version: 1.19.2
  • fyne-cross version: v1.3.0
  • Fyne version: v2.3.1
Debug info
▶ fyne-cross linux -no-cache -debug          
[i] Target: linux/amd64
command.Context{Volume:volume.Volume{binDirHost:"/home/abhisek/go/src/my-app/fyne-cross/bin", cacheDirHost:"/home/abhisek/.cache/fyne-cross", distDirHost:"/home/abhisek/go/src/my-app/fyne-cross/dist", tmpDirHost:"/home/abhisek/go/src/my-app/fyne-cross/tmp", workDirHost:"/home/abhisek/go/src/my-app"}, Architecture:"amd64", Engine:command.Engine{Name:"docker", Binary:"/usr/bin/docker"}, Env:map[string]string{"CC":"gcc", "GOARCH":"amd64", "GOOS":"linux"}, ID:"linux-amd64", LdFlags:[]string(nil), OS:"linux", Tags:[]string(nil), AppBuild:"10", AppID:"com.abhisekp.rqipxmlgenerator", AppVersion:"1.0.0", CacheEnabled:false, DockerImage:"docker.io/fyneio/fyne-cross:1.3-base", Icon:"Icon.png", Name:"MY_APP", Package:".", Release:false, StripDebug:true, Debug:true, Pull:false, Category:"", Certificate:"", Developer:"", Keystore:"", KeystorePass:"", KeyPass:"", Password:"", Profile:""}
[i] Cleaning target directories...
[✓] "bin" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/bin/linux-amd64
[✓] "dist" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/dist/linux-amd64
[✓] "temp" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/tmp/linux-amd64
[i] Checking for go.mod: /home/abhisek/go/src/my-app/go.mod
[✓] go.mod found
[i] Building binary...
/usr/bin/docker run --rm -t -w /app -v /home/abhisek/go/src/my-app:/app:z -u 1003:1003 --entrypoint fixuid -e CGO_ENABLED=1 -e GOCACHE=/go/go-build -e CC=gcc -e CGO_LDFLAGS=-w -s -e GOOS=linux -e GOARCH=amd64 docker.io/fyneio/fyne-cross:1.3-base go build -trimpath -o /app/fyne-cross/bin/linux-amd64/MY_APP -v .
fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION
fixuid: updating user 'docker' to UID '1003'
fixuid: updating group 'docker' to GID '1003'
fixuid: recursively searching path /
fixuid: chown /home/docker
fixuid: chown /home/docker/.bash_logout
fixuid: chown /home/docker/.bashrc
fixuid: chown /home/docker/.profile
internal/unsafeheader
internal/goarch
internal/goos
internal/goexperiment
internal/itoa
internal/cpu
runtime/internal/atomic
runtime/internal/syscall
math/bits
unicode/utf8
internal/race
internal/abi
runtime/internal/math
runtime/internal/sys
sync/atomic
unicode
image/color
container/list
crypto/internal/subtle
crypto/subtle
crypto/internal/boring/sig
internal/bytealg
math
unicode/utf16
vendor/golang.org/x/crypto/cryptobyte/asn1
internal/nettrace
vendor/golang.org/x/crypto/internal/subtle
encoding
fyne.io/fyne/v2/internal/color
golang.org/x/image/colornames
golang.org/x/net/html/atom
golang.org/x/text/encoding/internal/identifier
golang.org/x/text/internal/utf8internal
github.com/go-text/typesetting/di
golang.org/x/image/math/f64
golang.org/x/sys/internal/unsafeheader
runtime
github.com/benoitkugler/textlayout/fonts
internal/reflectlite
sync
internal/testlog
internal/singleflight
math/rand
runtime/cgo
errors
sort
internal/oserror
path
io
vendor/golang.org/x/net/dns/dnsmessage
strconv
crypto/internal/nistec/fiat
syscall
golang.org/x/text/internal/tag
strings
bytes
hash
hash/crc32
crypto
reflect
crypto/internal/randutil
crypto/rc4
vendor/golang.org/x/text/transform
golang.org/x/text/transform
bufio
net/http/internal/ascii
regexp/syntax
hash/adler32
golang.org/x/text/encoding
golang.org/x/text/runes
time
internal/syscall/unix
internal/syscall/execenv
image
golang.org/x/text/encoding/internal
golang.org/x/text/encoding/charmap
golang.org/x/text/encoding/japanese
golang.org/x/text/encoding/korean
regexp
image/internal/imageutil
image/draw
internal/poll
io/fs
context
golang.org/x/image/vector
golang.org/x/text/encoding/simplifiedchinese
embed
internal/fmtsort
encoding/binary
os
golang.org/x/text/encoding/traditionalchinese
golang.org/x/text/encoding/unicode
github.com/benoitkugler/textlayout/fonts/glyphsnames
image/jpeg
golang.org/x/image/draw
crypto/internal/nistec
crypto/cipher
crypto/internal/edwards25519/field
fmt
io/ioutil
crypto/internal/boring
crypto/des
crypto/aes
crypto/sha512
crypto/internal/edwards25519
crypto/hmac
crypto/md5
crypto/sha1
crypto/sha256
log
compress/flate
math/big
encoding/hex
encoding/base64
internal/godebug
net/url
path/filepath
vendor/golang.org/x/crypto/chacha20
internal/intern
encoding/pem
net/netip
vendor/golang.org/x/crypto/internal/poly1305
vendor/golang.org/x/sys/cpu
compress/gzip
vendor/golang.org/x/crypto/curve25519/internal/field
vendor/golang.org/x/crypto/hkdf
vendor/golang.org/x/text/unicode/bidi
vendor/golang.org/x/text/unicode/norm
vendor/golang.org/x/crypto/chacha20poly1305
vendor/golang.org/x/net/http2/hpack
vendor/golang.org/x/crypto/curve25519
net
mime
mime/quotedprintable
net/http/internal
encoding/json
vendor/golang.org/x/text/secure/bidirule
encoding/xml
golang.org/x/image/math/fixed
golang.org/x/net/html
github.com/srwiley/rasterx
vendor/golang.org/x/net/idna
crypto/rand
crypto/elliptic
crypto/internal/boring/bbig
encoding/asn1
crypto/ed25519
crypto/rsa
crypto/dsa
golang.org/x/text/internal/language
compress/zlib
github.com/benoitkugler/textlayout/fonts/binaryreader
github.com/benoitkugler/textlayout/fonts/psinterpreter
golang.org/x/image/ccitt
golang.org/x/image/tiff/lzw
image/png
vendor/golang.org/x/crypto/cryptobyte
crypto/x509/pkix
golang.org/x/image/tiff
github.com/benoitkugler/textlayout/language
github.com/goki/freetype/raster
github.com/benoitkugler/textlayout/unicodedata
crypto/ecdsa
golang.org/x/text/internal/language/compact
github.com/go-text/typesetting/language
golang.org/x/image/font
github.com/yuin/goldmark/util
github.com/go-gl/gl/v3.2-core/gl
github.com/goki/freetype/truetype
os/exec
golang.org/x/text/language
github.com/go-text/typesetting/segmenter
os/user
github.com/jsummers/gobmp
golang.org/x/text/encoding/htmlindex
github.com/goki/freetype
golang.org/x/net/html/charset
github.com/srwiley/oksvg
github.com/fyne-io/image/ico
github.com/go-gl/glfw/v3.3/glfw
os/signal
golang.org/x/sys/unix
golang.org/x/sys/execabs
net/textproto
crypto/x509
vendor/golang.org/x/net/http/httpguts
vendor/golang.org/x/net/http/httpproxy
mime/multipart
github.com/fredbi/uri
github.com/godbus/dbus/v5
crypto/tls
github.com/fsnotify/fsnotify
github.com/godbus/dbus/v5/introspect
fyne.io/systray/internal/generated/menu
fyne.io/systray/internal/generated/notifier
github.com/godbus/dbus/v5/prop
fyne.io/systray
net/http/httptrace
net/http
github.com/benoitkugler/textlayout/fonts/simpleencodings
fyne.io/fyne/v2
github.com/benoitkugler/textlayout/fonts/type1C
fyne.io/fyne/v2/internal/cache
fyne.io/fyne/v2/internal/svg
fyne.io/fyne/v2/driver/desktop
fyne.io/fyne/v2/storage/repository
fyne.io/fyne/v2/internal/async
fyne.io/fyne/v2/driver/mobile
fyne.io/fyne/v2/storage
fyne.io/fyne/v2/internal/driver
github.com/benoitkugler/textlayout/fonts/truetype
fyne.io/fyne/v2/internal/animation
fyne.io/fyne/v2/internal/app
fyne.io/fyne/v2/canvas
fyne.io/fyne/v2/data/binding
fyne.io/fyne/v2/theme
fyne.io/fyne/v2/internal/repository
fyne.io/fyne/v2/layout
fyne.io/fyne/v2/internal/widget
fyne.io/fyne/v2/internal
github.com/benoitkugler/textlayout/graphite
github.com/benoitkugler/textlayout/harfbuzz
github.com/go-text/typesetting/font
github.com/yuin/goldmark/text
github.com/go-text/typesetting/shaping
fyne.io/fyne/v2/internal/painter
github.com/yuin/goldmark/ast
github.com/yuin/goldmark/renderer
github.com/yuin/goldmark/parser
github.com/yuin/goldmark/renderer/html
github.com/yuin/goldmark
fyne.io/fyne/v2/widget
fyne.io/fyne/v2/container
fyne.io/fyne/v2/internal/painter/gl
fyne.io/fyne/v2/internal/driver/common
fyne.io/fyne/v2/internal/driver/glfw
fyne.io/fyne/v2/app
my-app
go build my-app: copying /tmp/go-build634998477/b001/exe/a.out: open /app/fyne-cross/bin/linux-amd64/MY_APP: permission denied
[✗] exit status 1
▶ fyne-cross windows -no-cache -debug
[i] Target: windows/amd64
command.Context{Volume:volume.Volume{binDirHost:"/home/abhisek/go/src/my-app/fyne-cross/bin", cacheDirHost:"/home/abhisek/.cache/fyne-cross", distDirHost:"/home/abhisek/go/src/my-app/fyne-cross/dist", tmpDirHost:"/home/abhisek/go/src/my-app/fyne-cross/tmp", workDirHost:"/home/abhisek/go/src/my-app"}, Architecture:"amd64", Engine:command.Engine{Name:"docker", Binary:"/usr/bin/docker"}, Env:map[string]string{"CC":"x86_64-w64-mingw32-gcc", "GOARCH":"amd64", "GOOS":"windows"}, ID:"windows-amd64", LdFlags:[]string{"-H=windowsgui"}, OS:"windows", Tags:[]string(nil), AppBuild:"11", AppID:"com.abhisekp.rqipxmlgenerator", AppVersion:"1.0.0", CacheEnabled:false, DockerImage:"docker.io/fyneio/fyne-cross:1.3-windows", Icon:"Icon.png", Name:"MY_APP.exe", Package:".", Release:false, StripDebug:true, Debug:true, Pull:false, Category:"", Certificate:"", Developer:"", Keystore:"", KeystorePass:"", KeyPass:"", Password:"", Profile:""}
[i] Cleaning target directories...
[✓] "bin" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/bin/windows-amd64
[✓] "dist" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/dist/windows-amd64
[✓] "temp" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/tmp/windows-amd64
[i] Checking for go.mod: /home/abhisek/go/src/my-app/go.mod
[✓] go.mod found
/usr/bin/docker run --rm -t -w /app/fyne-cross/tmp/windows-amd64 -v /home/abhisek/go/src/my-app:/app:z -u 1003:1003 --entrypoint fixuid -e CGO_ENABLED=1 -e GOCACHE=/go/go-build docker.io/fyneio/fyne-cross:1.3-windows /usr/local/bin/gowindres -arch amd64 -output MY_APP.exe -workdir /app/fyne-cross/tmp/windows-amd64
fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION
fixuid: updating user 'docker' to UID '1003'
fixuid: updating group 'docker' to GID '1003'
fixuid: recursively searching path /
fixuid: chown /home/docker
fixuid: chown /home/docker/.bash_logout
fixuid: chown /home/docker/.bashrc
fixuid: chown /home/docker/.profile
2023/02/18 12:36:11 could not create the rc file: open /app/fyne-cross/tmp/windows-amd64/main.rc: permission denied
[✗] could not package the Fyne app: exit status 1

@andydotxyz
Copy link
Member

Does your user have write permission for the directory you are running in?

@abhisekp
Copy link
Author

@andydotxyz Yes, /home/abhisek/go/src/my-app has the user permission because it's inside the home dir. And my app dir.
As evident, these dirs are cleaned.

[✓] "bin" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/bin/linux-amd64
[✓] "dist" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/dist/linux-amd64
[✓] "temp" dir cleaned: /home/abhisek/go/src/my-app/fyne-cross/tmp/linux-amd64

@abhisekp
Copy link
Author

abhisekp commented Feb 20, 2023

@andydotxyz the error is from inside the container. Which directory does it map to in the host sytem?

@andydotxyz
Copy link
Member

Which directory does it map to in the host sytem?

The current directory, by default. Maybe your disk ran out of space? Or Docker is running as a user who cannot write to your files?

The clearing of old builds message isn't proof it can write, as if they were missing it wouldn't have to do anything.

@Jacalz
Copy link
Member

Jacalz commented Feb 20, 2023

@abhisekp
Copy link
Author

@andydotxyz @Jacalz My current user has all the permissions. And I'm able to run helloworld docker. But with fyne it throws this error.
This is the output of id command. As you can see 1003 the current user and while running docker, that user is given permission in the docker container. And obviously, my current user has the appropriate permissions.

▶ id 
uid=1003(abhisek) gid=998(docker) groups=998(docker),27(sudo),139(libvirt),1003(abhisek)

My disk has a lot of space too

▶ df -h /               
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda9       122G  110G  6.8G  95% /

@abhisekp
Copy link
Author

Can you please help me settings these things manually? I will create a custom docker and would like fyne-cross use that instead?

@Bluebugs
Copy link
Contributor

I think it is not a docker image problem, but that docker doesn't have access to your app subdirectory. You can try the following command to check:

/usr/bin/docker run --rm -t -w /app -v /home/abhisek/go/src/my-app:/app:z -u 1003:1003 --entrypoint fixuid -e CGO_ENABLED=1 -e GOCACHE=/go/go-build -e CC=gcc -e CGO_LDFLAGS=-w -s -e GOOS=linux -e GOARCH=amd64 docker.io/fyneio/fyne-cross:1.3-base mkdir -p /app/fyne-cross/bin/linux-amd64/ && touch /app/fyne-cross/bin/linux-amd64/MY_APP

@abhisekp
Copy link
Author

@Bluebugs That's throwing an error

touch: cannot touch '/app/fyne-cross/bin/linux-amd64/MY_APP': No such file or directory

@abhisekp
Copy link
Author

@Bluebugs This is the full output

▶ /usr/bin/docker run --rm -t -w /app -v /home/abhisek/go/src/my-app:/app:z -u 1003:1003 --entrypoint fixuid -e CGO_ENABLED=1 -e GOCACHE=/go/go-build -e CC=gcc -e CGO_LDFLAGS='-w -s' -e GOOS=linux -e GOARCH=amd64 docker.io/fyneio/fyne-cross:1.3-base sh -c "mkdir -p fyne-cross/bin/linux-amd64 && touch fyne-cross/bin/linux-amd64/MY_APP"

fixuid: fixuid should only ever be used on development systems. DO NOT USE IN PRODUCTION
fixuid: updating user 'docker' to UID '1003'
fixuid: updating group 'docker' to GID '1003'
fixuid: recursively searching path /
fixuid: chown /home/docker
fixuid: chown /home/docker/.bash_logout
fixuid: chown /home/docker/.bashrc
fixuid: chown /home/docker/.profile
touch: cannot touch 'fyne-cross/bin/linux-amd64/MY_APP': Permission denied

@abhisekp
Copy link
Author

@Bluebugs But this command works fine without the -u 1003:1003 --entrypoint fixuid

/usr/bin/docker run --rm -t -w /app -v /home/abhisek/go/src/my-app:/app:z -e CGO_ENABLED=1 -e GOCACHE=/go/go-build -e CC=gcc -e CGO_LDFLAGS='-w -s' -e GOOS=linux -e GOARCH=amd64 docker.io/fyneio/fyne-cross:1.3-base sh -c "mkdir -p fyne-cross/bin/linux-amd64 && touch fyne-cross/bin/linux-amd64/MY_APP"

A file is created properly.

@abhisekp
Copy link
Author

My docker version

▶ docker -v
Docker version 20.10.22, build 3a2c30b

@Bluebugs
Copy link
Contributor

That's interesting. @lucor, I think you have a better knowledge here than I do, any guess what could be going on?

@sarim
Copy link

sarim commented Dec 20, 2023

running in a project idx workspace. rootless docker. I had to do the following at various stages

chmod 777 -R fyne-cross/  # inside MY-APP-FOLDER
chmod 777 MY-APP-FOLDER # inside my home
chmod 777 -R /home/user/.cache/fyne-cross

This still results in

[i] Target: windows/amd64
[i] Cleaning target directories...
[✓] "bin" dir cleaned: /app/fyne-cross/bin/windows-amd64
[✓] "dist" dir cleaned: /app/fyne-cross/dist/windows-amd64
[✓] "temp" dir cleaned: /app/fyne-cross/tmp/windows-amd64
[i] Checking for go.mod: /home/user/myapp/MY-APP-FOLDER/go.mod
[✓] go.mod found
[i] Packaging app...
  adding: MY-APP-FOLDER.exe (deflated 47%)
[✗] rename /home/user/myapp/MY-APP-FOLDER/fyne-cross/tmp/windows-amd64/MY-APP-FOLDER.exe.zip /home/user/myapp/MY-APP-FOLDER/fyne-cross/dist/windows-amd64/MY-APP-FOLDER.exe.zip: permission denied

While last step failed, I still got the output zip file. This seems like docker shenanigans. fyne-cross's docker images are not properly doing the sub-uid/gid stuff. Maybe you guys are using rootful docker so doesn't get affected by these. I use podman (which is by default rootless) in my own pc, so can't provide more insight. But It has been my experience that people assume rootful docker when building container images and those images craps out when it doesn't have that whole rootful docker permissions.

@Bluebugs
Copy link
Contributor

We are definitely not supporting rootless docker. Only podman rootless is supported. Is that the case here, we are talking about rootless docker?

@ParetoOptimalDev
Copy link

It could be that because your user isn't 1000 you are getting issues. I've had issues with docker container permissions before where containers only work if your uid is 1000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants