Opened 14 months ago
Last modified 13 months ago
#72663 assigned defect
xinit requires root privileges to install port, it doesn't need them.
| Reported by: | nickpapadonis (Nick Papadonis) | Owned by: | jeremyhu (Jeremy Huddleston Sequoia) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | Cc: | ||
| Port: | xinit |
Description
port install xinit
fails trying to install items to /Library for LaunchD
I tried editing the GitHub latest Portfile to remove the code installing launchd during activate, then 'port uninstall' , then 'port install' however it still tries to install items as root for launchd.
It's my understanding this port should be able to install non-root. I typically use 'xinit' or 'startx' from the command line to launch X.
Found this when trying to 'port install xorg' without root privileges.
Attachments (3)
Change History (16)
Changed 14 months ago by nickpapadonis (Nick Papadonis)
| Attachment: | macports-xinit.diff added |
|---|
comment:1 Changed 14 months ago by nickpapadonis (Nick Papadonis)
added a quick hack to get xinit to compile, looking to find guidance on the correct non-root solution here that still preserves the ability to update launchd. Is there a way to launch xinit on a per user bases instead of placing it system wide?
comment:2 Changed 14 months ago by nickpapadonis (Nick Papadonis)
I can confirm, boiling xorg and quartz-wm that working X server does not depend on root. I built and installed all as an unprivileged user using above diff.
comment:3 Changed 14 months ago by nickpapadonis (Nick Papadonis)
I can launch an xterm using xinit to start the server, startx has the following errors using this change. Trying to debug why it hangs.
% startx font_cache: Scanning user font directories to generate X11 font caches font_cache: Updating FC cache "/usr/local/share/fonts": Permission denied font_cache: Done xauth: file /Users/mp0/.serverauth.46858 does not exist waiting for X server to begin accepting connections . .^C.^C .^C. ..
comment:4 Changed 14 months ago by nickpapadonis (Nick Papadonis)
in startx remove
unset X11_PREFS_DOMAIN before 'xinit' exec allows X to start. Still debugging this...
comment:5 Changed 14 months ago by nickpapadonis (Nick Papadonis)
If I customize the Applications menu, the changes still take effect if X11_PREFS_DOMAIN in unset. I think this has something to do with removing launchd activation as root in xinit. Looking for a maintainer to add to this.
comment:6 Changed 14 months ago by nickpapadonis (Nick Papadonis)
Apologies, I'll try this again, --without-startupitems option to macports-base may be required. Curious what the advantages are using LaunchD vs starting as a startup item for the user.
comment:7 Changed 14 months ago by jmroot (Joshua Root)
I don't know how the xinit port could work correctly without /Library/LaunchDaemons/org.macports.privileged_startx.plist, which needs to be loaded as root.
comment:8 Changed 14 months ago by jmroot (Joshua Root)
| Keywords: | non root removed |
|---|---|
| Milestone: | MacPorts 2.11.0 |
| Owner: | set to jeremyhu |
| Status: | new → assigned |
comment:9 Changed 14 months ago by nickpapadonis (Nick Papadonis)
I'm still testing... I was able to get an xterm using 'xinit' or unsetting X11_PREFS_DOMAIN in 'startx'. I think the patch I supplied earlier is unnecessary if --without-startupitems in configure macports-base. I'm curious why it needs to be run as root unless it needs some special direct access to graphics hardware?
comment:10 Changed 14 months ago by nickpapadonis (Nick Papadonis)
| Summary: | xinit requires root privileges to install port, it should not? → xinit requires root privileges to install port, it doesn't need them. |
|---|
update per more testing
Changed 14 months ago by nickpapadonis (Nick Papadonis)
| Attachment: | xinit-nonroot-patch-applied.jpg added |
|---|
screenshot of proof
comment:11 Changed 14 months ago by nickpapadonis (Nick Papadonis)
I added xinit-nonroot.patch which is the workaround to allow xinit to run as non-root. It was a configuration option that disables the root installation. I added a jpg screenshot of a system with fresh build of macports-ports master (took like a day!) and Xwindows running non-root. I created an non-admin account on the system and performed the installation without using sudo.
cd macports-base ./configure --with-no-root-privileges --prefix=/Volumes/export/opt --without-startupitems --no-create --no-recursion
I will bring up that xinit seemed to either fail or not create a 'xinit' binary during 'ports install xorg xinit' and the port application seemed to silently ignore the error. I noticed this and had to manually go back and 'uninstall' then 'install' it.
Looking for guidance in the fix. If --with-no-root-privileges is supplied, the configuration option in the diff needs to be applied and the activation section set to false.
Changed 14 months ago by nickpapadonis (Nick Papadonis)
| Attachment: | xinit-noroot.patch added |
|---|
work around patch for non-root install
comment:12 Changed 13 months ago by atod101101
I still had an Xserver running as root in the background still through launchd. From what I read the system needs KMS capabilities in the kernel to run X as non-root. Therefore, just looking for some input from Jeremey (Thanks for creating the port!) on this as well.
comment:13 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)
Nick, please remember to use WikiFormatting.

quick hack to get xinit to compile non root