Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Polkit doesn't load rules.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
guanzd88
n00b
n00b


Joined: 17 Feb 2024
Posts: 5

PostPosted: Sat Feb 24, 2024 3:33 pm    Post subject: [Solved] Polkit doesn't load rules. Reply with quote

Hi there,

I am currently figure out how to make polkit loading rules properly. Here is the thing:
1. Thunar give notification "Not authorized to perform operation" when I was mounting USB to media folder. And also, reboot with non-root account is not allowed. Therefore, I created polkit rules manually. Here are rules I created:

Code:


#/etc/polkit-1/rules.d/10-admin.rules

polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});



10-admin.rules is aiming at giving authorization on rebooting and shutdown with non-root accounts.

Code:

#/etc/polkit-1/rules.d/10-udisks.rules
polkit.addRule(function(action, subject) {
    if (action.id == "org.freedesktop.udisks2.filesystem-mount" &&
        subject.user == "guanzd") {
        return polkit.Result.YES;
    }
});

10-udisks.rules is aiming at giving authorization on mounting with non-root accounts.

After adding these two rule files, I rebooted immediately.


2. Since I got a failure on adding rules, I therefore put my emphasis on re-compilation related packages and their USE flags.
At this stage, I got my first failure on updating the @world. Here is the output from command ` sudo emerge -auvDN @world`:
https://pastebin.com/nDV6RUzM

here is my make.conf:
Code:
# /usr/share/portage/config/make.conf.example

# GCC
CFLAGS="-march=haswell -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
MAKEOPTS="-j15"

# USE
SUPPORT="pulseaudio btrfs mtp git udev alsa dist-kernel gtk gtk2 gtk3 samba udisks mtp ios afp policykit systemd"
DESKTOP="infinality emoji cjk"
FUCK="-consolekit"
ELSE="client icu sudo python suid dbus X"

USE="${SUPPORT} ${DESKTOP} ${FUCK} ${ELSE}"

# Portage
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
# GENTOO_MIRRORS="https://mirrors.tuna.tsinghua.edu.cn/gentoo/"
GENTOO_MIRRORS="https://mirrors.ustc.edu.cn/gentoo/"
EMERGE_DEFAULT_OPTS="--ask --verbose=y --keep-going --with-bdeps=y --load-average"
# FEATURES="${FEATURES} -userpriv -usersandbox -sandbox"
PORTAGE_REPO_DUPLICATE_WARN="0"
# PORTAGE_TMPDIR="/var/tmp/notmpfs"

PORTDIR_OVERLAY=/usr/local/portage

ACCEPT_KEYWORDS="~amd64"
ACCEPT_LICENSE="*"

# Language
L10N="en-US zh-CN en zh"
LINGUAS="en_US zh_CN en zh"

# Else
INPUT_DEVICES="libinput synaptics"

VIDEO_CARDS="nvidia"

RUBY_TARGETS="ruby24 ruby25"

LLVM_TARGETS="X86"

QEMU_SOFTMMU_TARGETS="alpha aarch64 arm i386 mips mips64 mips64el mipsel ppc ppc64 s390x sh4 sh4eb sparc sparc64 x86_64"
QEMU_USER_TARGETS="alpha aarch64 arm armeb i386 mips mipsel ppc ppc64 ppc64abi32 s390x sh4 sh4eb sparc sparc32plus sparc64"
# ABI_X86="64 32"

I have tried to solve the dependency issues by changing the configuration of USE flags in make.conf, but failed with unsolvable dependency. (If you really need more information about it let me know, THX)
3. Installing mate-polkit doesn't solve my issue.

4. Other information which may provide helps:

[*] polkit-daemon is loaded. Here is the prove:
Code:

   1631 ?        Ssl    0:00 /usr/lib/polkit-1/polkitd --no-debug
  66720 pts/3    S+     0:00 grep --color=auto polkit


[*] I was running gentoo with systemd
[*] Here is the system log

Code:

# journalctl -b |grep "polkit"

Feb 24 21:20:29 gentoo dbus-daemon[640]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service' requested by ':1.2' (uid=0 pid=651 comm="/usr/sbin/NetworkManager --no-daemon")
Feb 24 21:20:29 gentoo systemd[1]: Starting polkit.service...
Feb 24 21:20:29 gentoo polkitd[1631]: Started polkitd version 124
Feb 24 21:20:29 gentoo polkitd[1631]: Loading rules from directory /etc/polkit-1/rules.d
Feb 24 21:20:29 gentoo polkitd[1631]: Loading rules from directory /usr/share/polkit-1/rules.d
Feb 24 21:20:29 gentoo polkitd[1631]: Finished loading, compiling and executing 6 rules
Feb 24 21:20:29 gentoo systemd[1]: Started polkit.service.
Feb 24 21:20:29 gentoo polkitd[1631]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
Feb 24 22:55:50 gentoo sudo[58293]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/usr/bin/vim /etc/polkit-1/rules.d/10-admin.rules
Feb 24 22:57:02 gentoo sudo[58560]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/bin/cat /etc/polkit-1/rules.d/10-admin.rules
Feb 24 22:57:35 gentoo sudo[58787]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/bin/cat /etc/polkit-1/rules.d/10-admin.rules
Feb 24 22:57:51 gentoo sudo[58895]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/bin/cat /etc/polkit-1/rules.d/10-admin.rules
Feb 24 22:59:13 gentoo sudo[60850]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/usr/bin/xclip /etc/polkit-1/rules.d/10-admin.rules
Feb 24 22:59:33 gentoo sudo[60966]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/usr/bin/xclip -sel clip /etc/polkit-1/rules.d/10-admin.rules
Feb 24 23:01:42 gentoo sudo[61307]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/usr/bin/xclip -sel clip /etc/polkit-1/rules.d/10-
Feb 24 23:02:09 gentoo sudo[61431]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/bin/ls /etc/polkit-1/rules.d/10-
Feb 24 23:02:11 gentoo sudo[61450]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/bin/ls /etc/polkit-1/rules.d/
Feb 24 23:02:22 gentoo sudo[61502]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/bin/ls /etc/polkit-1/rules.d/10-udisks.rules
Feb 24 23:02:43 gentoo sudo[61571]:   guanzd : TTY=pts/3 ; PWD=/home/guanzd ; USER=root ; COMMAND=/usr/bin/xclip -sel clip /etc/polkit-1/rules.d/10-udisks.rules



PS: If you need other information, please let me know. Thanks a lot!


Last edited by guanzd88 on Sun Feb 25, 2024 10:03 am; edited 1 time in total
Back to top
View user's profile Send private message
guanzd88
n00b
n00b


Joined: 17 Feb 2024
Posts: 5

PostPosted: Sun Feb 25, 2024 10:03 am    Post subject: Reply with quote

I have solved it by fixing USE Flags issues with re-compilation.

Thanks for all of you!
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21637

PostPosted: Sun Feb 25, 2024 4:43 pm    Post subject: Reply with quote

What USE flags did you change to fix this?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum