Yearly Archives: 2020


Lenovo Legion Y520 – Black Screen After RAM Upgrade to 32GB (2x16GB)

Recently, we updated the RAM modules of a Lenovo Legion Y520 from 16GB (2x8GB) to 32GB using two HyperX Impact DDR4 16GB, 2400MHz CL14 SODIMM modules.

Right after installing the new modules, after power on the laptop it would show a black screen, the fans would work at full speed but nothing else would happen. We tried placing the old RAM back inside but with no success, the same bad behavior would occur.

Since the battery of this laptop is bolted onto the chassis we thought that we might have to give it a “hard restart” or something to get it started.

Our solution

1) We powered off the laptop by long pressing the power button. 2) Then we released the button and long pressed it again until the laptop powered on and off again.
The next time we powered on the laptop it was working perfectly again!!


youtube-dl ERROR: unable to download video data: HTTP Error 403: Forbidden

Recently, we were getting the following error in youtube-dl :

ERROR: unable to download video data: HTTP Error 403: Forbidden

We weren’t sure what that error meant (in the case of youtube-dl as the video is public) so we updated pip and youtube-dl to be sure that our problem was not that. The commands we used were the following:

python -m pip install --upgrade pip;
pip install --upgrade youtube-dl;

After the updates, we still got the same error… After some google-fu we read that it could be a caching issue! We cleared the cache as follows:

youtube-dl --rm-cache-dir;

Guess what? After that, the problem was resolved and we were able to reuse youtube-dl.


“Cookies & Consents Banner (Jetpack)” not available!

We got prompted by the Jetpack plugin to add their Cookies & Consents Banner (Jetpack) to our website to comply with the rules and regulations for privacy issues but when we visited the Widgets tab we could not find it there to add it.

It appears that the module for Extra Sidebar Widgets of Jetpack was disabled. To enable it, we visited this page https://bytefreaks.net/wp-admin/admin.php?page=jetpack_modules and activated it from the list.

After that, we refreshed the Widgets page and a list of new widgets, including the Cookies & Consents Banner (Jetpack).

When adding it, it created a new page with some basic information and got our plugin up and running!


Monkey Problems 2

Recently, we tried to user monkeyrunner on an Ubuntu 18.04 LTS. We installed Android Studio through snap and we setup the Android SDK in ~/Andoid. monkeyrunner was installed in ~/Android/Sdk/tools/bin. To our immeasurable disappointment we found out that when we tried to execute monkeyrunner, it would give the following error:

$ ./monkeyrunner
-Djava.ext.dirs=/home/tux/Android/Sdk/tools/lib:/home/tux/Android/Sdk/tools/lib/x86_64 is not supported. Use -classpath instead.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

At first, we had no idea what that meant, so we used file command on monkeyrunner and we found out that monkeyrunner is a bash script.

$ file monkeyrunner
monkeyrunner: POSIX shell script, ASCII text executable

After reading the code, we read the following at the last lines:

#need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
#might need more memory, e.g. -Xmx128M
exec java -Xmx128M $os_opts $java_debug -Djava.ext.dirs="$frameworkdir:$swtpath" -Djava.library.path="$libdir" -Dcom.android.monkeyrunner.bindir="$progdir" -jar "$jarpath" "$@"

First thing we did was to find the java version that was used, since the command that was giving the problem was that. We found out that we had version 11.

$ java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)

After reading a bit, we found out that after Java version 8 the command line directive -Djava.ext.dirs it was deprecated and the recommendation to use -classpath was added. In the past, java.ext.dirs was used to instruct the JRE from where to load additional class and jar files. Since we had Java version 11 we had to try the recommendation to remove the -Djava.ext.dirs directive and use -classpath instead. So, we edited the file monkeyrunner and changed the last line as follows:

exec java -Xmx128M $os_opts $java_debug -classpath "$frameworkdir/*:$swtpath" -Djava.library.path="$libdir" -Dcom.android.monkeyrunner.bindir="$progdir" -jar "$jarpath" "$@"

We tried executing the newly updated monkeyrunner again, only to hit another wall!

$ ./monkeyrunner
Exception in thread "main" java.lang.NoClassDefFoundError: com/android/chimpchat/ChimpChat
at com.android.monkeyrunner.MonkeyRunnerStarter.(MonkeyRunnerStarter.java:60)
at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:188)
Caused by: java.lang.ClassNotFoundException: com.android.chimpchat.ChimpChat
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
… 2 more

It turns out that when you use the -jar directive, JRE will ignore the -classpath directive and so it will again not be able to load any external class or jar files…

Solution

Instead of reinventing the wheel (We tried, we failed, it was painful. Still worth the shot!) we decided to install Java version 8 on Ubuntu 18.04 LTS side by side with Java version 11 and just used that.

First, we checked the list of installed jvm on our machine using the following command:

update-java-alternatives --list;

Where we got the following:

$ update-java-alternatives --list
java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64

It turned out we already had Java version 8 but if we didn’t we would install it as follows:

sudo apt install openjdk-8-jdk;

and then it would again appear in the list mentioned above.

Then, we switched to the Java version 8 using the following command and selecting the appropriate option:

sudo update-alternatives --config java;

$ sudo update-alternatives --config java
[sudo] password for tux:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
0 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode

After switching Java to Version 8 monkeyrunner was working as expected!!