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

[Bug]: snap move storage issue #100

Open
3 tasks done
xela92 opened this issue Jul 5, 2022 · 17 comments
Open
3 tasks done

[Bug]: snap move storage issue #100

xela92 opened this issue Jul 5, 2022 · 17 comments
Labels
bug Something isn't working help wanted Extra attention is needed linux

Comments

@xela92
Copy link

xela92 commented Jul 5, 2022

Describe the bug

On Linux (snap), it's difficult to select a directory to move storage to.

The file chooser seems to be confined to default directory: but if a user hits CTRL+L and specifies manually a path, the file gets written and everything works.

That leads to misunderstandings, initially I thought there was a problem with snap confinement, but seems it's not the case.

To reproduce

  1. Go to preferences
  2. Click on Move storage
  3. Try to select a folder with the file picker
  4. See issue

Version

2.6.1

OS

Ubuntu 22.04

Validations

@NucciTheBoss
Copy link

Can confirm that this is reproducible on my Ubuntu 22.04 machine. This does look like it might be an issue with the confinement of the snap given the output of dmesg:

sudo dmesg | grep masscode
[351738.849531] audit: type=1400 audit(1657031770.120:424): apparmor="STATUS" operation="profile_load" profile="unconfined" name="snap-update-ns.masscode" pid=244436 comm="apparmor_parser"
[351738.932780] audit: type=1400 audit(1657031770.204:425): apparmor="STATUS" operation="profile_load" profile="unconfined" name="snap.masscode.masscode" pid=244437 comm="apparmor_parser"
[351744.116134] audit: type=1400 audit(1657031775.388:428): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.masscode" pid=245071 comm="apparmor_parser"
[351744.160113] audit: type=1400 audit(1657031775.432:429): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.masscode.masscode" pid=245072 comm="apparmor_parser"
[351838.845336] audit: type=1400 audit(1657031870.117:432): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.845644] audit: type=1400 audit(1657031870.121:433): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/3830d5c3ddfd5cd38a049b759396e72e-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.847039] audit: type=1400 audit(1657031870.121:434): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/c855463f699352c367813e37f3f70ea7-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.847349] audit: type=1400 audit(1657031870.121:435): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/32b6488e5b8292a2e95c79d947e009e8-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.861548] audit: type=1400 audit(1657031870.137:436): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/57e423e26b20ab21d0f2f29c145174c3-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.862018] audit: type=1400 audit(1657031870.137:437): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/7ef2298fde41cc6eeb7af42e48b7d293-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.862511] audit: type=1400 audit(1657031870.137:438): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/d82eb4fd963d448e2fcb7d7b793b5df3-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351838.973429] audit: type=1400 audit(1657031870.249:439): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-le64.cache-7" pid=245542 comm="masscode" requested_mask="w" denied_mask="w" fsuid=1000 ouid=1000
[351841.574239] audit: type=1107 audit(1657031872.845:497): pid=1872 uid=102 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=245542 label="snap.masscode.masscode"
[351861.631050] audit: type=1400 audit(1657031892.902:499): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/etc/fstab" pid=245542 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351861.634879] audit: type=1400 audit(1657031892.906:500): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=245542 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351861.965423] audit: type=1400 audit(1657031893.238:501): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=245542 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351861.999362] audit: type=1400 audit(1657031893.270:502): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=245542 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351862.055515] audit: type=1400 audit(1657031893.326:503): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=245542 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351862.118592] audit: type=1107 audit(1657031893.390:504): pid=1872 uid=102 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.659" pid=245542 label="snap.masscode.masscode" peer_pid=245873 peer_label="unconfined"
[351862.119046] audit: type=1107 audit(1657031893.390:506): pid=1872 uid=102 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.659" pid=245542 label="snap.masscode.masscode" peer_pid=245873 peer_label="unconfined"
[351868.682864] audit: type=1400 audit(1657031899.954:508): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.bash_history" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.682871] audit: type=1400 audit(1657031899.954:509): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.bash_logout" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.682874] audit: type=1400 audit(1657031899.954:510): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.bashrc" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.682889] audit: type=1400 audit(1657031899.954:511): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.profile" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.682925] audit: type=1400 audit(1657031899.954:512): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.shell.pre-oh-my-zsh" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.682967] audit: type=1400 audit(1657031899.954:513): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.wget-hsts" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.682996] audit: type=1400 audit(1657031899.954:514): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.zcompdump-godzilla-5.8.1" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.683024] audit: type=1400 audit(1657031899.954:515): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.zshenv" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.683054] audit: type=1400 audit(1657031899.954:516): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.zshrc" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351868.683085] audit: type=1400 audit(1657031899.954:517): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/home/nucci/.zshrc.pre-oh-my-zsh" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351880.319011] audit: type=1400 audit(1657031911.590:524): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/media/nucci/easystore/" pid=245542 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[351883.354343] audit: type=1400 audit(1657031914.626:525): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=245542 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[351883.363687] audit: type=1400 audit(1657031914.634:526): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/media/nucci/easystore/" pid=245799 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[379013.420612] audit: type=1107 audit(1657059045.189:528): pid=1872 uid=102 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=314536 label="snap.masscode.masscode"
[379054.134795] audit: type=1400 audit(1657059085.898:530): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/etc/fstab" pid=314536 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[379054.138441] audit: type=1400 audit(1657059085.902:531): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=314536 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[379054.358158] audit: type=1400 audit(1657059086.122:532): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=314536 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[379054.402542] audit: type=1400 audit(1657059086.166:533): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=314536 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[379054.493306] audit: type=1107 audit(1657059086.258:534): pid=1872 uid=102 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.668" pid=314536 label="snap.masscode.masscode" peer_pid=314759 peer_label="unconfined"
[379054.493601] audit: type=1107 audit(1657059086.258:536): pid=1872 uid=102 auid=4294967295 ses=4294967295 subj=? msg='apparmor="DENIED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/hostname1" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name=":1.668" pid=314536 label="snap.masscode.masscode" peer_pid=314759 peer_label="unconfined"
[379055.593388] audit: type=1400 audit(1657059087.358:538): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=314536 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
[379061.187750] audit: type=1400 audit(1657059092.954:539): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/media/nucci/easystore/" pid=314536 comm="pool" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
[379115.287463] audit: type=1400 audit(1657059147.055:540): apparmor="DENIED" operation="open" profile="snap.masscode.masscode" name="/run/mount/utab" pid=314536 comm="masscode" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

There are a lot of AppArmor denied messages being generated. Also, the file chooser has issues accessing other file system locations such as removeable media.

image

Potential solution

If had to give my best guess as to what the issue is, I believe the snap package is missing a couple of interfaces common for advanced Electron apps. The snap package could probably benefit from these interfaces:

I have built snaps for Electron apps before so I am going to play around with this issue a bit.

@MostHated
Copy link

When I hit the "Move Code" button, this is what I get.

@xela92
Copy link
Author

xela92 commented Jul 6, 2022

Can confirm that this is reproducible on my Ubuntu 22.04 machine. This does look like it might be an issue with the confinement of the snap given the output of dmesg:

sudo dmesg | grep masscode
There are a lot of AppArmor denied messages being generated. Also, the file chooser has issues accessing other file system locations such as removeable media.

image

Potential solution

If had to give my best guess as to what the issue is, I believe the snap package is missing a couple of interfaces common for advanced Electron apps. The snap package could probably benefit from these interfaces:

I have built snaps for Electron apps before so I am going to play around with this issue a bit.

The strangest thing is: I expected that manually putting the path won't work if it was a snap confinement issue, instead it works fine 🤔 is it related to the "--dangerous" flag passed during installation?

@antonreshetov antonreshetov added help wanted Extra attention is needed bug Something isn't working and removed pending triage labels Jul 6, 2022
@NucciTheBoss
Copy link

The strangest thing is: I expected that manually putting the path won't work if it was a snap confinement issue, instead it works fine thinking is it related to the "--dangerous" flag passed during installation?

The --dangerous flag just tells snap to install the package without checking its PGP signature. This allows you to install .snap files without needing to link against the author and/or Snap store. Without the signature check, the package is considered "unverified," which is fine if you trust the author and the author is trustworthy.

That being said, if I install the package as snap install masscode_2.6.1_amd64.snap --dangerous --devmode, I am able to read my external storage device, but I still do not have write access to any of my directories. --devmode is essentially --classic (do not confine the snap) but you cannot release snaps in --devmode from the Snap store.

Considering the above, there might be one or two issues here 🤔. It might be an issue with how the snap is confined, or how the snap is confined + how the file chooser is configured for Linux distros. I am going to take a swing at this issue tonight (America/New_York time) to see if it is just a confinement issue with the snap. My first idea is that I am thinking we might need to delegate the snap build to a snapcraft.yaml file from electron-builder.

@EGQM
Copy link

EGQM commented Jul 11, 2022

I think this is maybe a solution:create a path /mnt/masscode,link the path to the storage directory and add the "removable-media" plugin to snap file, according to removable-media-interface

@EGQM
Copy link

EGQM commented Jul 16, 2022

temporary solution:
(1)add the directory to the left column of nautilus
(2)edit the snapcraft.yaml file,change "confinement: strict" to "confinement: devmode".
(3)rebuild massCode
(4)reinstall massCode。

snap install masscode_2.9.0_amd64.snap --dangerous --devmode

(5)change massCode "storage" by selecting the directory in the left column of nautilus

@NucciTheBoss
Copy link

Yeah, after playing with the snap build for the past couple of days, I believe there is a multitude of issues with the Linux build in general. Not sure if any of you are experiencing this, but MassCode is not detecting any of my fonts and the cursor in the editor doesn't behave right.

I should have something brewed up soon for fixes, but I believe part of it will involve editing some of massCode's source code as well as modifying the snap build. Also, you shouldn't need to rebuild the snap to enable devmode. You should just be able to install massCode in devmode by just passing the --devmode flag when you install the already built snap package.

@antonreshetov
Copy link
Member

If it's so complicated with .snap, maybe you could just try another build, like AppImage?
Just set here target: ['AppImage']

@EGQM
Copy link

EGQM commented Jul 16, 2022

@NucciTheBoss thank you.I just let the font setting blank,the cursor in the editor behaves right.a temporary solution ^_^

@xela92
Copy link
Author

xela92 commented Jul 16, 2022

If it's so complicated with .snap, maybe you could just try another build, like AppImage? Just set here target: ['AppImage']

I quote, appImage would also make the update feature more useful (you would have a download file for Linux), or you could even integrate appImage update mechanism

@NucciTheBoss
Copy link

I wouldn't say the issue is that the snap is too complicated - it's more that I'm an apprentice with JavaScript x Electron so this is a bit of a learning experience 😅

Adding the removable-media interface fixes the external drive issue, but the issue with the fonts is that it is preconfigured to use fonts that are not traditionally available on Linux-based systems. I figured this out by comparing the snap package with the unpacked massCode build. This could be resolved by either adding a font stagePackage or changing the default fonts for Linux.

Regarding AppImage, this would be a good idea given that not every Linux distro system rolls with systemd and thus you cannot install snapd. The update feature could piggy back off of each's respective update mechanism. For now I'm going to focus on the snap because I know what's up with that, but we could tack on AppImage in another pull request.

@jichengyuan
Copy link

Symbolic link could be a temporary solution for sync files:

sudo ln -s /path/to/your/sync/db.json /defaultPath/to/masscode

@xela92
Copy link
Author

xela92 commented Jul 27, 2022

Symbolic link could be a temporary solution for sync files:

sudo ln -s /path/to/your/sync/db.json /defaultPath/to/masscode

As stated in the OP, another workaround is to manually specify the path from the file picker UI (CTRL+L), the file is being created on the destination folder

@hobbesjaap
Copy link

I'm getting a similar error to @xela92 which is apparently related to snap issues with Electron. I second the desire for an AppImage (or Flathub, which works great). Running on Manjaro Linux over here, so have access to the AUR but nobody is posting MassCode anywhere, it's a standalone snap file or nothing. I love the app (use it on my Mac) and would love to use it on my Linux box too!

@antonreshetov
Copy link
Member

It is not a problem to just specify the target for the build as an AppImage, the problem is that I can not run AppImage in Ubuntu virtualization, I just get a blank application screen, while .snap works. This is the reason why I'm shipping the build in .snap. #100 (comment)

@hobbesjaap
Copy link

hobbesjaap commented Aug 14, 2022 via email

@0x4E0x650x6F
Copy link

I cant access any location in the home folder, even with the appImage build.

screenshot_20230209_172529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed linux
Projects
None yet
Development

No branches or pull requests

8 participants