(resolved) calling CRDA many times and failing on boot.

Having issues with your DietPi installation, or, found a bug? Post it here.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Fourdee »

Hi Gordon,

I've created a SystemD service.

This will set your country (using iw reg set) before network is brought up:

Code: Select all

#Set CRDA country code during boot.
cat << _EOF_ > /etc/systemd/system/set_crda_country.service
[Unit]
Description=Sets country for CRDA
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/iw reg set CA
StandardOutput=tty

[Install]
WantedBy=network-pre.target
_EOF_
systemctl enable set_crda_country.service
systemctl daemon-reload
Reboot. You should see your country code being used in the first instance of crda.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Gord_W »

Hi,

So, I tried the script that you gave me. In my ignorance I copied and pasted the your code to the command line and it didn't work.

I created a file in the dir with the contents show below and then ran
systemctl enable set_crda_country.service
systemctl daemon-reload


root@DietPi:~# cat /etc/systemd/system/set_crda_country.service
[Unit]
Description=Sets country for CRDA
DefaultDependencies=no

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/iw reg set CA
StandardOutput=tty

[Install]
WantedBy=network-pre.target
root@DietPi:~#


No change to dmesg

Two other things to note:
1) There is not longer any failures in dmesg at the end after the wifi comes up that I noted in my other thread.
2) proFTP no longer works. It is not shown in top.

Instead of setting iw reg set CA, can we set an environment variable that crda is looking for?

Gordon
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Fourdee »

Gord_W wrote:Hi,

So, I tried the script that you gave me. In my ignorance I copied and pasted the your code to the command line and it didn't work.

Hi Gordon,
We are not having much luck with your system lol. The code can be pasted in, not sure why its not being applied. We need to see if the service started.
Please run the following (we can check proftpd at the same time):

Code: Select all

systemctl status set_crda_country.service
systemctl status proftpd
Instead of setting iw reg set CA, can we set an environment variable that crda is looking for?

Gordon
We can try:

Code: Select all

cat << _EOF_ > /etc/profile.d/set_country_code.sh
#!/bin/bash
COUNTRY=CA
export $COUNTRY
_EOF_
chmod +x /etc/profile.d/set_country_code.sh
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Gord_W »

Both are dead. I also included the systemctl status that says "degraded". Also have 2 dropbears - Is that correct? Currently using ssh if that makes a difference for dropbears.
Gordon


root@DietPi:~# systemctl status set_crda_country.service
● set_crda_country.service - Sets country for CRDA
Loaded: loaded (/etc/systemd/system/set_crda_country.service; enabled)
Active: inactive (dead)

root@DietPi:~# systemctl status proftpd
● proftpd.service - LSB: Starts ProFTPD daemon
Loaded: loaded (/etc/init.d/proftpd)
Active: inactive (dead)


root@DietPi:~# systemctl status
● DietPi
State: degraded
Jobs: 0 queued
Failed: 1 units
Since: Wed 1969-12-31 19:00:04 EST; 45 years 10 months ago
CGroup: /
├─1 /sbin/init
└─system.slice
├─dbus.service
│ └─423 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
├─networking.service
│ ├─341 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -C /run/wpa_supplicant
│ └─391 dhclient -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases wlan0
├─systemd-journald.service
│ └─75 /lib/systemd/systemd-journald
├─systemd-logind.service
│ └─417 /lib/systemd/systemd-logind
├─system-getty.slice
│ └─getty@tty1.service
│ └─454 /sbin/agetty --noclear tty1 linux
├─systemd-udevd.service
│ └─92 /lib/systemd/systemd-udevd
└─dropbear.service
├─432 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -p 22 -W 65536
├─615 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -p 22 -W 65536
├─616 -bash
├─635 systemctl status
└─636 pager
root@DietPi:~#
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Gord_W »

For setting the env variable :(

I did:
root@DietPi:~# cat /etc/profile.d/set_country_code.sh
#!/bin/bash
COUNTRY=CA
export
root@DietPi:~# chmod +x /etc/profile.d/set_country_code.sh

Reboot failed again so I had to toggle power :(

On booting I now get:
gordon@gordon-linux ~ $ ssh root@192.168.1.111
root@192.168.1.111's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
declare -x HOME="/root"
declare -x LANG="en_CA.UTF-8"
declare -x LOGNAME="root"
declare -x OLDPWD
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
declare -x PWD="/root"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x SSH_CONNECTION="192.168.1.105 39309 192.168.1.111 22"
declare -x SSH_TTY="/dev/pts/0"
declare -x TERM="xterm"
declare -x USER="root"
-bash: /DietPi/dietpi/login: No such file or directory


root@DietPi:~# env
TERM=xterm
SHELL=/bin/bash
SSH_TTY=/dev/pts/0
USER=root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/root
LANG=en_CA.UTF-8
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=192.168.1.105 39309 192.168.1.111 22
_=/usr/bin/env
root@DietPi:~#

I'm going to have to restart with a fresh image and try again as it seems like the hole that we're digging is just getting deeper.
Gordon
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Fourdee »

Gord_W wrote:Reboot failed again so I had to toggle power :(
The system failed to reboot? Maybe a possible PSU / SD issue cropping up?
-bash: /DietPi/dietpi/login: No such file or directory
Definitely something got broke. Fresh install is a good idea.

Whats your PSU volt/amp and SDcard brand/model?
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Gord_W
Posts: 134
Joined: Sat Oct 24, 2015 6:30 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Gord_W »

Just to wrap things up.

Went back to Whezey and things are back to what they were. You need crda installed to prevent all the calling crda that makes for a long boot time. It still goes world,CN,CA, but I don't think that we are going to do anything better and with crda installed it is much better than before.

Interestingly I used another usb wifi dongle. It boots slightly faster as there is no crda nonsense, there are no ath9xxx modules and no cfg80211 module.

Most interesting though is this small realtek module during wifi file transfer uses a lot less CPU power. With the atheros module there is only 3% idle cpu while with the realtek module it is 28% idle. That is a pretty big difference. The difference is that the Atheros uses 25% of the rpi resources in the ksoftirqd and kworker treads. More processing must be done in the realtek wifi module, I suppose.

Thanks for your help,
Gordon Williams
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: (resolved) calling CRDA many times and failing on boot.

Post by Fourdee »

Hi Gordon,

Thanks for the info. This should help users looking to purchase a usb wifi device, and, possibly avoid Atheros based cards with high CPU usage.
Realtek seems to be the chipset choice for Jessie. My Edimax nano wifi is RTL8182cus. Has high latency, but never had an issue with it.

Regarding Jessie, I've patched DietPi to install cdra and iw previously, so all users will now have these installed by default.

Thanks for your assistance on this issue.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Post Reply