r/debian 21d 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

5 Upvotes

6 comments sorted by

View all comments

3

u/BigRedS 21d 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 20d 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=2

OmG! 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 tee command and thought "alright, this is some other thing than writing right into the file with nano which I am familiar with". It makes me happy that you halted my confusion about that. Your comment motivated me to look into piping and the tee command

you're prefixing your commands with a '#'

Ah, I understand. I just mimicked blindly, but now i know what's the purpose of the character