Monday, December 21, 2020

Wifi wont work after suspend in AntiX

My MSI Wind u90x laptop with Antix 19.3 installed has a Wi-Fi problem. Wifi does not reconnect after hibernate/sleep. Generally, Wi-Fi works fine, except for resuming from suspension. To be honest, earlier when I used Lubuntu 18.04, I had the same problem.

Solution #1

I found out that wifi works well if I shut off networking BEFORE suspend and shut on AFTER resume.
The terminal-command to do this: `sudo ifconfig wlan0 [down|up]`.
(In Ubuntu-based distros - `nmcli networking [on|off]`)

Solution #2

The previous solution can be automated using a shell script located in the /etc/pm/sleep.d/ directory.
I created /etc/pm/sleep.d/wifi-fix.sh with the following content:
#!/bin/bash

case "$1" in
suspend|hibernate)
    ifconfig wlan0 down
    ;;
resume|thaw)
    ifconfig wlan0 up
    ;;
esac

 

In case you want to know which device provides wireless capability on my laptop:
$ inxi -N
Network:   Device-1: Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet driver: r8169
           Device-2: Realtek RTL8187SE Wireless LAN driver: rtl818x_pci

Sunday, July 5, 2020

Problems with the Raspberry Pi USB drive

I use my RPI4 with an SSD drive via a USB 3.0 adapter. Usually, the drive works well until I find that all my USB devices are unmounted and I can't access the system. My USB keyboard didn't work and my USB drive was unmounted. And everything is fine after restarting the system until I start accessing the hard drive intensively.
I started researching this issue because I'm not sure about my no-name USB case, as well as the no-name SSD drive. I have collected all the information that will be useful for solving this problem with other devices.

How to investigate an incident

First of all, you should check the logs. The files /var/log/messages/var/log/syslog and /var/log/kern.log will return pretty much every event you could ever need to know to figure out what happened.

In my case all these files contained these messages:
Jul  4 14:48:10 microbox kernel: [ 1667.732392] xhci_hcd 0000:01:00.0: WARNING: Host System Error
Jul  4 14:48:15 microbox kernel: [ 1672.752064] xhci_hcd 0000:01:00.0: xHCI host not responding to stop endpoint command.
Jul  4 14:48:15 microbox kernel: [ 1672.752114] xhci_hcd 0000:01:00.0: xHCI host controller not responding, assume dead
Jul  4 14:48:15 microbox kernel: [ 1672.752462] xhci_hcd 0000:01:00.0: HC died; cleaning up
...
Jul  4 14:48:15 microbox kernel: [ 1672.753142] usb 1-1: USB disconnect, device number 2
Jul  4 14:48:15 microbox kernel: [ 1672.753162] usb 1-1.4: USB disconnect, device number 3
Jul  4 14:48:15 microbox kernel: [ 1672.754724] usb 2-2: USB disconnect, device number 2
Jul  4 14:48:15 microbox kernel: [ 1672.802164] sd 0:0:0:0: Device offlined - not ready after error recovery
...
Jul  4 14:48:15 microbox kernel: [ 1672.852093] print_req_error: I/O error, dev sda, sector 53777216
Jul  4 14:48:15 microbox kernel: [ 1672.852110] Buffer I/O error on dev sda, logical block 53777216, lost async page write
...
Jul  4 14:48:16 microbox kernel: [ 1672.886164] FAT-fs (sda): error, corrupted directory (invalid entries)
...
Jul  4 14:48:16 microbox kernel: [ 1672.887784] FAT-fs (sda): FAT read failed (blocknr 6640)
Jul  4 14:48:16 microbox udisksd[369]: Cleaning up mount point /media/pi/estorage (device 8:0 no longer exists)

All these messages told me that the xHCI host controller was not responding.

Cause of problems

I found that there are two possible reasons:
  • The power issue. The drive should be plugged into a USB hub with external power;
  • The drive does not support UAS commands. The user must disable the UAS for the device.
"Perhaps the on-board voltage is a marginal - try adding `over_voltage=1` to config.txt and rebooting."
"Just FYI, this issue is no longer occurring after disabling uas." (source)
"in certain situations the Linux "uas" driver disables SAT transfers, which prevents smartmontools (and other tools, e.g. hdparm) from communicating properly with the attached SATA device. " (source)
RPI4 uses UAS by default for all USB devices. I believe that UAS support was the cause of the problem in my case because the Linux kernel does not know whether the USB drive supports UAS or not, and relies on a blacklist of devices.

What is the UAS

"USB Attached SCSI (UAS) is an upgraded transport protocol compared to USB mass-storage - commands and data are separated into different queues and multiple outstanding commands can be in flight at the same time, as opposed to USB mass-storage's lock-step relationship between commands and data. This allows better saturation of the 4GBps USB3.0 transport as there can be a continuous stream of data to and from a device.
Prior to Pi 4, the USB host controller software did not support DMA scatter-gather operations. As a result of this limitation, the USB Attached SCSI (UAS) driver was not enabled. With Pi 4, as the xHCI driver does support scatter-gather and to get the most performance out of a USB3.0 attached SSD/disk we enabled UAS by default.
These errors may also appear due to poor power quality or overloading the Pi's maximum 1.2A downstream USB port current, but if they persist when using a powered hub then they are genuine UAS issues." (source).

Disabling UAS

To disable UAS support, users must specify idVendor and idProduct devices. The lsusb utility returns this information:
pi@microbox:~ $ lsusb
Bus 002 Device 002: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

For my USB drive, idVendor and idProduct are 152d:0578

Then the user must add the list of idVendor and idProduct pairs to the command in the /boot/cmdline.txt file:

pi@microbox:~ $ cat /boot/cmdline.txt
usb-storage.quirks=152d:0578:u dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

After restarting, the dmesg command should show that the UAS is disabled for the device:

[    1.208487] usb 2-2: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[    1.249773] usb 2-2: New USB device found, idVendor=152d, idProduct=0578, bcdDevice= 2.04
[    1.251726] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    1.252750] usb 2-2: Product: External USB 3.0
[    1.253780] usb 2-2: Manufacturer: JMicron
[    1.254797] usb 2-2: SerialNumber: 201703310007F
[    1.259165] usb 2-2: UAS is blacklisted for this device, using usb-storage instead
[    1.261360] usb 2-2: UAS is blacklisted for this device, using usb-storage instead
[    1.263519] usb-storage 2-2:1.0: USB Mass Storage device detected
[    1.265101] usb-storage 2-2:1.0: Quirks match for vid 152d pid 0578: 1800000
[    1.266408] scsi host0: usb-storage 2-2:1.0



Sunday, March 29, 2020

Citrix configuration issues on Linux

I have to use Citrix Workspace to launch a remote VM on my devices Windows and Linux. Unfortunately, I have some difficulties with starting VMs on Linux devices. I collected troubleshooting guides that help to configure the Citrix Workspace App on Ubuntu and Raspbian distributives. All of these environments have problems with certificates.

The error message "unknown error 1000119 verify your connection settings and try again" means that you need to update certificates of Workspace application.
You have to remove cacerts and link to /etc/ssl/certs by the following commands:
cd /opt/Citrix/ICAClient/keystore/
sudo rm -rf cacerts
sudo ln -s /etc/ssl/certs cacerts  
Taken from here

The error message "USERTrust RSA Certificate Authority SSL error 61" means that you have to share the certificate of the host used for connection with your Citrix installation. Because the application can not connect to the https resource due to the lack of the required certificates.
To fix this issue the user should follow this guideline.
(copy the certificate file to /opt/Citrix/ICAClient/keystore/cacerts and then execute command /opt/Citrix/ICAClient/util/ctx_rehash)

The dialog box for exporting the host certificate
Context menu to access the data of the host certificate


Sunday, January 12, 2020

Браузер для устаревших версий Windows

Пост на заметку. В контексте прекращения поддержки ОС Windows 7 компанией Microsoft встает вопрос какие браузеры можно использовать на этой версии ОС (Да и на других тоже). Chrome на Windows 7 будет поддерживаться только до июня 2021 года. С MacOS X до версии 10.10 понятнее, актуальные версии браузеров для этих версий ОС никто не выпускает.

360 Extreme Explorer (wikipedia) - единственный известный мне браузер поддерживающий линейку ОС виндовс от XP до Win10 (Windows XP / Vista / 7 / 8 / 8.1 / 10)

Friday, June 14, 2019

Installation of netsurf

Net-surf  is a lightweight browser with support of HTML4 and CSS2.1.
It is impossible to install net-surf from packages. So, the only way to use it on Ubuntu 18.04 is a compilation from sources. You need to download and extract the latest tar-ball from official web site .

I left here a short overview of the installation process.

Prepare your system:
sudo apt-get update
sudo apt-get upgrade

Install dependencies:
sudo apt-get install build-essential bison flex gperf libgtk2.0-dev libcurl4-openssl-dev libssl-dev libpng-dev libjpeg-dev libgtk2.0-dev

I have installed libcurl4-openssl-dev because I need in libcurl-dev which is shipping with packets:

  1. libcurl4-openssl-dev 7.58.0-2ubuntu3.7
  2. libcurl4-nss-dev 7.58.0-2ubuntu3.7
  3. libcurl4-gnutls-dev 7.58.0-2ubuntu3.7

List of dependencies.

Now the system is ready for installation:
cd netsurf-all-3.8
make
sudo make install

The application will be installed as /bin/netsurf-gtk . To execute you need to run netsurf-gtk.

By default javascript is disabled

Friday, May 31, 2019

Подборка статей прочитанных в мае

Data Science && ML

Почему каждый Data Scientist должен знать Dask
Описание python библиотеки для работы с массивами большого объема. Главная особенность данные могут свопится на диске. Пригодится когда требуется работать с датасетом значительно большим чем объем имеющейся оперативной памяти.

Clouds

Облачные сервисы для игры на слабых ПК, актуальные в 2019 году

Thursday, April 11, 2019

Terminal commands tips and tricks

Run the code in python or node.js

#: python -c "print 2+3"
#: nodejs -e "console.log(2+3)"

Launching a static web server in the current folder

#: python -m SimpleHTTPServer 8000

Work with the system clipboard

I use xsel utility to copy text in the system clipboard.
Copying the path of current folder with xsel:
#: pwd | xsel -b

To copy specific line and range of lines from a file:
#: sed -n '180p' file.txt | xsel -b
#: sed -n '180,182p' file.txt | xsel -b

Download collection of links

I use wget utility with i flag to download resources from the file one by one:
#: wget i <filepath>

Opening a image viewer from the console

#: gpicview <file path>
Where GPicView is a default image viewer in Lubuntu.

Terminal hot keys:

[Ctrl A] move to the beggining of the line

[Ctrl E] move to the end of the line