Artix Linux Forum

General Category => Discussion about Artix => Topic started by: phoenix_king_rus on 04 May 2018, 10:38:40

Title: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 04 May 2018, 10:38:40
Hi all!

I want to try to run Artix without udev. As its alternatives i have tried smdev itself (https://git.suckless.org/smdev) and nldev (http://git.r-36.net/nldev). In both cases (i just replaced udev openrc script with simple script starting smdev or nldev) system started normally and i could mount any partition without problems. On the other hand, system then had no network access, no audio and no possibility to start X.
As i found in mdev docs (https://git.busybox.net/busybox/plain/docs/mdev.txt) and morpheus linux init scripts (https://git.2f30.org/fs/file/bin/rc.init.html) one needs to add path to smdev in /proc/sys/kernel/hotplug. Artix does not have this file.
Can this be avoided without kernel rebuld or how kernel should be configured?
Title: Re: Udev alternatives in Artix
Post by: Chris Cromer on 04 May 2018, 23:30:37
Hi all!

I want to try to run Artix without udev. As its alternatives i have tried smdev itself (https://git.suckless.org/smdev) and nldev (http://git.r-36.net/nldev). In both cases (i just replaced udev openrc script with simple script starting smdev or nldev) system started normally and i could mount any partition without problems. On the other hand, system then had no network access, no audio and no possibility to start X.
As i found in mdev docs (https://git.busybox.net/busybox/plain/docs/mdev.txt) and morpheus linux init scripts (https://git.2f30.org/fs/file/bin/rc.init.html) one needs to add path to smdev in /proc/sys/kernel/hotplug. Artix does not have this file.
Can this be avoided without kernel rebuld or how kernel should be configured?
It will require a kernel rebuild. You have to enable "CONFIG_UEVENT_HELPER" in the kernel.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 05 May 2018, 09:18:30
It will require a kernel rebuild. You have to enable "CONFIG_UEVENT_HELPER" in the kernel.
Thanks! I will try it
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 06 July 2018, 15:27:12
After some time of working on using nldev in Artix i see following picture:
1) It is possible to configure smdev to populate /dev almost correct (it looks like all files are detected but not all symlinks. I will try to fix it later)
2) With nldev one doesn't need any special files to start smdev: it just works (but probably one needs a way to respawn nldev as it fails sometimes because of some buffer problems. I use respawn command from ubase for it)
3) The one thing which still misses is to load module once device is detected. Some parts of this task is done: nlmon shows all environment variables for each device, which contains MODALIAS. I wrote a script which finds and loads module by given alias. The problem is to connect one to other:  i cannot make script start until i kill nlmon
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 02 August 2018, 21:03:45
Some news on nldev state:
1) all mentioned further works without any manual intervention now
2) I have almost all modules loaded at setup (udev setup has 5 modules more with fuse among them. Other 4 are unclear for me:  ccm, ax25, 8021q, mrp)
3) The system is closer to be able to work: it has working gpm and network connection (but my wlp3s0 interface is shown as wlan0). It is possible to start X session but it has no reaction to keyboard and mouse
4) Links in /dev are still missing: there are no links for input devices and audio (so, cmus doesn't work). /dev/dri links are also missing but graphics itself works OK. Also there is no /dev/mapper but as i don't use LVM on testing machine i can't check if it will work
Title: Re: Udev alternatives in Artix
Post by: nous on 02 August 2018, 22:27:56
It would be great if nldev reached a status of full operability. Please keep up the good work.
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 03 August 2018, 04:03:31
Hi all!

I want to try to run Artix without udev. As its alternatives i have tried smdev itself (https://git.suckless.org/smdev) and nldev (http://git.r-36.net/nldev). In both cases (i just replaced udev openrc script with simple script starting smdev or nldev) system started normally and i could mount any partition without problems. On the other hand, system then had no network access, no audio and no possibility to start X.


This is probably an ignorant question but why is X affected?
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 03 August 2018, 08:16:52

This is probably an ignorant question but why is X affected?
Nldev and smdev themselves don't load modules (so they don't load module for GPU). For mdev and smdev this could be done through configuration file but this case you probably need to know which devices really need modules. I wrote simple script to start smdev and load modules and use it as runpath for nldev. As i mentioned above this works but i still have some things missing
Title: Re: Udev alternatives in Artix
Post by: artoo on 03 August 2018, 11:05:11
Is there an equivalent of a libudev?
In terms of making it install on artix, the package would have to be a split package into libudev and udev part to swap out eudev.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 03 August 2018, 12:12:29
Is there an equivalent of a libudev?
In terms of making it install on artix, the package would have to be a split package into libudev and udev part to swap out eudev.
By default nldev reads messages from kernel and libudev (unless you tell it to ignore one of them). After your reply i tested nldev only with kernel messages: the only difference is that rtsx_usb_ms and memstick modules are not loaded and ccm module is loaded.
Also i made a mistake in last report: sound works OK, at least cmus and alsamixer work without problems
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 06 August 2018, 08:43:33
I have tested nldev on another device which uses LVM. So:
1) nldev may crush with buffer overflow error. It needs some respawning mechanism then. Also you may need to run nltrigger once more
2) LVM works but you need proper initscripts order (as lvm2 runit script running after triggering command). On shutdown this script provides messages "Device /dev/<all block devices> not initialized in udev database even after waiting 10000000 microseconds"
Also i found some info on problem with input in X11 in other distro wikis: Gentoo wiki says that evdev requires udev (but which module is used by gpm?) and Alpine wiki says that xorg might need udev for input devices
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 06 August 2018, 10:50:31
Nldev and smdev themselves don't load modules (so they don't load module for GPU). For mdev and smdev this could be done through configuration file but this case you probably need to know which devices really need modules. I wrote simple script to start smdev and load modules and use it as runpath for nldev. As i mentioned above this works but i still have some things missing


but the GPU is loaded by the kernel on boot?
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 06 August 2018, 10:55:05

but the GPU is loaded by the kernel on boot?
On my first device (where nldev runs without any crushes) GPU driver is detected on boot (intel). On the second one it is detected after second nltrigger call (amdgpu). In both cases libudev is not required
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 08 August 2018, 15:07:43
So, disabling evdev module didn't help. I will think on how else to make input in X working
I post here links to my current versions of nldev and smdev on gitlab for anybody who wants also test it: https://gitlab.com/phkr/nldev and https://gitlab.com/phkr/smdev
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 08 August 2018, 16:49:00
This is a deep dive into what has become a broken X11 system since it has been "deseated" and made to be run out of systemd.

There is no reason why x should not just work with startx
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 08 August 2018, 16:52:56
what is hwinfo give you?  I'm struggling to understand why the gpu isn't being picked up by the kernel on the boot and the modules loaded normally.  This is not a udev issue but perhaps a /etc/modules issue or a kernel compile issue?   The kernel picks up the gpu and it is stdout... Where am I confused here?
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 08 August 2018, 16:55:35
This is a deep dive into what has become a broken X11 system since it has been "deseated" and made to be run out of systemd.

There is no reason why x should not just work with startx
It is now possible to start X but it has no reaction to the keyboard or mouse
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 10 August 2018, 12:10:38
It is now possible to start X but it has no reaction to the keyboard or mouse


Right - I had this problem.  It is a bug in the X libraries that are now strapped to systemd crap. check the logs.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 10 August 2018, 18:14:06

Right - I had this problem.  It is a bug in the X libraries that are now strapped to systemd crap. check the logs.
Nothing about input
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 11 August 2018, 03:04:20
nothing about libxinput
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 11 August 2018, 03:10:14
https://forum.artixlinux.org/index.php/topic,591.msg4826.html#new
Title: Re: Udev alternatives in Artix
Post by: E5ten on 29 September 2018, 19:29:34
Could you upload the files you've used so far? like initscripts and configs, basically anything that could help me try to recreate this and then further tinker.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 29 September 2018, 22:09:43
Could you upload the files you've used so far? like initscripts and configs, basically anything that could help me try to recreate this and then further tinker.
I tested nldev with my own service launcher. The init scripts are in my gitlab repo https://gitlab.com/phkr/fs in /etc/sidal/avail. Nldev init script requires ubase (https://git.suckless.org/ubase) to be installed in /opt/suckless to provide respawn command. This command is required as nldev may fall if it has much tasks to proceed.
In this repo in /usr/local/bin you may also find smdev-helper script which provides some additional processes on creating device node. Nlmon init script is not really needed, but nltrigger must be run after nldev.
You also may find an example of nldev usage in its author's repo: http://r-36.net/scm/stali-init/file/rc.init.html
Have fun! :)
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 05 December 2018, 17:47:27
A new successful step is to rebuild xorg-server without udev support. In this case X in smdev+nldev-based system reacts to keyboard and mouse without problems (i didn't test touchpad). However, i had to disable logind support too, so only root can start X. Are there any ideas how to allow user to start X in this case?

Many thanks to Alessandro Pistocchi who sent me this link (https://forums.gentoo.org/viewtopic-t-997612-start-0.html)
Title: Re: Udev alternatives in Artix
Post by: fungalnet on 05 December 2018, 19:14:13
Is it .Xauthority and xauth, that allow or prevent one to start an X session locally or remotely?
Interesting question you ask.
I am sure it is security related and whether a user remotely logged into a system can start X or run a gui on an already started xsession.  I am sure if you care less about security then such obstacles could be unrelated to udev.
Let's say a friend in my lan is logged in to console and idling, and I can remotely log in as well with their name and pw.  Can I start x in their monitor?  If they have started X, can I run a gui inside their session?

Sorry for not knowing the answer, I am thinking out loud in case any such thoughts can help you find the answer.
I tried running without dbus, a greater headache, and it is not simple either.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 05 December 2018, 19:21:09
I am sure if you care less about security then such obstacles could be unrelated to udev.
This is logind problem. I had to disable it because otherwise i got build error on corresponding step
I know that in *BSD user can start X session without logind but i don't know how can this be achieved in Linux

Here is error message i have while building with logind:
Code: [Select]
../xorg-server-1.20.3/hw/xfree86/os-support/linux/systemd-logind.c: In function 'systemd_logind_vtenter':
../xorg-server-1.20.3/hw/xfree86/os-support/linux/systemd-logind.c:248:21: error: 'xf86_num_platform_devices' undeclared (first use in this function); did you mean 'xf86_platform_device'?
     for (i = 0; i < xf86_num_platform_devices; i++) {
                     ^~~~~~~~~~~~~~~~~~~~~~~~~
                     xf86_platform_device
../xorg-server-1.20.3/hw/xfree86/os-support/linux/systemd-logind.c:248:21: note: each undeclared identifier is reported only once for each function it appears in
../xorg-server-1.20.3/hw/xfree86/os-support/linux/systemd-logind.c:249:13: error: 'xf86_platform_devices' undeclared (first use in this function); did you mean 'xf86_platform_device'?
         if (xf86_platform_devices[i].flags & XF86_PDEV_PAUSED)
             ^~~~~~~~~~~~~~~~~~~~~
             xf86_platform_device
Title: Re: Udev alternatives in Artix
Post by: fungalnet on 05 December 2018, 21:14:11
Don't say linux, because what is true for one linux is not true for others.  What may be true for arch may not be for debian, for example.

For a while between artix and obarun one of the differences was the one used elogind the other used consolekit.  I thought  I HAD TO use either the one or the other.  So then I tried in obarun to run without consolekit, and X worked fine.  No DM, just a window manager.  I suspect the same may be true for artix.  I just type xinit on console, I have a .xinitrc at ~/ and off it goes.  There is also a file in /etc/X11/ called xwrapper where counter-intuitively  where it says "need root rights = yes " is the correct setting.  I know wayland wouldn't work without elogind and that is the reason it is here.  My brief experience with wayland as it still is, is that I am not missing much.  Who knows, maybe the future will tempt me.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 05 December 2018, 21:31:09
Don't say linux, because what is true for one linux is not true for others.  What may be true for arch may not be for debian, for example.

For a while between artix and obarun one of the differences was the one used elogind the other used consolekit.  I thought  I HAD TO use either the one or the other.  So then I tried in obarun to run without consolekit, and X worked fine.  No DM, just a window manager.  I suspect the same may be true for artix.  I just type xinit on console, I have a .xinitrc at ~/ and off it goes.  There is also a file in /etc/X11/ called xwrapper where counter-intuitively  where it says "need root rights = yes " is the correct setting.  I know wayland wouldn't work without elogind and that is the reason it is here.  My brief experience with wayland as it still is, is that I am not missing much.  Who knows, maybe the future will tempt me.
Everything is OK with configuration, i run it every day with usual Artix build.
Thanks for your notes about Obarun, i will try to find something useful in their xorg-server build configuration
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 06 December 2018, 08:48:03
Setting SUID on /usr/bin/Xorg solved this problem. So, the following subsystems definitely work with smdev+nldev:
-X
-audio
-network
-USB keyboard, mouse and storage
-LVM
Title: Re: Udev alternatives in Artix
Post by: mrbrklyn on 10 December 2018, 04:32:31
Don't say linux, because what is true for one linux is not true for others.  What may be true for arch may not be for debian, for example.

For a while between artix and obarun one of the differences was the one used elogind the other used consolekit.  I thought  I HAD TO use either the one or the other.  So then I tried in obarun to run without consolekit, and X worked fine.  No DM, just a window manager.  I suspect the same may be true for artix. 

How else did you think it worked?  I think all this layered software is confusing everyone.  There was no counselkit or elongind.  xdm ran out of the init scripts, or from a councel through a getty process with startx .
Title: Re: Udev alternatives in Artix
Post by: fungalnet on 10 December 2018, 10:02:02
Well Obarun uses jwm, which doesn't require much but it came with consolekit which was required along with cgmanager for something else.  So I didn't study it much.  For years I had been using some lxde stuff on openbox, one of them was lxsession (which in arch contains lxpolkit), which requires either one of the two evils through polkit.  On artix polkit requires elogind, but on obarun it doesn't require consolekit..  ....  hence the confusion.  This is not judgemental in any way, it is choice and approaches in doing things, which I have learned to respect, in the struggle against "all evil".  Even MX which comes with systemd/libs..  installed but is not using it for what it was created for has become a top3 choice of interest in Distrowatch.  Entry level anti-systemd :)

Looking at this experimental project where one started with gentoo and tried to survive without dbus and how hard that was in gentoo (even), I think we don't have enough distributions out there that can deviate radically from the norm.  I have faith in Adelie as breaking new ground, and void-musl is a ground breaker as well.  But under a wider perspective one can appreciate artix more in being so rich and providing so much choice while walking a thin line between being too radical and disfunctional and as being as functional as any systemd distribution.  It is like walking on a wire.  The political parallel to this would have been Allente in Chile, who eventually fell off the wire 9/11 1973.
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 22 December 2018, 13:17:05
So, i use smdev+nldev instead of udev for about a week on my main desktop and it really works. The weak sides are high boot time (smdev proceeds all uevents sequentially with only 1 core and after that it LVM waits 20 seconds for each block device to be registered in udev database) and some udev-dependent services (for example, udisks2 is not working).
What do you think about adding these packages to goblins? The full package list consists of smdev, nldev, some helper scripts for smdev, openrc init scripts and modified xorg-server (it also works with udev)
Title: Re: Udev alternatives in Artix
Post by: phoenix_king_rus on 25 December 2018, 14:05:02
Finally, i uploaded everything to AUR (https://aur.archlinux.org/packages/?K=phkr&SeB=m)
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: fungalnet on 26 December 2018, 09:43:41
Would it be too much to ask to make runit scripts as well?
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 26 December 2018, 16:26:49
Would it be too much to ask to make runit scripts as well?
I will do it later
If you can do it earlier, i expect the following recipe to work:
1) "smdev -s" is executed in /etc/rc/sysinit instead of all udev services (before lvm)
2) in default runlevel nldev is started
3) after nldev "nltrigger add all" triggers uevents which didn't exist at first step
EDIT: uploaded runit scripts too
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: nous on 28 December 2018, 12:10:58
It's already hard to keep up with Arch as it is, adding these packages to our repos would mean extra workload for Artix devs. May I suggest:
1. You create an unofficial repository with your packages
2. Or, join the Artix dev team and maintain the packages in [galaxy]

Free cookies are given!
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 28 December 2018, 12:36:18
2. Or, join the Artix dev team and maintain the packages in [galaxy]
I think galaxy-goblins will be right place for this stuff. Also how about creating wiki page about udev-less systems?
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: artoo on 28 December 2018, 12:37:02
There are two ways to integrate these.
One would be using a neutral udev/libudev depends/provide in all our packages, lo5t of work to change it, or the alternative uses provides array with  eudev/libeudev in PKGBUILD.

Artix is currently built around eudev.
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 28 December 2018, 12:42:04
There are two ways to integrate these.
One would be using a neutral udev/libudev depends/provide in all our packages, lo5t of work to change it, or the alternative uses provides array with  eudev/libeudev in PKGBUILD.

Artix is currently built around eudev.
nldev+smdev can be installed alongside udev. In general one only needs to deactivate udev initscripts and enable smdev and nldev ones. There is separate package for xorg-server to work. I hope i will furter provide the same pakages for lvm2 and cups to improve their performance without udev
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: konimex on 28 December 2018, 14:28:23
It's already hard to keep up with Arch as it is, adding these packages to our repos would mean extra workload for Artix devs. May I suggest:
1. You create an unofficial repository with your packages
2. Or, join the Artix dev team and maintain the packages in [galaxy]

Free cookies are given!
I think galaxy-goblins will be right place for this stuff. Also how about creating wiki page about udev-less systems?
Personally, I think anything [goblins] aka. [staging] shouldn't be used for experimental features like this since [goblins] aka [staging] is also used to build many important, critical, breaking updates (https://wiki.archlinux.org/index.php/official_repositories#Staging_repositories) (e.g. toolchains such as gmp, mpfr, mpc, gcc, glibc or even kernel updates).
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: mrbrklyn on 16 June 2019, 22:02:49
By default nldev reads messages from kernel and libudev (unless you tell it to ignore one of them). After your reply i tested nldev only with kernel messages: the only difference is that rtsx_usb_ms and memstick modules are not loaded and ccm module is loaded.
Also i made a mistake in last report: sound works OK, at least cmus and alsamixer work without problems


Are you doing all this testing on a VM?
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: mrbrklyn on 16 June 2019, 22:38:34
By default nldev reads messages from kernel and libudev (unless you tell it to ignore one of them). After your reply i tested nldev only with kernel messages: the only difference is that rtsx_usb_ms and memstick modules are not loaded and ccm module is loaded.
Also i made a mistake in last report: sound works OK, at least cmus and alsamixer work without problems


Are you doing all this testing on a VM?
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 17 June 2019, 08:51:29
Are you doing all this testing on a VM?
I did that at early stages but mostly i worked with real hardware
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 02 January 2020, 20:30:43
Just tried nldev on Firefly RK3399 (see Aarch64 topic for its state in general). In general it works the same as with udev but:
1) in /dev/snd i have control device which i don't have while using udev (HDMI audio doesn't provide control devices)
2) keyboard behaves weird in xorg (all is OK in tty): on my keyboard i cannot use arrow keys and right Alt and Ctrl. But some keys on numeric pad work as arrow keys, PgUp, PgDn and others. I tried to configure it in xorg.conf.d but after that xorg couldn't find monitor
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 30 May 2020, 15:14:26
So, i have solved that issue for Firefly and maybe this is a general solution if you need evdev with X but don't use udev. In my case /dev/input/event0 is mouse, /dev/input/event1 is keyboard and i made the following configs for Xorg:1) /etc/X11/xorg.conf.d/00-evdev.conf
Code: [Select]
Section "Module"
        Load "evdev"
EndSection

Section "InputDevice"
        Identifier "evdev-input0"
        Driver "evdev"
        Option "Device" "/dev/input/event0"
EndSection
Section "InputDevice"
        Identifier "default-keyboard"
        Driver "evdev"
        Option "Device" "/dev/input/event1"
        Option "CoreKeyboard"
EndSection
2)/etc/X11/xorg.conf.d/99-main.conf
Code: [Select]
Section "ServerLayout"
        Identifier "main"
        InputDevice "evdev-input0"
        InputDevice "default-keyboard"
EndSection
Now both keyboard and mouse use evdev module and keys work properly without additional configuration
Title: Re: [SOLVED] Udev alternatives in Artix
Post by: phoenix_king_rus on 03 June 2021, 17:32:25
So, a lot of time has passed and i'm back here with libudev-zero (https://github.com/illiliti/libudev-zero) on top on already existing nldev+smdev. libudev-zero is actually that peace of software i missed previously and it significantly reduces the amount of patches that are required: xorg, wayland, cups and sane work without any patches at all. The exception is lvm2 - it is uses deprecated udev API which is not (and will not be) supported, so it is easier to use version without udev support. I also couldn't make pipewire and pulseaudio work (but this can be a config problem also)
I also noticed side effect on Firefly RK3399: with udev i didn't get display at first boot if monitor was on before the board. This doesn't happen with nldev.

For those who wants to test it themselves, PKGBUILDs are uploaded to AUR with OpenRC and runit init scripts (make sure to install smdev-libudev-zero (https://aur.archlinux.org/packages/smdev-libudev-zero/) to get benefits from libudev-zero)