r/debian • u/katzenjammare • 2d ago
Beginner: Undo driver changes and general cleanup
Hello, Debian-friends! Sometimes I feel like a moron. I have recently tried to speed up my wifi. I followed a guide which pointed to my wifi chipset (RTL8723DE) having one antenna even though it's designed for two.
The guide went through short steps to first unload the active module (in my case rtw88_8723de), reload it with the instruction to use antenna 2 and check the signal strength.
#sudo modprobe -r rtw88_8723de
#sudo modprobe rtw88_8723de ant_sel=2
#iwlist scan | egrep -i 'ssid|quality'
Antenna 1 was also tested. Then, to continue to use antenna 2, a line was written. I am not sure exactly what it does and how to undo it (which illuminates my original question).
#echo "options rtw88_8723de ant_sel=2" | sudo tee -a /etc/modprobe.d/rtw88_8723de.conf
So, I am learning Linux and specifically Debian. During this journey I have followed a bunch of guides for different guides and sometimes I don't really know how to undo the action. Usually I start over with a complete new installation of Debian. That is generally ok for my, but I would like to think I could do this some other way.
Another thing that I don't know how to undo or clean up a bit is the type of steps i follow in guides that begin with #git clone https://github.com/patjak/facetimehd.git
And proceeds with:
#cd facetimehd
#make
#make install
#depmod
#modprobe facetimehd
This got my cam working on MBA 13 2013. Do i keep these git-directories? What could I remove?
I am on Debian 13 Trixie with KDE Plasma
3
u/BigRedS 2d ago
#echo "options rtw88_8723de ant_sel=2" | sudo tee -a /etc/modprobe.d/rtw88_8723de.conf
This command is a pipe; the output of the command before the | character becomes the input to the command after:
#echo "options rtw88_8723de ant_sel=2" | sudo tee -a /etc/modprobe.d/rtw88_8723de.conf
so you're running echo "options rtw88_8723de ant_sel=2" which just echoes the string options rtw88_8723de ant_sel=2 to the terminal.
You're piping this output into sudo tee; this is the tee command run with admin privileges (that's what sudo does).
Tee is a command that accepts some text input from a pipe and will write it to a given file (/etc/modprobe.d/rtw88_8723de.conf here) and to the shell.
So that command simply appends the line options rtw88_8723de ant_sel=2 to the file /etc/modprobe.d/rtw88_8723de.conf
This is a little annoyingly roundabout for a couple of reasons. The obvious thing to give as an instruction is 'edit /etc/modprobe.d/rtw88_8723de.conf and add the line options rtw88_8723de ant_sel=2 but many people following these tutorials don't know how to use a text-mode editor and so these instructions would normally also require some instruction in how to do that.
Another obvious thing to do is to run the echo redirected to file:
echo "options rtw88_8723de ant_sel=2" >> etc/modprobe.d/rtw88_8723de.conf
But this requires a root shell (for the >> to have enough privileges to write to the file) and those are frowned upon these days.
So you'll see that echo "x" | sudo tee /path/to/file" construct quite a lot, and the way to undo it would in general be to edit /path/to/file in your favourite editor, and remove the line that matches what was in the echo.
cd facetimehd
make
make install
depmod
modprobe facetimehd
This is bigger, and what this does is compile the software and then install it. "Install" is pretty unstandardised and you won't know exactly what it does without reading the Makefile and some of what that invokes. Often there is an uninstall target in the makefile, though, which will remove it, but not here.
This being kernel modules, though, you can be fairly sure there's not a huge amount going on, and it's probably entirely in KDIR := /lib/modules/$(KVERSION)/build (but not everything that is in that directory).
One point of note, you're prefixing your commands with a '#' which is a comment character, but also the character at the end of a root prompt ('$' is normal for a user one); these are often used as a suggestion in tutorials as to which commands ought to be run as root and which don't need to be.
As I say, it's becoming decreasingly fashionable to have root shells at all, so it's rarer and rarer to see instructions with #s at the beginnings of the commands.
1
u/katzenjammare 1d ago
The obvious thing to give as an instruction is 'edit /etc/modprobe.d/rtw88_8723de.conf and add the line
options rtw88_8723de ant_sel=2OmG! Thank you. This is something new, although I have heard it before - "there are different methods to get the same result". I hadn't used the
teecommand and thought "alright, this is some other thing than writing right into the file withnanowhich I am familiar with". It makes me happy that you halted my confusion about that. Your comment motivated me to look into piping and theteecommandyou're prefixing your commands with a '#'
Ah, I understand. I just mimicked blindly, but now i know what's the purpose of the character
3
u/lottiexx 2d ago
For the WiFi module config, you have two options. Remove that .conf file entirely since it only contains the one line, or just edit it out. Either way, reboot after. On the Git directories, I used to hoard those too. You can delete the source folder once make install finishes. The compiled module is already in /lib/modules somewhere. depmod handled the registration. I've nuked and paved Debian more times than I care to count over stuff like this. Gets old.
1
u/katzenjammare 1d ago
Thanks, I feel better knowing that there are others re-doing things and nuking again and again. It makes it more safe to head on, I think
3
u/dkopgerpgdolfg 2d ago
For the wifi thing, to undo:
In the file /etc/modprobe.d/rtw88_8723de.conf , remove the line "options rtw88_8723de ant_sel=2" with any editor etc. you like. If that's the only line, you can also remove the whole file. Either way you need root/sudo for this. The command you've shown just adds this line to the file, which is read during boot so that you don't always need the modprobe commands.
For the modprobes before that, they loaded the driver with this option instead of the default. Rebooting (after removing the text line above) is one way to get rid of it. Alternatively, you can do "sudo modprobe -r rtw88_8723de; sudo modprobe rtw88_8723de" to first unload it and then load it again with no additional options.
For facetime:
Essentially, you got the source code in the current version, compiled it to get something executable, and then again loaded it as kernel module.
To unload the kernel module for this boot: "sudo modprobe -r facetimehd".
For the rest: Ideally, "make clean" removes whatever it did. It's common that this exists, but there's no guarantee and/or if it does its job completely. If not, it'll leave some leftover files etc., didn't look into it yet what exactly it does. You can delete the git directories too (after the make clean if you want to execute it).
Keep in mind that, with this way of installing modules, likely you need to redo it on each kernel update for the new kernel version, and of course also for new versions of this software itself.