The officially official Devuan Forum!

You are not logged in.

#1 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-03-12 19:23:18

Just a quick follow-up regarding haveged.

TL;DR version:
    With modern linux kernels (5.6 or later) there is no need to install haveged on a GNU/Linux box being used as a wireless router.

Detailed version:
    Entropy is needed for fast communication between wireless router and wireless clients (due to wpa2 cryptography operations). It used to be recommended to run cat /proc/sys/kernel/random/entropy_avail on the router and, if result was less than 1000, to install haveged and run it as a daemon to augment router's entropy pool.
    Turns out that linux 5.6 incorporated a haveged-inspired mechanism that generates entropy extremely quickly (~200 MiB/s), making the haveged daemon obsolete for this use case (fast entropy generation). Also, result of cat /proc/sys/kernel/random/entropy_avail is now meaningless (the command always returns "256").

Ref: https://github.com/jirka-h/haveged/issues/57

P.S. Would the forum moderator kindly delete haveged from Reply #18 (two places) and Reply #21 (one place)? I tried to delete it myself, but was denied ("You do not have permission to access this page").

#2 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-21 04:10:38

If I run nmcli dev set wlan0 managed no, how do I undo the effects of this when I've finished using the Access Point

With nmcli dev set wlan0 managed yes

or does the command sudo pkill hostapd; sudo pkill -f 'dnsmasq.*/tmp/dnsmasq.conf' take care of this?

No.

Regarding wicd, its last stable release was in 2016 and last merge request from 2019. You could try it but the software is unmaintained.

#3 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-19 18:43:57

Hello again, mtbvfr. The nmcli command (see reply #25 just above) made the "handle_probe_req: send failed" messages disappear on my ThinkPad X230 with Devuan Daedalus smile Now the hotspot created with skinny-create-ap is completely stable.

I updated the script in reply #18 to include the nmcli command. I will go ahead and mark the thread as "Solved" (almost 7 years later--haha).

P.S. Please let me know if the nmcli command fixes things on your Lenovo L540. As for your other laptops, I'll leave those for you and other users to troubleshoot. I suggest scrutinizing the wifi hardware (not all hardware supports AP mode), excluding interference from network managers, and excluding interference from other software (e.g., rfkill).

#4 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-19 17:53:27

Sometimes, after a while, "handle_probe_req: send failed" is output multiple times.

Hi mtbvfr. I cannot reproduce the problem on my ThinkPad X200 with ALFA USB wifi adapter and Tiny Core Linux.

I don't normally run the skinny-create-ap script on my ThinkPad X230 with Devuan Daedalus but I gave it a try and I am able to reproduce your problem:

$ sudo skinny-create-ap wlx00127b20535e wlan0 DevuanHotspot TopSecret123
...
[I can connect to the hotspot using my phone, and phone can access the internet without any problems for several minutes]
wlx00127b20535e: INTERFACE-DISABLED 
wlx00127b20535e: INTERFACE-ENABLED 
[here the phone loses connection to the hotspot]
handle_probe_req: send failed
handle_probe_req: send failed
handle_probe_req: send failed
handle_probe_req: send failed
handle_probe_req: send failed
handle_probe_req: send failed

Since the hotspot works perfectly for several minutes before failing, I suspect the sudden failure is related to either power management or a networking daemon (e.g., NetworkManager) interfering.

One big difference between my X200 with TCL and X230 with Daedalus is that the latter uses NetworkManager.

Two questions for you, mtbvfr:

1. On your Lenovo L540 using Devuan Daedalus, is NetworkManager installed and running when you experience the "handle_probe_req: send failed" issue?

2. If you run nmcli dev set wlan0 managed no and then start the hotspot with sudo skinny-create-ap wlan0 eth0 DevuanHotspot TopSecret123 does the "handle_probe_req: send failed" problem go away?

I'm testing #2 right now.

#5 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-19 15:04:40

Hi mtbvfr. There are a lot of moving parts here. I will look at this on the weekend when I have more time.

But I do have two cents of advice that I can give right away:

Over the years, I've had many headaches of the type you're having now. I am not exaggerating when I say that all of my wifi-related headaches went away when I started using hand-picked hardware (ALFA AWUS036ACHM) and hand-picked minimalist OS (Tiny Core Linux) on my GNU/Linux box being used as a wireless router.

In other words, every problem I've ever encountered related to creating wifi hotspots were either due to poor hardware support or an OS that was getting in the way by doing things that I did not expect or desire.

#6 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-16 15:24:00

For sake of completeness, here are two variations on the skinny-create-ap script in reply #18. Both are tested and working for me.

Variation 1: nftables instead of iptables
If you would rather use the more modern nftables packet filtering interface for linux, only two tweaks need to be made to the instructions in reply #18.

1. Packages to install:

sudo apt install iproute2 nftables dnsmasq hostapd haveged 

2. Replace the script's setup_nat() function with this version:

setup_nat()
{
	nft add table ip nat
	nft add chain ip nat postrouting { type nat hook postrouting priority 0\; policy accept\; }
	nft add rule ip nat postrouting masquerade
}

Variation 2: 5 GHz hotspot instead of 2.4 GHz
This assumes your hardware supports it.

For me, creating a 5 GHz hotspot is simply a matter of replacing the script's setup_ap() function with this version:

setup_ap()
{
	# create hostapd config file:
	echo "
ssid=$ssid
interface=$lan_if
driver=nl80211
country_code=US
channel=44
ignore_broadcast_ssid=0
hw_mode=a
auth_algs=1
wpa=2 
wpa_passphrase=$password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

# N
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40+][HT40-][SHORT-GI-20][SHORT-GI-40]
" >/tmp/hostapd.conf

	# start hostapd:
	hostapd /tmp/hostapd.conf
}

You may need to tweak the country_code, channel, and ht_capab variables, but the above settings are pretty vanilla.

I hope that reply #18 and this reply #21 provide all you need to setup your own GNU/Linux-powered router smile

Happy hacking!

----------

PS1: Regarding range--If you're going to have a GNU/Linux laptop working full-time as a wireless router, you should consider using a USB wifi adapter rather than laptop's built-in wireless card because it will give you much better signal strength/range. I've been using an ALFA AWUS036ACHM for this purpose for years and it has served me well. You can find information about USB wifi adapters on linux here.

PS2: On "router" vs. "wifi repeater"--This seems like a silly distinction. In both cases, the laptop is creating a wireless access point and forwarding packets between two networks. Conceptually, it makes no difference whether your device is sharing a wired or wireless internet connection. Put another way, a "wifi repeater" is just a special kind of router where the networks on both sides of the router have a wireless physical layer.

#7 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-15 14:42:48

You might want to disable automatic start of dnsmasq

Hi dzz. My skinny-create-ap script (in reply #18) starts dnsmasq in such a way that there is no clash if another instance of dnsmasq is already running. In general, multiple instances of dnsmasq can happily be running on the same machine as long as no two instances try to bind to the same interface.

#8 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-15 04:55:30

Hi mtbvfr. Thanks for the private message with the requested info.

I understand your laptop has a successful internet connection using ethernet cable on the eth0 nic, and you want to share that internet connection wirelessly by creating an access point on wlan0.

Based on the information you provided, it seems wlan0 is ready to be used for this purpose--its driver/firmware is loaded and it supports AP mode.

It seems create_ap is no longer maintained, so let's not bother with it.

I managed to get this working on Devuan Daedalus as follows:

0. No need to uninstall or disable NetworkManager if you have it

1. Install some packages:

sudo apt install iproute2 iptables dnsmasq hostapd haveged 

2. Create a script named skinny-create-ap somewhere in your PATH and make it executable. Script should look like this:

#!/bin/sh

# skinny-create-ap v2.3 (February 19, 2024)
# Bruno "GNUser" Dantas (GPLv3)

# Purpose: Turn a GNU/Linux system into a wireless router
# Dependencies: iproute2 iptables dnsmasq hostapd
# Not a dependency but highly recommended: haveged
# Syntax: $ sudo skinny-create-ap <lan_if> <wan_if> <ssid> <passphrase>
# Example usage: $ sudo skinny-create-ap wlan0 eth0 DevuanHotspot TopSecret123
# To turn off the hotspot: $ sudo pkill hostapd; sudo pkill -f 'dnsmasq.*/tmp/dnsmasq.conf'

# user variables:
lan_if="$1"
wan_if="$2"
ssid="$3"
password="$4"
ip_stem=192.168.50
channel=6
#dns_server=1.1.1.1

main()
{
	prevent_nm_interference
	setup_kernel
	setup_nat
	setup_dhcp
	setup_ap
}

prevent_nm_interference()
{
	nmcli dev set "$lan_if" managed no >/dev/null 2>&1
}

setup_kernel()
{
	echo 1 >/proc/sys/net/ipv4/conf/"$wan_if"/forwarding
	echo 1 >/proc/sys/net/ipv4/ip_forward
}

setup_nat()
{
	iptables -t nat -A POSTROUTING -o "$wan_if" -j MASQUERADE
	iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
	iptables -A FORWARD -i "$lan_if" -o "$wan_if" -j ACCEPT
}

setup_dhcp()
{
	# first, bring up $lan_if and give it a suitable ip address:
	if ip link set "$lan_if" up; then
		ip addr add $ip_stem.1/24 dev "$lan_if"
	else
		echo "$lan_if does not exist or cannot be brought up. Make sure necessary driver +/- firmware is installed." >&2
		exit 1
	fi

	# create dnsmasq config file:
	echo "
dhcp-leasefile=/tmp/dnsmasq.leases
dhcp-range=$ip_stem.100,$ip_stem.200,255.255.255.0,24h
#dhcp-option-force=option:dns-server,$dns_server
" >/tmp/dnsmasq.conf

	# start dnsmasq (with care not to clash with any dnsmasq instances that might already be running):
	dnsmasq --interface="$lan_if" --bind-interfaces --except-interface=lo -C /tmp/dnsmasq.conf 
}

setup_ap()
{
	# create hostapd config file:
	echo "
ssid=$ssid
interface=$lan_if
driver=nl80211
channel=$channel
ignore_broadcast_ssid=0
hw_mode=g
auth_algs=1
wpa=2 
wpa_passphrase=$password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

# N
ieee80211n=1
wmm_enabled=1
" >/tmp/hostapd.conf

	# start hostapd:
	hostapd /tmp/hostapd.conf &
}

main

3. Run the script like this, for example:

sudo skinny-create-ap wlan0 eth0 DevuanHotspot TopSecret123

Now your wireless devices (e.g., Android phone) should be able to connect to DevuanHotspot using the password TopSecret123.

Let me know how you fare.

----------

PS1: Regarding radio frequency--the shell script above creates a 2.4 GHz 802.11n ("Wi-Fi 4") access point. 2.4 GHz is a good default because it has better range, simpler configuration, no regulatory issues, and broader hardware support in AP mode. If your wireless nic supports creation of 5 GHz AP and you would prefer 5 GHz, just tweak the "setup_ap" function as appropriate (let me know if you need help).

PS2: Regarding DNS lookups--if you want dnsmasq to tell wireless clients which dns sever to use, just uncomment the two lines where you see dns_server. If you leave those two lines commented, wireless clients will rely on the router (i.e., your laptop) to resolve domain names, which is a perfectly sane default.

PS3: To turn the hotspot off, run this command: sudo pkill hostapd; sudo pkill -f 'dnsmasq.*/tmp/dnsmasq.conf'

#9 Re: DIY » [SOLVED] GNU/Linux laptop as router, vpn router, or wifi repeater » 2024-02-14 19:27:23

Hi, mtbvfr. I'll be happy to try to help you. First, two quick questions, please:

1. Does your laptop have a working internet connection?

2. Does the wireless interface that you want to use to create the access point show up when you run ifconfig -a?

#10 Re: Desktop and Multimedia » How to setup Russian keyboard layout in Xorg? » 2023-10-02 17:12:13

Hi penguin. I would give deepforest a warning for the inappropriate post if I could but, alas, I'm just a fellow user.

Have you tried setxkbmap? Start with setxkbmap -query to see what your current settings are for "model" and "layout". In my case, this is what I see:

$ setxkbmap -query
rules:      evdev
model:      pc105
layout:     us

To set available models, layouts, variants, and options, do this:

$ less /usr/share/X11/xkb/rules/evdev.lst

To change settings, this is the syntax:

$ setxkbmap [-model xkb_model] [-layout xkb_layout] [-variant xkb_variant] [-option xkb_options]

So to keep your current keyboard model and change to Russian layout, for example, do:

$ setxkbmap -layout ru

You mentioned that your Russian layout seems to have some characters off position. Maybe you are not using the Russian variant that has the positions you expect? Another possibility is that the keyboard model setting is not correct--look at your keyboard and compare it with internet images of different keyboard models to ensure that setxkbmap's "model" setting is correct for your hardware.

#11 Re: Devuan » Devuan 5 Daedalus Release (Debian 12 - Bookworm) | Looking for info » 2023-07-23 18:23:50

birdi wrote:

It seems there is no cpu or disk activity during this time, it just stays there and does nothing then continues to start as normal.

I was once affected by a very similar issue, where nothing would happen in the middle of boot process for about 30 seconds, then boot would continue as normal. In my case, the issue turned out to be that UUID of my swap partition had changed (because I deleted the old swap partition and created a new one), but initramfs had a record of the old UUID and was timing out while waiting for it to appear.

Have you changed any of your hardware or partition UUIDs recently? If so, try recreating your initramfs:

1. Boot as usual
2. Run sudo update-initramfs -u
3. Reboot

#12 Re: Other Issues » pm-utils hangs occasionally during resume » 2023-07-22 14:13:09

Yes, I think s2idle uses more battery than deep.
Switching to s2idle is the only fix I ever found that allowed the keyboard on one of my laptops to work after suspend. Sorry I couldn't help you find a satisfactory fix. Happy hacking!

#13 Re: Other Issues » pm-utils hangs occasionally during resume » 2023-07-22 11:07:48

Your mem_sleep is set to deep. s2idle is listed as a valid option but is not selected. If you run the command I suggested, you should see [s2idle] deep

#14 Re: Other Issues » pm-utils hangs occasionally during resume » 2023-07-17 03:28:08

Hi, rechvs. I once had a similar problem, where laptop keyboard was unresponsive after resuming from suspend. Laptop in question ran Devuan (I don't remember which version) and did have pm-utils installed.

The problem/solution may vary depending on exact hardware. For me, changing suspend method from the default "deep" (i.e., suspend-to-RAM) to "s2idle" (i.e., suspend-to-idle) solved the problem:

$ sudo sh -c "echo s2idle >/sys/power/mem_sleep"

#15 Re: Desktop and Multimedia » [SOLVED] Random Xorg crashes after upgrading to Daedalus » 2023-07-05 13:28:15

For completion's sake, here is the output of inxi -Gx in the three configurations I mentioned in original post:

#1: Laptop's default configuration. Result: Xorg consistently crashes when visiting certain webpages using chromium-based web browsers.

$ inxi -Gx
Graphics:
  Device-1: Intel Core Processor Integrated Graphics vendor: Sony driver: i915
    v: kernel arch: Gen-5.75 bus-ID: 00:02.0
  Device-2: Microdia Webcam type: USB driver: uvcvideo bus-ID: 1-1.2:3
  Display: x11 server: X.Org v: 1.21.1.7 driver: X: loaded: modesetting
    unloaded: fbdev,vesa dri: crocus gpu: i915 resolution: 1366x768~60Hz
  API: OpenGL v: 2.1 Mesa 22.3.6 renderer: Mesa Intel HD Graphics (ILK)
    direct-render: Yes

#2: Workaround using nomodeset kernel boot parameter. Result: No Xorg crashes at the price of an inactive GPU.

$ inxi -Gx
Graphics:
  Device-1: Intel Core Processor Integrated Graphics vendor: Sony driver: N/A
    arch: Gen-5.75 bus-ID: 00:02.0
  Device-2: Microdia Webcam type: USB driver: uvcvideo bus-ID: 1-1.2:3
  Display: x11 server: X.Org v: 1.21.1.7 driver: X: loaded: vesa
    unloaded: fbdev,modesetting dri: swrast gpu: N/A resolution: 1366x768
  API: OpenGL v: 4.5 Mesa 22.3.6 renderer: llvmpipe (LLVM 15.0.6 128 bits)
    direct-render: Yes

#3: Current configuration, achieved with /usr/share/X11/xorg.conf.d/09-force-intel-driver.conf and no special kernel boot parameters. Result: No Xorg crashes, GPU is active.

$ inxi -Gx
Graphics:
  Device-1: Intel Core Processor Integrated Graphics vendor: Sony driver: i915
    v: kernel arch: Gen-5.75 bus-ID: 00:02.0
  Device-2: Microdia Webcam type: USB driver: uvcvideo bus-ID: 1-1.2:3
  Display: x11 server: X.Org v: 1.21.1.7 driver: X: loaded: intel
    dri: crocus gpu: i915 resolution: 1366x768~60Hz
  API: OpenGL v: 2.1 Mesa 22.3.6 renderer: Mesa Intel HD Graphics (ILK)
    direct-render: Yes

Other than this one strange issue on this one laptop, upgrade from Chimaera to Daedalus was smooth for all my machines. Thank you, Devuan team!

Happy hacking!

#16 Re: Desktop and Multimedia » [SOLVED] Random Xorg crashes after upgrading to Daedalus » 2023-07-05 02:42:56

Altoid wrote:

In short: screen numbers start at 0.

Maybe so, but the affected laptop only has one (built-in) screen and the config file has no effect unless I use Device1.

#17 Desktop and Multimedia » [SOLVED] Random Xorg crashes after upgrading to Daedalus » 2023-07-04 19:04:44

GNUser
Replies: 4

It seems that Xorg's latest modesetting driver does not play nice with old-ish (5th generation) integrated Intel graphics. One solution is to force Xorg to use its intel driver instead of the default modesetting driver.

If all of these are true for you:

1. You are experiencing seemingly random Xorg crashes (e.g., while using a chromium-based web browser such as Brave or Chrome) after upgrading to Daedalus

2. After an Xorg crash, /var/log/Xorg.0.log.old shows Fatal server error: (EE) GLSL compile failure

3. Your machine has 5th generation Intel integrated graphics (use inxi -Gx to find out. In my case, command output shows arch: Gen-5.75)

Then try creating /usr/share/X11/xorg.conf.d/09-force-intel-driver.conf with this in it (you may have to change Device1 to Device0):

Section "Device"
	Identifier "Device1"
	Driver "intel"
EndSection

and then reboot. In my case, all Xorg crashes went away.

I hope this helps someone with the same issue.

----------

Some additional details:

In my case, crashes could be reliably triggered by visiting certain product pages on amazon.com while using Brave or Chrome browser (e.g., "Risk: Lord of the Rings Trilogy edition"). Disabling "Use hardware acceleration when available" in the browser did not help. Building, installing, and using mesa-amber as described in this post did not help. Using nomodeset kernel boot parameter does make the crashes go away, but seemingly at the expense of disabling the GPU and losing hardware graphics acceleration.

Here is what I see at the end of /var/log/Xorg.0.log.old after a crash:

vec2 rel_tex_coord(vec2 texture, vec4 wh, int repeat) 
{
	vec2 rel_tex; 
	rel_tex = texture * wh.xy; 
	if (repeat == RepeatFix + RepeatNone)
		return rel_tex; 
	else if (repeat == RepeatFix + RepeatNormal) 
		rel_tex = floor(rel_tex) + (fract(rel_tex) / wh.xy); 
	else if (repeat == RepeatFix + RepeatPad) { 
		if (rel_tex.x >= 1.0) 
			rel_tex.x = 1.0 - wh.z * wh.x / 2.; 
		else if (rel_tex.x < 0.0) 
			rel_tex.x = 0.0; 
		if (rel_tex.y >= 1.0) 
			rel_tex.y = 1.0 - wh.w * wh.y / 2.; 
		else if (rel_tex.y < 0.0) 
			rel_tex.y = 0.0; 
		rel_tex = rel_tex / wh.xy; 
	} else if (repeat == RepeatFix + RepeatReflect) {
		if ((1.0 - mod(abs(floor(rel_tex.x)), 2.0)) < 0.001)
[    63.908] (EE) 
Fatal server error:
[    63.908] (EE) GLSL compile failure
[    63.908] (EE) 
[    63.908] (EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
[    63.909] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    63.909] (EE) 
[    63.909] (II) AIGLX: Suspending AIGLX clients for VT switch
[    63.968] (EE) Server terminated with error (1). Closing log file.

P.S. My other laptop, which has integrated Intel graphics Gen-7, is not affected by this problem.

#18 Re: Off-topic » Attention! MESA No more OpenGL Drivers Support for i915 » 2023-07-04 14:23:39

Thank you, HoaS. I found this thread and your excellent instructions while investigating Xorg crashes on an old Sony Vaio after upgrading from Chimaera to Daedalus.

For completion's sake, these are the steps I needed to follow after your instructions:
0. The debuild -us -uc step generates six new .deb packages.
1. Install the six new packages with sudo apt install *.deb. These new packages do not conflict with any of the currently-installed graphics packages, so there is no need to uninstall anything.
2. Add this line to /etc/environment: MESA_LOADER_DRIVER_OVERRIDE=i965
3. Reboot

After rebooting, inxi -G shows that mesa-amber is being used (i.e., you'll see that dri = i965 and mesa version = 21).

P.S. In my specific case, it seems mesa version 22 has nothing to do with the Xorg crashes, so mesa-amber unfortunately did not fix the problem. I'll describe my problem and its solution in a separate thread.

#19 Re: Devuan » Devuan 5 Daedalus Release (Debian 12 - Bookworm) | Looking for info » 2023-06-15 00:24:23

Yesterday I upgraded from Chimaera to Daedalus without any issues. Here are the steps I followed:

Edit /etc/apt/sources.list to point to daedalus
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade # at the end there are some errors having to do with old version of linux kernel
$ sudo apt-get autoremove --purge # this removes the packages that caused errors
$ sudo apt-get dist-upgrade # now it completes without any errors
$ sudo apt-get autoclean
Reboot

I only use the main component of the repository. In other words, my /etc/apt/sources.list now looks like this:

deb http://deb.devuan.org/merged daedalus main

Since I don't have packages from contrib or non-free, I cannot comment on the current upgrade experience if your Chimaera system includes packages from those components.

#20 Re: Desktop and Multimedia » [SOLVED] shell script to restart Xorg » 2022-11-21 17:14:35

Rant: Did you actually read this?

Option "DontZap" "boolean"
This disallows the use of the Terminate_Server XKB action (usually on Ctrl+Alt+Backspace, depending on XKB options). This action is normally used to terminate the Xorg server. When this option is enabled, the action has no effect. Default: off.

This illustrates exactly what I dislike about Xorg. Everything is overly complicated. This is not a human-friendly description. The header says the DontZap option is boolean, so expected default values would be "true" or "false", not "off" (what exactly is off?).

But all's well that ends well. Thanks to lightdm and sxhkd I don't have to deal with this smile

#21 Re: Desktop and Multimedia » [SOLVED] shell script to restart Xorg » 2022-11-21 17:09:55

I am familiar with the XY Problem, thank you. Not the case here, as the goal was to reimplement the old behavior with a shell script (or a simple shell command, as it turned out), not by tweaking Xorg config files. I love shell scripts and actually quite dislike Xorg, which I tolerate only out of necessity.

I use sxhkd for keyboard hotkeys. Binding sudo pkill Xorg to control + alt + BackSpace does exactly what I was looking for. Thanks again for the help.

#22 Re: Desktop and Multimedia » [SOLVED] shell script to restart Xorg » 2022-11-21 16:19:45

I figured it out. I just needed to add a line to /etc/lightdm/lightdm.conf. Now instead of just this in the relevant section:

[SeatDefaults]
autologin-user=bruno
autologin-user-timeout=0

I have this:

[SeatDefaults]
autologin-user=bruno
autologin-user-timeout=0
session-cleanup-script=service lightdm restart

With that added line, now all I need to restart Xorg is sudo pkill Xorg. Thanks for pointing me in the right direction, HoaS!

#23 Re: Desktop and Multimedia » [SOLVED] shell script to restart Xorg » 2022-11-21 16:06:55

Head_on_a_Stick wrote:

If you set up autologin for your user ... then killing X should do what you want.

If I run sudo pkill Xorg, then lightdm presents me with a login screen. This is unexpected, since lightdm is configured for autologin and does, in fact, automatically log me at every boot.

Can you help me configure lightdm so that it also automatically logs me in when Xorg is killed?

#24 Re: Desktop and Multimedia » [SOLVED] shell script to restart Xorg » 2022-11-21 15:56:49

I do have autologin enabled for my user, with this in /etc/lightdm/lightdm.conf:

[SeatDefaults]
autologin-user=bruno
autologin-user-timeout=0

I'd rather not ditch lightdm, since I would have to reconfigure multiple machines.

There's no actual problem. A few years ago, Xorg disabled Control+Alt+Backspace as the keyboard shortcut for restarting X (supposedly for security reasons). I liked having that shortcut because it was useful for the rare instances when X would freeze. If X acts up, I'd rather simply restart it than doing a full reboot. So the goal is to bring back that functionality by creating a script that works as intended, then binding it to Control+Alt+Backspace.

Wanting to get this script to work is mostly an exercise in getting my computer to do what I want it to do.

#25 Desktop and Multimedia » [SOLVED] shell script to restart Xorg » 2022-11-21 15:18:25

GNUser
Replies: 9

Hello, Devuan friends. I'm on Devuan Chimaera x86_64 with SysVinit, lightdm, Xorg 7.7, and MATE. I'm trying to write a shell script that restarts Xorg. Let's call it RestartX.sh

I already tried several variations of this:

#!/bin/sh
sudo service lightdm stop
sleep 1
sudo service lightdm start

I also tried:

#/bin/sh
sudo chvt 1
sudo pkill -f lightdm
sleep 1
sudo service lightdm start

And I also tried:

#!/bin/sh
sudo pkill Xorg
sleep 1
startx

I run the script in a terminal emulator like so: $ ./RestartX.sh & exit
X seems easy to stop but difficult to start from a shell script. Any ideas on how to make it work?

Board footer

Forum Software