Klaus Knopper answers your Linux questions

Ask Klaus

Article from Issue 176/2015
Author(s):

Troubleshooting wireless problems, localizing your keyboard settings, and getting partition permissions right.

Wireless Woe

Klaus, I am baffled by a wireless problem. I have been using Fedora Linux since 2005 and have upgraded all versions from FC 6 through to my current version FC 20.

Yet, I have never got wireless cards to work successfully. My standard 100Mbps Ethernet card works brilliantly, never drops, and has a steady throughput of data when uploading or downloading to a NAS box or transferring data across my home LAN. I bought two USB wireless adapters and tried to use those only because I didn't want a wire trailing across the floor. So far, I have been very disappointed. Both cards do connect to my wireless hub, but the throughput is poor and the stability of the connection is not good even though the system says the strength of signal is good. To eliminate potential issues of weak signal and to ensure the wireless cards are good, I tried an experiment. I powered up my Acer notebook running Windows 7. I placed this beside my Linux desktop.

  1. The notebook connected using both the wireless cards and remained steady and gave a good throughput.
  2. I dropped all connections on the local hub so that only these wireless connections were present. The Windows box performed well, the Linux desktop was the same poor throughput and patchy connectivity.
  3. I swapped the Linux wireless USB to Ethernet and the connection was perfect.
  4. I tried the four USB connections on the desktop but saw no difference.

Now I am at a loss, as I am sure most people get wireless to work well. Attached is a dump of all the commands I could think of to show the hardware of one of the wireless USB devices and the network connections. Any advice on where to look next would be welcomed.

Keep up the column; it's one of the best parts of the magazine.

Thanks, Nik.

Before I answer the main part, let's go through the information you sent, which is also helpful for understanding possible side effects:

$ lspci
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.\
  RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 0c)

This is your Gigabit LAN adapter, which due to the other output uses the r8169 kernel module.

This LAN card requests a firmware file (Listing 1), which should be loaded by kernel+udev helpers from directory /lib/firmware/rtl_nic/* and is usually installed from the firmware-realtek package. If the firmware is missing, the NIC can show either poor performance – supporting only a limited range of speed settings – or even not respond to many commands. Because you said your LAN is OK, the firmware is probably correctly in place for the gigabit network card, and all is good on that front. I just mentioned it because the hardware support part for the Realtek WiFi adapter is quite similar.

Listing 1

Firmware File

 

For the WLAN adapter, you did not send much information, but I'll try guessing. The WiFi adapter's name is wlp0s18f2u3, as your included information suggests (Listing 2). For most other WiFi adapters, it's usually wlan0.

Listing 2

WiFi Adapter

 

The chipset in question is (probably) also from Realtek; the kernel modules used are rt2800usb and/or rt2x00usb, both of which require a firmware file in /lib/firmware. You need to check the output of dmesg shortly after booting to find out which firmware file is requested. It could be something like:

rt2x00lib_request_firmware: Info - Loading firmware file 'rt2870.bin'
rt2x00lib_request_firmware: Info - Firmware detected - version: 0.29

The WiFi adapter-specific firmware file – if it's too old or even too new – can be a possible cause of connection problems. This adapter has a few different firmware versions, some of which might need to be renamed to match the request. For example, I have a Realtek adapter that needs rt2870.bin version 0.229 copied to /lib/firmware, even though the adapter's name is completely different.

Check for availability of various firmware-realtek packages – newer or older – and experiment with different versions of the firmware file. The firmware file should re-upload automatically to the chip each time you unplug and replug the USB WiFi adapter. Just replace the old file (make sure you save a backup) in the /lib/firmware directory.

Another possibility could be that the WiFi signal is too strong. If this is the case, you can decrease your WiFi adapter's sending power,

$ iwconfig wlp0s18f2u3 twpower 5mW

or limit the bitrate from the maximum to something that works reasonably well:

$ iwconfig wlp0s18f2u3 rate 54M

This will help you find out if the problems are just retransmission errors caused by a too high autoselection of the bitrate.

You can see the current WiFi status with the command shown in Listing 3.

Listing 3

WiFi Status

 

Run this command several times. If you see the Tx excessive retries or one of the invalid … values increasing rapidly, the signal may be too weak, too strong, or the rate still set too high. Even with a lower transmission rate, you can still achieve much better throughput with less data re-sent because of errors.

Keyboard Settings

Dear Klaus, I tried out the Knoppix 7.5 DVD that was included in Linux Magazine issue 175. I really like the possibility to make a bootable stick of it, which also allows me to keep my files and modifications on it; this is really great. Unfortunately, I was confronted with an issue with the keyboard settings. I'd really like to boot the stick without having to enter each time:

knoppix lang=be

I tried the following scenarios, none of which worked well:

  1. I used

    dpkg-reconfigure keyboard-configuration

to set a Belgian keyboard; this did not work.

  1. I made a .bashrc with the line setxkbmap be; this approach only works if I open a terminal at least one time. It doesn't work, however, when I start using a graphical application (e.g., a browser) immediately after booting.
  2. I tried to modify the xorg.conf file by adding the following:

    Section "InputDevice"
      Identifier    "Generic Keyboard"
      Driver        "kbd"
      Option        "XkbRules"     "xorg"
      Option        "XkbModel"     "pc105"
      Option        "XkbLayout"    "be"
    EndSection

This does not work.

  1. I looked on the Internet, but the messages concerning setting the keyboard permanently all refer to older versions of Knoppix, which had a different desktop, so the methods are not useful for the new desktop.

Could you please tell me how to accomplish what I'm trying to do properly?

Kind regards and thanks in advance, Hugo Coolens Zottegem, Belgium

P.S. I also think it would be a lot more logical if changing the keyboard would be possible by going to the Start button menu | Preferences | Keyboard and Mouse. (Now there is nothing to set the right keyboard in that menu; I think it's the first place a new user would look for it.)

Hello, Hugo. Greetings to Belgium! :-) You are right that keyboard settings are an unexpectedly difficult topic in most operating systems because, except for a few vendor-specific USB keyboards, a keyboard lacks the ability to autodetect the layout. However, it is still the user's decision as to which layout he/she wants, and for some countries, an English keyboard is the most often desired default.

Because I have no reliable way to determine the "correct" keyboard layout by hardware detection, my approach is to set the layout that's most common for a specific language. The boot option

lang=two_letter_language_abbreviation

in Knoppix controls most of the locale settings for a country – keyboard layout, system messages, menu translations – to avoid lengthy boot option command lines.

Table 1 shows a more complete overview of Knoppix boot options concerning language and keyboard options. Therefore, if you boot with knoppix lang=be (or knoppix64 lang=be), your settings will be changed by /etc/init.d/knoppix-autoconfig to those shown in Table 2.

Table 1

Knoppix Boot Options

Knoppix Boot Option

Description

lang=de (or en, be, fr, pl, …)

Sets the default language and country codes, keyboard layout, time zone

keyboard=de (or en, be, fr, pl, …)

Sets the console keyboard

xkeyboard=de (or en, be, fr, pl, …)

Sets the keyboard for Xorg (graphics mode, all desktops default)

kdekeyboard=de (or en, be, fr, pl, …)

Sets the keyboard specific to KDE

Table 2

Default Settings for knoppix lang=be

Variable Setting

Description

COUNTRY="BE"

Country code for Belgium.

LANG="fr_BE.UTF-8"

Language is actually fr_BE.UTF-8, not be.

KEYTABLE="be2-latin1"

The text console keyboard layout is be2-latin1.

XKEYBOARD="be"

The keyboard layout for Xorg (all desktops default) is be.

KDEKEYBOARD="be"

KDE's keyboard will also use be.

CHARSET="utf8"

The character set for this language is UTF-8.

KDEKEYBOARDS="us,de(nodeadkeys),fr"

Alternate keyboards to show in KDE are us or de or fr layout.

TZ="Europe/Brussels"

The European time zone in Brussels.

This procedure saves you the need to edit several configuration files, including /etc/X11/xorg.conf and /etc/default/keyboard (which is used by Xorg to configure newly plugged in keyboards via udev). So, the process here is somewhat specific to Knoppix.

Now for the solution: To change the language/keyboard setting permanently in Knoppix, just change the bootloader's configuration file and set the lang= variable to lang=be. On a CD or DVD, this file is called boot/isolinux/isolinux.cfg, but after installation to a USB flash disk, it will be boot/syslinux/syslinux.cfg.

When you boot from a USB flash disk, the first partition containing the Syslinux bootloader's files will be mounted at /mnt-system, so you can edit the configuration with a text editor (e.g., Leafpad):

$ leafpad /mnt-system/boot/syslinux/syslinux.cfg

The start of this file looks like Listing 4.

Listing 4

syslinux.cfg File

 

You can simply change all occurrences of lang=en to lang=be (make sure you don't accidentally remove the spaces before and after the lang option and don't add newlines in the APPEND options). Save the file, and all future starts will use the lang=be boot option, thus changing translations and keyboard settings automatically.

If you want to keep the default language in English but still change the keyboard layout, you can add somewhere within the APPEND lines:

xkeyboard=be

In case you turned Knoppix into a regular hard disk installation using the "0wn" installer, the boot configuration file will be /boot/grub/menu.lst. In that file, the boot options follow directly after the KERNEL labels; otherwise, the procedure of changing language and keyboard layout is the same.

Partition Permissions

Hi Klaus: I am still a novice in Linux, with my experience being in 8-bit CP/M, 16- and 32-bit Windows and exploring Linux with that background.

I partitioned a drive with FAT32 and ext3 partitions, installed Windows then Linux Mint 16 Cinnamon (magazine edition). My Mint can mount directly (click in Nemo) all partitions except sda9 (labeled /spare). In the filesystem, the spare icon can be clicked to open that partition (sda9) and can be accessed as root.

What I want is to have it mountable for all applications to access like LibreOffice or Gnome Commander as I can with mounting Home or items in Nemo's Devices (the FAT32 parts and the floppy).

I would like to list it in Nemo under Computer, say, after Home or somewhere before Trash.

My sda1, sda7, sda8, and sda10 are FAT32, which Nemo listed under Devices. Any mounted are accessible to other applications. That is what I hope to set up for sda9 /spare. All I have read on mounting so far has been disconnected from my problem as far as I can understand it.

Any of my Knoppix 3.9 to 7.7.4.1 or other Live Linux DVDs will display my sda9 one way or another and allow me to read it.

I am guessing that editing the fstab order, putting my sda9 entry between root sda5 and /home sda11 may have something to do with it. Still, I am reluctant to edit just on guesses. I need to finish learning a few things on this LM16 before going on to Linux Mint 17.1.

Any suggestions would be much appreciated, as well as any suggested reading on such related matters.

Dee Shoolingin, Duncan BC Canada

Thanks for including the verbose /etc/fstab configuration (Listing 5). I think the problem has a rather simple solution, related to the way Unix systems handle permissions of files and directories.

Listing 5

/etc/fstab Configuration

 

The /etc/fstab entry tells me that the logical partition /dev/sda9 of your disk, which was labeled with a UUID of a1daddba-c125-4eea-b58c-99d617c0714f during the filesystem format process, will be automatically mounted read/write and contents appear at the /spare directory during system startup. Here, rw,auto are the filesystem options that hide behind the simple defaults word in that line (Listing 6).

Listing 6

Details of /spare

 

Now, after booting, if you enter the terminal and list the filesystem permissions of the /spare directory with

$ ls -ld /spare

you will most likely see something like Figure 1. This means that the mounted partition is accessible read-write for user root (the system administrator), read-only (no w) for group root, and also read-only (no w again) for all other users. I colored the permissions and access groups accordingly; the red part is the permissions for "all other users."

Figure 1: /spare filesystem permissions.

So, the problem is not that the partition is not writable at all but just that its partition root directory currently has permissions set that allow only write access for the administrator.

The chmod command lets you set the permissions of files and directories. To make the mounted directory writable, you have to call chmod as administrator (the "owner" of that directory) and allow (I think this is what you want) write access to every user for that directory:

sudo chmod a+w /spare

The command will add "write" permission for all. Because you need root access to make this change, you need to prefix the command by sudo.

If you start your favorite file manager in "system administrator" mode, you might be able to change the write permissions of the /spare directory just using the File Properties dialog (Figure 2). You don't need to do this for the FAT32 partition, simply because FAT32 (VFAT in Linux) does not support Unix permissions, so it is always accessible to everyone.

Figure 2: Setting permissions.

The /etc/fstab option umask=000 (same place as "defaults") would make sure the permissions are set to allow access to all users for filesystems that don't support Unix permissions. This is also true for NTFS. So, if you want to add NTFS permission later using ntfs-3g for read-write mount, the umask=000 option, which will remove all restrictions for all users during mount, may be handy.

For filesystems that support Unix permissions, the umask option doesn't work.

Klaus Knopper

Klaus Knopper is an engineer, creator of Knoppix, and co-founder of LinuxTag expo. He works as a regular professor at the University of Applied Sciences, Kaiserslautern, Germany. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Ask Klaus!

     

  • Ask Klaus!

    Klaus Knopper is the creator of Knoppix and co-founder of LinuxTag expo. He works as a teacher, programmer, and consultant. If you have a configuration problem, or if you just want to learn more about how Linux works, send your questions to: klaus@linux-magazine.com

  • Ask Klaus!

    Klaus Knopper answers your Linux questions.

  • Ask Klaus!

    Controlling brightness, forensic mode, and proprietary Broadcom WiFi drivers.

  • Knoppix 6.3 Exclusive!

    Knoppix creator (and Q&A mastermind) Klaus Knopper shares some insights on the latest release.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News