Saturday, November 14, 2020

How to Fix Non-free Software Error in Debian

 As I mentioned last time, there is some tweaking to do when Debian is installed. Recently, I discovered another needed tweak one needs to do, especially if you need "Non-free" software for some firmware, in my case for my wifi on my HP Laptop. Previously, I tried to install Debian on my HP Laptop, but encountered this error message, which meant I wouldn't be able to use my system. That's when I decided to install Linux Mint Debian Edition on my laptop instead, because I knew it would work.

But it confused me somewhat, because to me, "Non-free" means I need to shell out some money to buy software for, something. Unfortunately, the version of Debian I downloaded (a Cinnamon enabled package), failed to tell me exactly what needed the "non-free" software, and it was the middle of the night and I needed to finish up so I could get some sleep. But, I needed a working system the next day, which is why I installed Linux Mint, because I was sure it would work out of the box.

But, on my Acer Asprire laptop, I was able to install Debian just fine, using the net installer version, which hooks you up to the internet to download most of the packages. So I assumed it was the version of Debian I tried to install, and I tried to install Debian again using the net installer. Yet, again, it encountered this error when I tried to install it, but unlike the previous time, it told me what firmware I needed. So, with that error on my HP Laptop, I opened my Aspire laptop and did some research on this error. Here is what I found out.

I discovered that "non-free" doesn't mean that you have to buy anything--rather it means that the firmware is proprietary software. I read that Debian doesn't enable this "feature" out of the box due to concerns about "non-free" software on their distribution. I found out that to solve this issue, you simply need to edit your repository list file, and add some additional text to the end of each line in the file. Here is the procedure to fix this problem.

First, you need to use a text editor to edit the source.list file. You can use your favorite editor, or use the following command line in a terminal (ensure the user has sudo privileges):

sudo nano /etc/apt/sources.list

Then on the end of each line that begins with "deb", tack on the following words after the "main" keyword:

contrib non-free

For example, one line commonly found in this list would be

deb http://deb.debian.org/debian buster main

When you've edited it, it should look like:

deb http://deb.debian.org/debian buster main contrib non-free

Once you've done that to every line in the file that starts with "deb", save the file edits under the same name, then enter first:

sudo apt update

then us sudo apt install to install your firmware. In my case, it indicated that I needed the:

sudo apt install firmware-iwlwifi

package.  So, with that information, I went ahead with the install, hooking my HP laptop to an Ethernet connection for its internet access, which worked fine. Once I installed Debian, I was able to follow the above steps to install the "non-free" software, then I was able to set up my wifi without further incident and disconnect the Ethernet cable. I'm typing on my Debian system right now, even!

Thanks for reading.

PS: You can reedit the file and take those words off the end if you do fear downloading other proprietary software in the future.

Monday, November 9, 2020

How to Enable Adduser on Debian

 I prefer to use adduser over useradd when possible. It simply is more logical to my mind. One time when I installed Debian, though I knew it was a Debian based program, when I typed in:

sudo adduser

All I saw in return is the "Program not found" or something similar. I discovered after checking on it using:

which adduser

. . . that it resided in the /usr/sbin directory. After doing a check on the $PATH environment variable using:

sudo env

My suspicions were confirmed--that /usr/sbin was not in the $PATH variable. Why doesn't Debian put it there by default? Hard to say. It appears that they do have the /sbin directory in the path, which should point to /usr/sbin since it is a symbolic link At any rate, not knowing at the time how Linux processed the $PATH and where I should put it, I proceeded to do some research. In DOS, everything used to go into the Autoexec.bat file, which always was run on startup. 

To make a long story shorter, what I discovered was that one: There was one difference between how the DOS and Linux path statements were used. For Linux, the big difference is you put "export" before the PATH= part. So the statement to add to the appropriate file is:

export PATH=$PATH:/usr/sbin

All caps on the PATH part is important, and the colon separates each entry. Putting $PATH on the right side of the =, appends what you add to it. So if the PATH statement echos out "/usr/bin" the resulting output from the above export statement would be "/usr/bin:/usr/sbin". The "export" command makes it usable beyond this one instance which is what you want.

Two: Where to put it? That turned out to be more complicated that one might think. There were multiple files to try. There is a file to put it in if you want only one user to use it, another for all users on the system except for root, and yet another if you only want root to have access to it. On top of that, the file you put it in can differ between major distributions. Like the Mandrake version I saw given as an example that one website used ".bash_profile" whereas in Debian, it is ".bashrc".

Since I figured where as the user programs are mostly installed in the /usr/bin directory, which was included in the PATH by default, that the /usr/sbin directory contained programs that would be more system type files that should primarily be accessed by a root user. So obviously, it would go in the root's home directory, which is at /root as it turns out. So, you would want to enter the following to edit that file in the root home directory:

sudo nano /root/.bashrc

Then add the line at the end of the file:

export PATH=$PATH:/usr/sbin

When I did that, it worked when I attempted to access the program from root using sudo, but not as just a simple user.

(Note: the period it begins with means it is a hidden system file. Use Ctrl-H in your file manager to see it or "ls -a" if using the command line.)

You can use

sudo env

To verify that /usr/sbin is now part of the $PATH variable. Now you should be able to run

adduser --help

As well as any other programs in the /usr/sbin directory!

May the Linux force be with you!