The officially official Devuan Forum!

You are not logged in.

#76 Re: Hardware & System Configuration » Passwordless root execution in scripts » 2019-12-13 15:19:26

jaromil - thank you for pointing out sup, I wasn't aware of it. I love it already. Small is beautiful!

#77 Re: Off-topic » This should be fun... » 2019-12-13 15:13:04

Here is the actual proposal: https://www.debian.org/vote/2019/vote_002
I've been watching this closely. Voting ends on December 27.

This year I learned to use OpenBSD and also Tiny Core Linux 64-bit (they call it "Pure64" for some reason). Both of these operating systems are completely immune to systemd nonsense. It doesn't hurt to have options...

Tiny Core uses Busybox init and is minimalistic in every regard, but can be built up to be a full desktop replacement OS. It has been my daily driver since August 2019 and at this point I've added enough polish to it that it does all I need. Warning: It is very much a do-it-yourself OS, similar to Arch Linux but even more extreme in its minimalism. I think Devuan users would find TCL much to their liking.

Hopefully Debian will do the right thing and my wanderings will have been for naught!

#78 Re: Other Issues » Adjusting brightness in C » 2019-12-13 14:57:39

siva, change test to brightness so that the source file looks like this:

#include <stdio.h>
#include <fcntl.h>	// Use "open"
#include <unistd.h>	// For "close"

int main() {
	// Open the brightness file.
	FILE *fp = fopen("/sys/class/backlight/acpi_video0/brightness", "w+");
	// Adjust brightness value.
	fprintf(fp, "5");
	// End.
	fclose(fp);
	return 0;
}

Then compile the file, change ownership to root, and set SUID:

$ gcc -o testing testing.c
$ sudo chown root:root testing
$ sudo chmod u+s testing

Now run the executable as regular user and it will change the brightness:

$ ./testing # boom! brightness changes

It was segfaulting because the binary did not have enough permissions to open the file.

#79 Re: Hardware & System Configuration » Passwordless root execution in scripts » 2019-12-13 14:45:43

Even if user makes a shell script SUID, the linux kernel will ignore it because it's a major security risk. https://unix.stackexchange.com/a/2910

Here is a simple demonstration of how SUID is set, but kernel ignores it:

$ echo '#!/bin/sh
apt update' >testing
$ chmod a+x ./testing
$ sudo chown root:root ./testing
$ sudo chmod u+s ./testing
$ ls -l ./testing
-rwsr-xr-x 1 root root 21 Dec 13 09:43 ./testing # the 's' shows that SUID bit is set
$ ./testing
Reading package lists... Done
W: chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

Permission is denied because the script is running as regular user, not root (i.e., SUID was ignored).

#80 Re: Desktop and Multimedia » Alternative browser for Devuan/Debian - Brave » 2019-12-13 13:56:14

Just one note about iridium: The control file inside the .deb package provided by the developers specifies a version of libfontconfig1 that's higher than what's available in the Devuan ASCII repositories. However, the browser does work just fine with the older version of libfontconfig1 that Devuan ASCII uses. The workaround is to unpack the .deb, delete the specified libfontconfig1 version number, and repack the .deb before installing it. Then it works like a charm.

#81 Re: Desktop and Multimedia » Alternative browser for Devuan/Debian - Brave » 2019-12-13 13:49:58

golinux - I use iridium as my daily driver. It is an "ungoogled chromium". Highly recommended. https://iridiumbrowser.de/

#82 Re: Off-topic » disable touchpad without disabling trackpoint [SOLVED] » 2019-11-20 15:16:16

Thank you very much for that, ToxicExMachina. Great find!!! My laptop does happen to run Libreboot. I had not heard of nvramcui (or its cousin, nvramtool) before. Very interesting.

According to this, Libreboot locks the CMOS table, so the only way to modify BIOS settings is to download the Libreboot rom, modify it with nvramtool, then flash the modified rom.

Alas, touchpad does not seem to be an option in my CMOS table:

$ sudo nvramtool -a
boot_option = Fallback
baud_rate = 115200
debug_level = Spew
sata_mode = AHCI
power_on_after_fail = Disable
first_battery = Primary
bluetooth = Enable
wwan = Enable
wlan = Enable
trackpoint = Enable
fn_ctrl_swap = Disable
sticky_fn = Disable
boot_devices = 
boot_default = 0x0
power_management_beeps = Enable
low_battery_beep = Enable
uwb = Disable
hybrid_graphics_mode = Integrated Only
gfx_uma_size = 256M
volume = 0x3

This is the closest I've come to a software solution.

#83 Re: Off-topic » disable touchpad without disabling trackpoint [SOLVED] » 2019-11-19 20:53:47

Thanks, ralph.ronnquist. Indeed it does (synclient TouchpadOff=1). This does not interfere with the trackpoint.

However, I've found that synclient, xinput, et al. are only effective in preventing the touchpad from controlling the pointer. That's it. On a low level, they leave the touchpad very much alive--run sudo cat /dev/input/eventX and watch all the chatter from the "disabled" touchpad when anything comes near it. This noise prevents the system from becoming idle when laptop's lid is shut.

#84 Re: DIY » KISS: a new systemd-free distribution that aims to "keep it simple" » 2019-11-19 20:03:03

Cool! I love distros like this. Thanks for pointing it out.

Tiny Core Linux, which I have grown to really appreciate, has some similarities: Busybox init, Busybox userland, minimalistic package manager. Differences are that it uses glibc (instead of musl) and--the biggest difference--that it's designed in such a way that, at every boot, the system is rebuilt from a "fresh install" based on the instructions you provide.

There are four places where the user provides instructions:
1. Boot loader "boot codes"
2. List of packages to load
3. A special tarball that holds your configuration files
4. Startup jobs in /opt/bootlocal.sh (root jobs) and in ~/.X.d/ (normal user jobs)

At most, only /opt and home directories are persistent. It's an ingenious design that gives you quite the clean feeling because all changes to the base system are in only one of these four places and can be reverted by simply editing a file or tarball then rebooting.

You can read all about it here: http://distro.ibiblio.org/tinycorelinux/corebook.pdf

#85 Re: Off-topic » disable touchpad without disabling trackpoint [SOLVED] » 2019-11-19 18:07:14

Thanks, yeti. Fn-F8 supposedly turns off the touchpad on the T400 as well (based on the little blue drawing on the F8 key), but it actually has no effect when I press it.

I decided to go with a hardware solution: Unplugging the touchpad's ribbon (the ribbon is just under the palmrest--it was trivial to find and disconnect) smile

Now the touchpad is completely disabled, but the trackpoint and its three buttons (just under the spacebar) are fully operational.

(I find it strange that on software level the trackpoint seems to be considered a child device of the touchpad, even though the hardware-level reality is that the two devices are independent.)

#86 Off-topic » disable touchpad without disabling trackpoint [SOLVED] » 2019-11-19 13:21:21

GNUser
Replies: 6

I run Devuan ASCII on my T400 laptop. I only use the trackpoint ("nipple mouse"). To me, the touchpad is just a nuisance.

I've discovered (by monitoring output of sudo cat /dev/input/event5) that the touchpad generates random input while the lid is closed. This causes applications that should run while the system to be idle (e.g., xscreensaver) to never run while the lid is closed.

I've tried to disable the touchpad via xinput, synaptics and evtest (evtest --grab /dev/input/event5 >/dev/null 2>&1), but none of these remedy the issue. The only remedy I've found is to unbind the touchpad's driver with this command:

# echo serio1 >/sys/bus/serio/drivers/psmouse/unbind

Unfortunately, the above command has the unacceptable side effect of simultaneously unbinding serio2, which renders my trackpoint ("nipple mouse") inoperable.

Please, do you know how to *completely* disable the touchpad (e.g., via unbinding its driver) without disabling the trackpoint?

P.S. This may be useful:

bruno@thinkpad:~$ cat /proc/bus/input/devices
---snip---
I: Bus=0011 Vendor=0002 Product=0007 Version=01b1
N: Name="SynPS/2 Synaptics TouchPad"
P: Phys=isa0060/serio1/input0
S: Sysfs=/devices/platform/i8042/serio1/input/input6
U: Uniq=
H: Handlers=mouse0 event5
B: PROP=1
B: EV=b
B: KEY=420 30000 0 0 0 0
B: ABS=11000003

I: Bus=0011 Vendor=0002 Product=000a Version=0000
N: Name="TPPS/2 IBM TrackPoint"
P: Phys=synaptics-pt/serio0/input0
S: Sysfs=/devices/platform/i8042/serio1/serio2/input/input7
U: Uniq=
H: Handlers=mouse1 event6
B: PROP=21
B: EV=7
B: KEY=70000 0 0 0 0
B: REL=3

P.S. Solution is in post #3. It's a hardware solution, not the software solution I was hoping to find.

#87 Re: Off-topic » yad without dbus? [SOLVED] » 2019-10-16 19:52:32

yad developer's workaround (see https://github.com/v1cont/yad/issues/58):

NO_AT_BRIDGE=1 yad <arguments>

I don't understand why it works, but it does. I need to educate myself further.

I also found this much simpler alternative to yad, which does everything I need:
https://github.com/jonhoo/mktrayicon

#88 Re: Off-topic » yad without dbus? [SOLVED] » 2019-10-15 17:44:46

Thank you for that, fsmithred.

I can confirm that if I remove the executable bit from dbus-launch and dbus-daemon, yad is still able to create the notification icon. However, if dbus-launch and dbus-daemon are executable, dbus is consistently launched each time yad creates an icon. This is very strange.

I'll ask yad's developer and will keep exploring. I'll take a look at some PPIDs to exclude the possibility that some other utility/daemon is starting dbus when yad is detected.

#89 Re: Off-topic » yad without dbus? [SOLVED] » 2019-10-15 16:55:21

While trying to solve this issue, I discovered this little gem:

https://github.com/jonhoo/mktrayicon

You can compile it with this command:

gcc `pkg-config --cflags gtk+-3.0` mktrayicon.c -lX11 -o mktrayicon `pkg-config --libs gtk+-3.0`

If, like me, you want to use custom icons instead of stock icons, just change the two instances of gtk_status_icon_set_from_icon_name in mktrayicon.c to gtk_status_icon_set_from_file before you compile it.

P.S. I'm still interested in solving this issue--learning how to create systray icons with yad without dbus being started.

#90 Re: Off-topic » yad without dbus? [SOLVED] » 2019-10-15 14:45:25

@fsmithred - On your no-dbus system, are you able to create a system tray icon using yad? What happens when you run $ yad --notification --image=dialog-ok --text="testing" &?

#91 Re: Off-topic » yad without dbus? [SOLVED] » 2019-10-15 14:34:21

I use fluxbox, which does not require dbus. However, I do have dbus installed because I sometimes use Thunderbird and Filezilla, which require it.

Notice how dbus is not running before yad, but rears its ugly head when yad creates a system tray icon:

bruno@box:~$ pgrep -fa dbus
bruno@box:~$ yad --notification --image=dialog-ok --text="testing" &
bruno@box:~$ pgrep -fa dbus
8504 dbus-launch --autolaunch b67e35c57ed5e6cf8ef0f5b65da5d7b3 --binary-syntax --close-stderr
8505 /usr/local/bin/dbus-daemon --syslog-only --fork --print-pid 5 --print-address 7 --session
8511 /usr/local/bin/dbus-daemon --config-file=/usr/local/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3

#92 Re: Off-topic » pgrep: unexpected return code in non-interactive script [SOLVED] » 2019-10-15 12:30:36

I redirected the script's stderr to a log to investigate what's going on when pgrep -f 'regex' && foo fails to work as expected.

Lo and behold, a bunch of "pgrep: write error" entries show up in the log.

So it seems the issue here is that when a shell script runs in the background, pgrep gets grumpy unless its stdout is redirected somewhere (even if only to /dev/null).

#93 Off-topic » yad without dbus? [SOLVED] » 2019-10-15 12:29:25

GNUser
Replies: 7

I've noticed that yad starts dbus. I'm not happy about it because none of the other applications I use require dbus, and yad is very handy.

Is there a way to use yad without starting dbus? If not, are you aware of an alternative to yad? I basically only use it to create system tray icons with tooltips.

#94 Re: DIY » ditch your bloated network manager » 2019-10-12 15:44:22

HevyDevy, wifi-monitor is a barebones shell script that assumes the user only uses wifi, never ethernet.

What you are suggesting would certainly be possible, but the more complex logic would require an overhaul of the script.

Feel free to adapt the script to suit your needs. If you run into issues, email me on here and I'll try to help.

#95 Re: DIY » ditch your bloated network manager » 2019-10-11 12:16:32

@HevyDevy - Good to hear! Glad you figured it out.

#96 Re: DIY » ditch your bloated network manager » 2019-10-10 16:03:47

@HevyDevy - I looked around and the only utility I could find to easily put an icon and tooltip in the system tray is yad. It's either yad or roll your own...

...so I did roll my own tiny alternative to yad using python:

#!/usr/bin/python3

import sys
from PyQt4 import QtGui, QtCore

def show_icon(icon, tooltip):
	class SystemTrayIcon(QtGui.QSystemTrayIcon):
		def __init__(self, icon, parent=None):
		   QtGui.QSystemTrayIcon.__init__(self, icon, parent)
		   self.setToolTip(tooltip)
		def exit(self):
		  QtCore.QCoreApplication.exit()

	app = QtGui.QApplication(sys.argv)
	w = QtGui.QWidget()
	trayIcon = SystemTrayIcon(QtGui.QIcon(icon), w)
	trayIcon.show()
	sys.exit(app.exec_())

icon=sys.argv[1]
tooltip=sys.argv[2]
show_icon(icon, tooltip)

If you'd like to try it:
1. Paste this code into a blank text file, name it show-icon, put it somewhere in your PATH, make it executable
2. Install the script's two dependencies: $ sudo apt install python3 python3-pyqt4
3. Test it: $ show-icon /path/to/icon.png "hello world" &

If the yad test I suggested in post #5 doesn't work, try this python script. If the python script ("show-icon") works, let me know and I can customize wifi-monitor for you (to use show-icon instead of yad).

#97 Re: DIY » ditch your bloated network manager » 2019-10-10 13:41:29

@HevyDevy - The script should show the essid when you hover with the mouse over the wifi icon. It uses yad to accomplish this.

What happens when you type this in a terminal?

yad --notification --image=dialog-ok --text="hello world"

You should see "hello world" when you hover over the icon. If you don't see it, it's because yad and tint2 are not playing nice together.

yad works perfectly for me in both MATE and fluxbox.

If you want to use wifi-monitor but are married to tint2, you can swap out yad for some other utility to show the icon+tooltip. I can explore some alternatives.

#98 Off-topic » pgrep: unexpected return code in non-interactive script [SOLVED] » 2019-10-08 11:38:24

GNUser
Replies: 2

In a non-interactive shell script, command in pgrep -f 'regex' && command never runs when expected.

However, command in pgrep -f 'regex' >/dev/null && command does run when expected.

One of the scripts I use daily is affected by this (on line 27):
https://github.com/bdantas/wifi-monitor … fi-monitor

The function icon_add is supposed to return immediately (without creating an icon) if an icon already exists. If I remove >/dev/null from line 27, however, the function never returns and icons pile up in the systray.

Any idea why >/dev/null is required here? I thought the exit code of a utility (pgrep in this case) should be the same regardless of where its output is going.

#99 Re: Off-topic » how to automatically get xinput id of keyboard? [SOLVED] » 2019-10-07 18:28:37

Just a quick followup: I found a way to detect keyboard input without needing the keyboard id at all!

$ LANG=C xinput --test-xi2 --root | awk '
/RawKeyPress/ { relevant=1 }
relevant==1 && /detail/ { print $2; relevant=0 }
'

The most obvious application of this is a keylogger (https://github.com/bdantas/keylogger), but the keylogger itself may just be a stepping stone to something more useful (e.g., https://github.com/bdantas/iksilo).

#100 Re: DIY » ditch your bloated network manager » 2019-10-07 15:37:58

Thanks, fsmithred. Good to know it works in Beowulf with lxpanel smile

It should work in Xfce as well. Note that, in the interest of simplicity, the icon only shows up when internet is connected. If there is no internet connectivity, then no icon is the expected behavior.

Board footer

Forum Software