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]: AppArmor denies access to org.freedesktop.DBus.Introspectable (installed via snap) #1466

Open
5 tasks done
ptandler opened this issue Jul 19, 2024 · 16 comments
Open
5 tasks done

Comments

@ptandler
Copy link

Version

  • I'm using version 1.15.1

Known issues

  • I've checked Known issues

Existing issues

  • I've checked Existing issues

Advanced Preferences

  • I've checked Advanced Preferences

What operating system are you using?

Linux

Operating System Version

Ubuntu 22.04.4 LTS, KDE Framework 5.92.0, QT 5.15.5, Kernel 6.5.0-1025-oem

Reproduction steps

I installed strechtly via ubuntu snap and looked at syslog

Expected Behavior

Permissions are setup correctly - or I get I hint what I need to configure

Actual Behavior

Every second I see this message in the logs:

apparmor="DENIED"` operation="dbus_method_call"  bus="session" path="/org/freedesktop/Notifications" interface="org.freedesktop.DBus.Introspectable" member="Introspect" mask="send" name="org.freedesktop.Notifications" pid=5545 label="snap.stretchly.stretchly" peer_pid=5290 peer_label="unconfined"

Relevant log output

breakPlanner: {reference: startMicrobreakNotification,
            timeleft: 1 Minute 21 Sekunden verbleibend,
            breakNumber: 1,
            postponesNumber: 0,
            Do Not Disturb: false}
            
            settingsFile: /home/ptandler/snap/stretchly/47/.config/Stretchly/config.json
            
            logsFile:  /home/ptandler/snap/stretchly/47/.config/Stretchly/logs/main.log
            Node.js: 18.17.1
            Chromium: 118.0.5993.144,
            Electron: 27.1.0

Preferences

{
	"microbreakDuration": 20000,
	"microbreakInterval": 900000,
	"breakDuration": 180000,
	"breakInterval": 3,
	"breakNotification": true,
	"microbreakNotification": true,
	"breakNotificationInterval": 30000,
	"microbreakNotificationInterval": 10000,
	"microbreak": true,
	"break": true,
	"microbreakStrictMode": false,
	"breakStrictMode": false,
	"morningHour": 6,
	"microbreakPostpone": true,
	"breakPostpone": true,
	"microbreakPostponeTime": 120000,
	"breakPostponeTime": 300000,
	"microbreakPostponesLimit": 1,
	"microbreakPostponableDurationPercent": 30,
	"breakPostponesLimit": 1,
	"breakPostponableDurationPercent": 30,
	"mainColor": "#1D1F21",
	"miniBreakColor": "#1D1F21",
	"transparentMode": false,
	"opacity": 0.9,
	"audio": "crystal-glass",
	"miniBreakAudio": "crystal-glass",
	"volume": 1,
	"fullscreen": true,
	"ideas": true,
	"naturalBreaks": true,
	"naturalBreaksInactivityResetTime": 300000,
	"allScreens": true,
	"useIdeasFromSettings": false,
	"language": "de",
	"notifyNewVersion": true,
	"isFirstRun": false,
	"posLatitude": 0,
	"posLongitude": 0,
	"useMonochromeTrayIcon": false,
	"useMonochromeInvertedTrayIcon": false,
	"silentNotifications": false,
	"monitorDnd": true,
	"microbreakStartSoundPlaying": false,
	"breakStartSoundPlaying": false,
	"themeSource": "system",
	"endBreakShortcut": "CmdOrCtrl+X",
	"breakWindowWidth": 0.85,
	"breakWindowHeight": 0.85,
	"checkNewVersion": true,
	"breakIdeas": [
		{
			"data": [
				"Not alone",
				"Do you find it hard to take a break alone? Try to do it with a co-worker. Aside from making it easier to stick to breaks, you will have a chance to get to know them better. Taking breaks together increases productivity."
			],
			"enabled": true
		},
		{
			"data": [
				"Step away",
				"Do you ever notice how your brain can figure things out by itself? All it takes is to step away from the computer and take a break to think about something totally unrelated."
			],
			"enabled": true
		},
		{
			"data": [
				"Microbreaks",
				"Rest is a key component in ensuring the performance of the musculoskeletal system. Frequent breaks can decrease the duration of a task and help lower the exposure to ergonomic injury risk."
			],
			"enabled": true
		},
		{
			"data": [
				"Meditation",
				"Research studies suggest that mindfulness-based exercises help decrease anxiety, depression, stress, and pain, and help improve general health, mental health, and quality of life. Not sure how to start? There are numerous apps to help you out."
			],
			"enabled": true
		},
		{
			"data": [
				"Blink",
				"Looking at screens for a long time causes you to blink less, thus exposing your eyes to the air. Blink rapidly for a few seconds to refresh the tear film and clear dust from the eye surface."
			],
			"enabled": true
		},
		{
			"data": [
				"Ergonomics",
				"Improper height and angle of the keyboard, mouse, monitor or working surface can cause health problems. Take some time to read about desk ergonomics."
			],
			"enabled": true
		},
		{
			"data": [
				"Move",
				"There are a lot of ways you can exercise within your office. Try marching in place or doing desk push-ups."
			],
			"enabled": true
		},
		{
			"data": [
				"Change",
				"Do you have a stability ball or standing work desk? Consider replacing your desk chair with them for a while."
			],
			"enabled": true
		},
		{
			"data": [
				"Notice",
				"Are you daydreaming or having trouble focusing? It is a sign that you need to take a break."
			],
			"enabled": true
		},
		{
			"data": [
				"Tech",
				"How about taking a no-tech walk?"
			],
			"enabled": true
		},
		{
			"data": [
				"Metabolism",
				"Emerging research shows that sitting for long periods of time contributes to risk of metabolic syndrome, heart attack and stroke risk and overall death risk, among others. Taking regular walking breaks can help your circulation, working to counteract some of those problems."
			],
			"enabled": true
		},
		{
			"data": [
				"Active Meetings",
				"How about moving meetings from the conference room to the concourse? Walking not only burns calories but it may even foster a sense of collaboration."
			],
			"enabled": true
		},
		{
			"data": [
				"Fruit",
				"Take your time and eat some fruit. Slowly. Notice the flavor, the texture, the freshness."
			],
			"enabled": true
		},
		{
			"data": [
				"Bathrooms",
				"Walk to the farthest bathroom in the worksite facility when going to the restroom."
			],
			"enabled": true
		},
		{
			"data": [
				"Coffee break",
				"Going on coffee break? Consider doing a 5-minute walk every time you go for one."
			],
			"enabled": true
		},
		{
			"data": [
				"Colleagues",
				"Do not email or message office colleagues, walk to their desks to communicate with them."
			],
			"enabled": true
		},
		{
			"data": [
				"Learning",
				"In a study of healthy volunteers, NIH researchers found that taking short breaks, early and often, may help our brains learn new skills."
			],
			"enabled": true
		},
		{
			"data": [
				"Exercise",
				"Evidence suggests small amounts of regular exercise can bring dramatic health benefits, including measurably reducing stress."
			],
			"enabled": true
		},
		{
			"data": [
				"Repeat",
				"Have you found your stretch-ly-routine? Do not forget to repeat it for more than once to better fight effects of prolonged sitting."
			],
			"enabled": true
		},
		{
			"data": [
				"Wrist and forearm",
				"Extend your arms with the palms facing towards you, then slowly rotate the hands four times clockwise, then four times counter-clockwise."
			],
			"enabled": true
		},
		{
			"data": [
				"Back stretching",
				"Join your hands behind your head, then lift them together up above your head ending with your palms facing upward."
			],
			"enabled": true
		},
		{
			"data": [
				"Mobilize",
				"For every thirty minutes of stagnation, you should have at least one minute of stimulation."
			],
			"enabled": true
		},
		{
			"data": [
				"7 Minute Workout",
				"This workout packs in a full-body exercise routine in a fraction of the time. But as with any exercise, be careful. There are numerous apps to get you started."
			],
			"enabled": true
		},
		{
			"data": [
				"Pulse",
				" Raise your pulse rate to 120 beats per minute for 20 straight minutes four or five times a week doing anything you enjoy. Regularly raising your heart rate results in improved cardiovascular health."
			],
			"enabled": true
		},
		{
			"data": [
				"Take the stairs ",
				"Studies have shown that stair climbing, which is considered vigorous-intensity physical activity, burns more calories per minute than jogging."
			],
			"enabled": true
		},
		{
			"data": [
				"Make art",
				"Art therapy is known to have great mental health benefits, especially when it comes to stress management. How about writing a quick poem, taking a picture or painting something small?"
			],
			"enabled": true
		},
		{
			"data": [
				"Declutter",
				"A clean space helps your focus at work and is often linked to positive emotions like happiness."
			],
			"enabled": true
		},
		{
			"data": [
				"Lunch outside",
				"Nature is linked to positive emotions and decreased stress and anxiety. Whenever possible, try to take your daily lunch break outside, surrounded by some greenery."
			],
			"enabled": true
		},
		{
			"data": [
				"Public transport",
				"If you use public transport regularly, you can stand instead of sitting. If it is possible, try to replace as many of your daily trips as possible with walking or cycling."
			],
			"enabled": true
		},
		{
			"data": [
				"Yawning",
				"Yawning can be really helpful, as it produces tears to help moisten and lubricate the eyes."
			],
			"enabled": true
		},
		{
			"data": [
				"Focus change",
				"Hold one finger close to the eye and focus on it. Slowly move the finger away, focus far into the distance and then back to the finger. Bring the finger back and focus on something far away."
			],
			"enabled": true
		},
		{
			"data": [
				"Palming",
				"While seated, brace elbows on the desk and close to the desk edge. Let your weight fall forward and cup hands over eyes. Close your eyes and inhale slowly through nose and hold for few seconds. Continue deep breathing."
			],
			"enabled": true
		},
		{
			"data": [
				"Hand squeezes",
				"Squeeze a pair of balled-up socks or a soft rubber ball, hold for 5 seconds. Repeat whole process a few times."
			],
			"enabled": true
		},
		{
			"data": [
				"Slow Breathing",
				"Emerging research suggests potential for use of controlled slow breathing techniques as a means of optimising physiological parameters that appear to be associated with health and longevity."
			],
			"enabled": true
		},
		{
			"data": [
				"Imaginative visualization",
				"Close your eyes and imagine yourself in a peaceful and calming place, such as a beach or a forest, focusing on the sights, sounds, and sensations of that environment."
			],
			"enabled": true
		}
	],
	"microbreakIdeas": [
		{
			"data": "Go grab a glass of water.",
			"enabled": true
		},
		{
			"data": "Slowly look all the way left, then right.",
			"enabled": true
		},
		{
			"data": "Slowly look all the way up, then down.",
			"enabled": true
		},
		{
			"data": "Close your eyes and take few deep breaths.",
			"enabled": true
		},
		{
			"data": "Close your eyes and relax.",
			"enabled": true
		},
		{
			"data": "Stretch your legs.",
			"enabled": true
		},
		{
			"data": "Stretch your arms.",
			"enabled": true
		},
		{
			"data": "Is your sitting posture correct?",
			"enabled": true
		},
		{
			"data": "Slowly turn head to side and hold for 10 seconds.",
			"enabled": true
		},
		{
			"data": "Slowly tilt head to side and hold for 5-10 seconds.",
			"enabled": true
		},
		{
			"data": "Stand from your chair and stretch.",
			"enabled": true
		},
		{
			"data": "Refocus your eyes on an object at least 20 meters away.",
			"enabled": true
		},
		{
			"data": "Take a moment to think about something you appreciate.",
			"enabled": true
		},
		{
			"data": "Take a moment to smile at being alive.",
			"enabled": true
		},
		{
			"data": "A truly ergonomic workstation is one that you regularly push away from.",
			"enabled": true
		},
		{
			"data": "Close your eyes and count your breaths.",
			"enabled": true
		},
		{
			"data": "Close your eyes and name the things you hear.",
			"enabled": true
		},
		{
			"data": "Place your fingertips on your shoulders. Roll your shoulders forward for 10 seconds, then backward.",
			"enabled": true
		},
		{
			"data": "Raise your right arm, stretch it over your head to the left, and hold for 10 seconds. Repeat on the other side.",
			"enabled": true
		},
		{
			"data": "With your right hand, grab each finger of your left hand in turn and squeeze. Repeat on the other side.",
			"enabled": true
		},
		{
			"data": "Stand up and do a lunge. Hold for 10 seconds, then do the other leg.",
			"enabled": true
		},
		{
			"data": "Close your eyes and simply notice whatever arises in current moment, without judgement.",
			"enabled": true
		},
		{
			"data": "Focus every 20 minutes for 20 seconds on an object at 20 feet distance.",
			"enabled": true
		},
		{
			"data": "If you need help, ask for it.",
			"enabled": true
		},
		{
			"data": "Do one thing at a time.",
			"enabled": true
		},
		{
			"data": "Is your attention spent wisely?",
			"enabled": true
		},
		{
			"data": "Change your sitting posture.",
			"enabled": true
		},
		{
			"data": "Expose your eyes to natural light.",
			"enabled": true
		},
		{
			"data": "With your eyes closed, slowly and gently raise your eyes to the ceiling and back down to the floor.",
			"enabled": true
		},
		{
			"data": "With your eyes closed, slowly and gently move your eyes to the left, then slowly to the right.",
			"enabled": true
		},
		{
			"data": "Shake your hands out to get some relief.",
			"enabled": true
		},
		{
			"data": "One at a time, touch the tip of each finger to the tip of your thumb so they make an O-shape.",
			"enabled": true
		},
		{
			"data": "Make a fist and then slide your fingers up until they point toward the ceiling, like you're telling someone to stop.",
			"enabled": true
		},
		{
			"data": "Make a fist and then fan your fingers out and stretch them as far as you can.",
			"enabled": true
		},
		{
			"data": "Sit tall, arms hanging at your sides, and slowly rotate neck in one direction in a large circle.",
			"enabled": true
		},
		{
			"data": "Stand tall and slowly tilt your head toward the shoulder using the same hand until you feel a stretch.",
			"enabled": true
		},
		{
			"data": "Stand tall with your arms by your side. Squeeze your shoulder blades together and hold.",
			"enabled": true
		},
		{
			"data": "Stand tall with your arms raised along your shoulders. Move hands slightly behind your back, hold for a second and return.",
			"enabled": true
		},
		{
			"data": "Sit on the edge of your chair, twist your torso to one side and hold for 10-15 seconds. Repeat on the other side.",
			"enabled": true
		},
		{
			"data": "Stand up and put one foot on a nearby object, like a chair or step stool. Keep your knee bent and hold for 10-15 seconds. Repeat with the other foot.",
			"enabled": true
		},
		{
			"data": "Stand with your feet shoulder-width apart, lower your body down as if you were sitting back into a chair, then stand back up. Repeat several times.",
			"enabled": true
		},
		{
			"data": "Stand with your back and hands on a wall, then slowly move your arms up and down as if you were making snow angels.",
			"enabled": true
		},
		{
			"data": "Stand facing a wall and place your hands on it, then do several push-ups.",
			"enabled": true
		},
		{
			"data": "Sit on the edge of your chair and extend one leg straight out in front of you, holding for 10-15 seconds. Repeat with the other leg.",
			"enabled": true
		},
		{
			"data": "Stand facing a wall, put one foot back and the other foot forward, then lean into the wall. Repeat with the other leg.",
			"enabled": true
		},
		{
			"data": "Hold one arm straight up, then use the other arm to gently push the elbow of the first arm towards your head. Hold for 10-15 seconds. Repeat with the other arm.",
			"enabled": true
		},
		{
			"data": "Tilt your head to one side, then to the other side, and then gently tilt it forward and backward.",
			"enabled": true
		},
		{
			"data": "Reach one arm across your chest, hold onto the elbow with the other hand, and gently pull it in towards your chest. Repeat with the other arm.",
			"enabled": true
		},
		{
			"data": "Stand up, put one foot on a nearby object, like a chair or step stool, and reach down to touch your toes. Repeat with the other leg.",
			"enabled": true
		},
		{
			"data": "Stand in a doorway and place one arm on each side of the doorway, then gently lean forward until you feel a stretch in your chest.",
			"enabled": true
		},
		{
			"data": "Sit on the edge of a chair or on the floor, and place the soles of your feet together, gently pressing down with your elbows to stretch your inner thighs.",
			"enabled": true
		}
	],
	"showBreaksAsRegularWindows": false,
	"appExclusions": [],
	"appExclusionsCheckInterval": 1000,
	"pauseForSuspendOrLock": true,
	"pauseBreaksToggleShortcut": "",
	"screen": "primary",
	"timeToBreakInTray": false,
	"currentTimeInBreaks": false,
	"showTrayIcon": true,
	"skipToNextScheduledBreakShortcut": "",
	"skipToNextMiniBreakShortcut": "",
	"skipToNextLongBreakShortcut": "",
	"resetBreaksShortcut": "",
	"__internal__": {
		"migrations": {
			"version": "1.15.1"
		}
	}
}

Additional information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@hovancik
Copy link
Owner

hovancik commented Jul 19, 2024

Hi @ptandler and thanks for the report. I am using DBUS for checking if system is in Do not disturb mode, but not the one that your logs suggest, so not sure. (

async _isDndEnabledLinux () {
try {
const obj = await this.bus.getProxyObject('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
const properties = obj.getInterface('org.freedesktop.DBus.Properties')
const dndEnabled = await properties.Get('org.freedesktop.Notifications', 'Inhibited')
if (await dndEnabled.value) {
return true
}
} catch (e) {
// KDE is not running
}
try {
const obj = await this.bus.getProxyObject('org.xfce.Xfconf', '/org/xfce/Xfconf')
const properties = obj.getInterface('org.xfce.Xfconf')
const dndEnabled = await properties.GetProperty('xfce4-notifyd', '/do-not-disturb')
if (await dndEnabled.value) {
return true
}
} catch (e) {
// XFCE is not running
}
try {
const exec = this.util.promisify(require('node:child_process').exec)
const { stdout } = await exec('gsettings get org.gnome.desktop.notifications show-banners')
if (stdout.replace(/[^0-9a-zA-Z]/g, '') === 'false') {
return true
}
} catch (e) {
// Gnome / gsettings is not running
}
return false
}
)

Does DND monitoring works for you? If you enable DND, Stretchly icon in tray should change and you should see some message upon clicking it that breaks are paused.

@ptandler
Copy link
Author

Does DND monitoring works for you? If you enable DND, Stretchly icon in tray should change and you should see some message upon clicking it that breaks are paused.

No, this does not work. Nothing changes.

Also, I'm pretty sure that the detection of idle times does also not work on my machine.

I haven't had the need yet to understand how to configure Linux AppArmor. When I do sudo aa-status several /snap/strechly/... processes are listed under enforce mode - whatever this means.

Maybe I could try to install stretchly from a different source, not snap, and see what's happening then.

@hovancik
Copy link
Owner

Well to be honest I also have no idea what apparmor is and what it does. I am on Debian and installing via DEB package and all is fine for me.

@hovancik
Copy link
Owner

Seems like dbus needs to be added to plugs https://www.electron.build/configuration/snap.html, but I don't understand how that works https://snapcraft.io/docs/interface-management

@ptandler
Copy link
Author

I tried adjusting /var/lib/snapd/apparmor/profiles/snap.stretchly.stretchly but without success yet ... will install it from some other source for now.

==> Is there anyone out there who successfully uses stretchly installed via snap? 👋

@ptandler
Copy link
Author

Well to be honest I also have no idea what AppArmor is and what it does. I am on Debian and installing via DEB package and all is fine for me.

The AppArmor homepage says that also Debian ships with AppArmor. But I guess it doesn't use it for deb packages.

@hovancik
Copy link
Owner

Yeah I have apparmor on my Debian but it's not preventing anything. Looks like in Snap it does by default.

Found some related discussions:

@ptandler
Copy link
Author

I now installed from flathub and there DND detection works. At least a workaround.

@hovancik
Copy link
Owner

hovancik commented Jul 22, 2024

We could try building snap with node_modules/.bin/electron-builder --linux snap "-c.snap.plugs=['default', 'dbus']" and see if that helps with snap.

@ptandler
Copy link
Author

We could try building snap with node_modules/.bin/electron-builder --linux snap "-c.snap.plugs=['default', 'dbus']" and see if that helps with snap.

Interesting - let me know if you have a version I could try

@hovancik
Copy link
Owner

Can you try this? https://conta.noho.st/nextcloud/s/NjZYqToetLWaPF3
Can you also show output of snap interface dbus to see if Stretchly is there?

@ptandler
Copy link
Author

Thanks for creating the snap version! I installed and got a warning:

❯ snap warnings
last-occurrence:  today at 15:10 CEST
warning: |
  snap "stretchly" has bad plugs or slots: dbus (cannot find attribute 'bus')

❯ snap interface dbus
name:    dbus
summary: allows owning a specific name on DBus
slots:
  - firefox:dbus-daemon
  - keepassxc:session-dbus-interface
  - snap-store:packagekit-svc
  - snap-store:snap-store
  - snapd-desktop-integration:snapd-desktop-integration

Do you have an idea how to fix this? I found this documentation: https://snapcraft.io/docs/dbus-interface

@hovancik
Copy link
Owner

Well, I found people asking how to fix this but no answers: https://forum.snapcraft.io/t/snap-has-bad-plugs-or-slots-dbus-cannot-find-attribute-bus/38352, https://forum.snapcraft.io/t/guiscrcpy-install-error/15704

As for the documentation link, I am not editing any snap yml, as I don't have it in my code, I am using electron-builder: https://www.electron.build/configuration/snap

@hovancik
Copy link
Owner

Found some people using desktop instead of 'dbus' https://conta.noho.st/nextcloud/s/yD6NcPCrBoHybQz or bus https://conta.noho.st/nextcloud/s/w4neimLPMro7JJD

can you try those?

@ptandler
Copy link
Author

Thanks for creating new versions 😃

Stretchly_1.15.1_amd64-desktop.snap

Jul 30 08:56:01 P14s dbus-daemon[2708]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/org/freedesktop/Notifications" interface="org.freedesktop.DBus.Introspectable" member="Introspect" mask="send" name="org.freedesktop.Notifications" pid=11108 label="snap.stretchly.stretchly" peer_pid=3146 peer_label="unconfined"

Stretchly_1.15.1_amd64-bus.snap

❯ sudo snap install --dangerous Stretchly_1.15.1_amd64-bus.snap
2024-07-30T08:58:24+02:00 INFO snap "stretchly" has bad plugs or slots: bus (unknown interface "bus")
2024-07-30T08:58:25+02:00 INFO snap "stretchly" has bad plugs or slots: bus (unknown interface "bus")
stretchly 1.15.1 installed
WARNING: There are 2 new warnings. See 'snap warnings'.
❯ snap warnings
last-occurrence:  4 days ago, at 15:10 CEST
warning: |
  snap "stretchly" has bad plugs or slots: dbus (cannot find attribute 'bus')
---
last-occurrence:  today at 08:58 CEST
warning: |
  snap "stretchly" has bad plugs or slots: bus (unknown interface "bus")

And also:

Jul 30 09:00:14 P14s dbus-daemon[2708]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/org/freedesktop/Notifications" interface="org.freedesktop.DBus.Introspectable" member="Introspect" mask="send" name="org.freedesktop.Notifications" pid=13437 label="snap.stretchly.stretchly" peer_pid=3146 peer_label="unconfined"

So it seems, we have to keep trying ... very strange that there seems to be no documentation for a feature that should be pretty common.

@hovancik
Copy link
Owner

@ptandler I didn't change anything related to this in 1.16, but I wonder, is it still the same issue?

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

No branches or pull requests

2 participants