legacyO7 / Aurora

A utility to control RGB keyboard back-light and charging threshold for Asus TUF-gaming laptops
MIT License
48 stars 3 forks source link

Application unable to detect polkit installation #9

Closed atharvtiwari closed 1 year ago

atharvtiwari commented 1 year ago

Polkit is installed on the system as checked by running command -v pkexec locally.

pkexec

However, running the appimage/building and running fails to detect the polkit installation by running the above command

To Reproduce Steps to reproduce the behaviour:

  1. Run the appimage
  2. polkit is missing

aurora_appimage

OR

  1. Build and run using instructions in the README
  2. polkit is missing

aurora_build

Expected behaviour Program detects polkit installation and launches into the main interface.

Laptop Specifications

Attaching flutter doctor -v and flutter run -v outputs

doctor.log

run.log

atharvtiwari commented 1 year ago

This issue can temporarily be fixed by changing 'command -v pkexec' in terminal_delegate_impl.dart to 'which pkexec', but this results in another application breaking error, which i think is unrelated to the change. But i'm not sure, i've never worked with flutter before.

Should i open another issue regarding the errors i get following the change?

legacyO7 commented 1 year ago

This issue can temporarily be fixed by changing 'command -v pkexec' in terminal_delegate_impl.dart to 'which pkexec',

Try changing the code to return !((await _terminalRepo.getOutput(command: 'type pkexec')).toString().contains('not found'));

but this results in another application breaking error, which i think is unrelated to the change. But i'm not sure, i've never worked with flutter before.

Should i open another issue regarding the errors i get following the change?

Please add all the bugs in one issue as it's easy to track. This project is only tested in fedora linux, so its behavior on other distros is unpredicted

atharvtiwari commented 1 year ago

After updating as advised and running flutter clean followed by flutter run

Output Screenshot aurora_1

Console Error run.log

[ +605 ms] flutter: > stdinp $ type pkexec
[  +22 ms] flutter: STDERR: ProcessException: No such file or directory
[        ]   Command: type pkexec
[+1069 ms] flutter: > stdinp $ chmod +x /tmp/legacy07.aurora/battery_manager.sh
[ +154 ms] flutter: > stdinp $ chmod +x /tmp/legacy07.aurora/mainline_controller.sh
[   +2 ms] 
           ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
           The following assertion was thrown during layout:
           A RenderFlex overflowed by 6.7 pixels on the bottom.

           The relevant error-causing widget was:
             Column
             Column:file:///data/atharv/repos/Aurora/lib/user_interface/home/presentation/screens/widgets/home_top_bar.dart:18:18

           To inspect this widget in Flutter DevTools, visit:
           http://127.0.0.1:9101/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A35179%2FX8nyU1U8sCM%3D%2F&inspectorRef=inspector-0

           The overflowing RenderFlex has an orientation of Axis.vertical.
           The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
           black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
           Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
           RenderFlex to fit within the available space instead of being sized to their natural size.
           This is considered an error condition because it indicates that there is content that cannot be
           seen. If the content is legitimately bigger than the available space, consider clipping it with a
           ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
           like a ListView.
           The specific RenderFlex in question is: RenderFlex#a9b1e relayoutBoundary=up7 OVERFLOWING:
             creator: Column ← Expanded ← Row ← HomeTopBar ← Expanded ← Column ← Listener ← _GestureSemantics ←
               RawGestureDetector ← GestureDetector ← _MoveWindow ← MoveWindow ← ⋯
             parentData: offset=Offset(333.3, 0.0); flex=1; fit=FlexFit.tight (can use size)
             constraints: BoxConstraints(w=333.3, 0.0<=h<=113.3)
             size: Size(333.3, 113.3)
             direction: vertical
             mainAxisAlignment: start
             mainAxisSize: max
             crossAxisAlignment: center
             verticalDirection: down
           ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
           ════════════════════════════════════════════════════════════════════════════════════════════════════
[   +1 ms] flutter: > stdinp $ /tmp/legacy07.aurora/permission_checker.sh /sys/class/leds/asus::kbd_backlight/kbd_rgb_state
[  +14 ms] flutter: > stdout true
[   +7 ms] flutter: > stdinp $ /tmp/legacy07.aurora/permission_checker.sh /sys/class/leds/asus::kbd_backlight/kbd_rgb_mode
[  +29 ms] flutter: > stdout true
[   +2 ms] flutter: > stdinp $ /tmp/legacy07.aurora/permission_checker.sh /sys/class/leds/asus::kbd_backlight/brightness
[  +20 ms] flutter: > stdout true
[ +292 ms] flutter: > stdinp $ /tmp/legacy07.aurora/mainline_controller.sh brightness 1
[  +62 ms] [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
[        ] #0      KeyboardSettingsRepoImpl.setMainlineModeParams (package:aurora/user_interface/control_panel/domain/keyboard_settings/keyboard_settings_repo_impl.dart:35:80)
[        ] #1      KeyboardSettingsBloc._setMainlineModeParams (package:aurora/user_interface/control_panel/presentation/state/keyboard_settings/keyboard_settings_bloc.dart:73:29)
[        ] #2      KeyboardSettingsBloc._initPanel (package:aurora/user_interface/control_panel/presentation/state/keyboard_settings/keyboard_settings_bloc.dart:36:13)
[        ] <asynchronous suspension>
[        ] #3      Bloc.on.<anonymous closure>.handleEvent (package:bloc/src/bloc.dart:226:13)
[        ] <asynchronous suspension>
[  +27 ms] 
           Another exception was thrown: Null check operator used on a null value
[   +6 ms] 
           Another exception was thrown: Null check operator used on a null value
[   +9 ms] 
           Another exception was thrown: Null check operator used on a null value

However, running /tmp/legacy07.aurora/mainline_controller.sh brightness 1 works as intended.

legacyO7 commented 1 year ago

try the canary branch and see if this problem persists

atharvtiwari commented 1 year ago

Same error after changing pkexecChecker() to

return !((await _terminalRepo.getOutput(command: 'type pkexec')).toString().contains('not found'));

Output

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
#0      KeyboardSettingsRepoImpl.setMainlineModeParams (package:aurora/user_interface/control_panel/domain/keyboard_settings/keyboard_settings_repo_impl.dart:35:80)
#1      KeyboardSettingsBloc._setMainlineModeParams (package:aurora/user_interface/control_panel/presentation/state/keyboard_settings/keyboard_settings_bloc.dart:73:29)
#2      KeyboardSettingsBloc._initPanel (package:aurora/user_interface/control_panel/presentation/state/keyboard_settings/keyboard_settings_bloc.dart:36:13)
<asynchronous suspension>
#3      Bloc.on.<anonymous closure>.handleEvent (package:bloc/src/bloc.dart:226:13)
<asynchronous suspension>

Another exception was thrown: Null check operator used on a null value

Another exception was thrown: Null check operator used on a null value

Another exception was thrown: Null check operator used on a null value

Not editing pkexecChecker() gives the old polkit is missing error

Output

[   +3 ms] flutter: > stdinp $ mokutil --sb-state
[ +101 ms] flutter: > stdout SecureBoot disabled
[        ] flutter: > stdout Platform is in Setup Mode
[  +45 ms] flutter: > stdinp $ chmod +x /tmp/legacy07.aurora/permission_checker.sh
[ +166 ms] flutter: > stdinp $ type pkexec
[   +8 ms] flutter: STDERR: ProcessException: No such file or directory
[        ]   Command: type pkexec
legacyO7 commented 1 year ago

Polkit is installed by default on all major linux distros, so this check isnt important and can be avoided.

pull the latest commits from canary and run again

atharvtiwari commented 1 year ago

That seems to have fixed it!

There is still a minor UI bug, i think?

aurora_fixed

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY
           ╞═════════════════════════════════════════════════════════
           The following assertion was thrown during layout:
           A RenderFlex overflowed by 6.7 pixels on the bottom.

           The relevant error-causing widget was:
             Column

Column:file:///data/atharv/repos/Aurora/lib/user_interface/home/presentat
             ion/screens/widgets/home_top_bar.dart:18:18

           To inspect this widget in Flutter DevTools, visit:

http://127.0.0.1:9100/#/inspector?uri=http%3A%2F%2F127.0.0.1%3A36611%2FX35M
           kcXxpG0%3D%2F&inspectorRef=inspector-0

           The overflowing RenderFlex has an orientation of Axis.vertical.
           The edge of the RenderFlex that is overflowing has been marked
in the
           rendering with a yellow and
           black striped pattern. This is usually caused by the contents
being too big
           for the RenderFlex.
           Consider applying a flex factor (e.g. using an Expanded widget)
to force
           the children of the
           RenderFlex to fit within the available space instead of being
sized to
           their natural size.
           This is considered an error condition because it indicates that
there is
           content that cannot be
           seen. If the content is legitimately bigger than the available
space,
           consider clipping it with a
           ClipRect widget before putting it in the flex, or using a
scrollable
           container rather than a Flex,
           like a ListView.
           The specific RenderFlex in question is: RenderFlex#ba51b
           relayoutBoundary=up7 OVERFLOWING:
             creator: Column ← Expanded ← Row ← HomeTopBar ← Expanded ←
Column ←
             Listener ← _GestureSemantics ←
               RawGestureDetector ← GestureDetector ← _MoveWindow ←
MoveWindow ← ⋯
             parentData: offset=Offset(333.3, 0.0); flex=1;
fit=FlexFit.tight (can use
             size)
             constraints: BoxConstraints(w=333.3, 0.0<=h<=113.3)
             size: Size(333.3, 113.3)
             direction: vertical
             mainAxisAlignment: start
             mainAxisSize: max
             crossAxisAlignment: center
             verticalDirection: down

◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢
           ◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤

═══════════════════════════════════════════════════════════════════════════
           ═════════════════════════

I'd just managed to get faustus working on my laptop, with help from your fork, but i guess i won't be needing it, thanks

legacyO7 commented 1 year ago

Close #9

commits (https://github.com/legacyO7/Aurora/commit/90583c4c94b65d720f7c108e17f3ca9f76b3d30b) (https://github.com/legacyO7/Aurora/commit/868e308c4e54de5523494443dac8cf9622935c99) fixes this issue