Fixing Fedora 24 dnf problems.

The short story:

If you are getting the following error when trying to install software using dnf in fedora 24:

python3: /builddir/build/BUILD/hawkey-0.6.3/src/python/exception-py.c:101: ret2e: Assertion `0′ failed.

You may try doing:

dnf --disablerepo=updates <package>

Where <package> is the thing you are trying to install.

The long story:

Today, I was working on a site on my newly installed Fedora 24, but the drupal-based site failed to show anything after I updated a block. All non-admin pages would just show blank. So I started tracking code, and at some point it occurred to me that maybe I had to run the update script, which fixed the problem. I still don’t know why updating the content of a block would cause the site to break, but my guess is that it has to do with drupal caches. This because the function that failed is called “block_page_build”. Anyway, before I could run the update script, drupal was complaining about some missing php components, so I wanted to install them.

I went ahead and did

dnf install php-xml

but that returned an error (see the short story above). I didn’t know what to do, so I started searching the web, but found nothing. Then I turned to the dnf manual. In there I saw you can add -v to get a more verbose output. Running dnf with -v got me this:

cachedir: /var/cache/dnf
 Loaded plugins: config-manager, protected_packages, generate_completion_cache, Query, builddep, langpacks, debuginfo-install, download, needs-restarting, playground, reposync, noroot, copr
 langpacks: No languages are enabled
 Error reading file : /var/lib/dnf/plugins/langpacks/installed_langpacks as it does not exist
 initialized Langpacks plugin
 DNF version: 1.1.10
 repo: using cache for: fedora
 not found deltainfo for: Fedora 24 - x86_64
 not found updateinfo for: Fedora 24 - x86_64
 repo: using cache for: google-chrome
 not found deltainfo for: google-chrome
 not found updateinfo for: google-chrome
 repo: using cache for: updates
 python3: /builddir/build/BUILD/hawkey-0.6.3/src/python/exception-py.c:101: ret2e: Assertion `0' failed.

Look at that! the problem happens right after trying to use the updates repo.

I had read in the dnf man page that there is a location where the repo files are kept, so I went and moved all update repos out of the directory where they are kept, and run dnf install again. It worked.

Well, all that was left to do was find a proper way to ignore repos when doing installs, and the man page had the answer: –disablerepo

So, that is the story. Keep coding kids.


Quick Linux Notes

It’s been a while since I wrote anything here. Today I want to leave a few pieces of wisdom for those who like pocking around their computers; specifically linux systems.

Yesterday, after trying to change the applications menu in LXDE, I ended up learning a few things about linux. Just to be clear about my current setup, I am using Fedora 20, with LXDE. That should be all that matters here. If you are using anything else, you may want to see if these bits of knowledge apply for your system as well.

1) It is not that easy to edit the applications menu. By application menu, I mean the little menu with the fedora logo that by default shows on the left end of the panel in LXDE. I remember that in ubuntu, or more specifically in Gnome classic, you had Applications, System, and Places. You could right-click on Applications, and there would be an option there to edit the menu. In LXDE, that does not exist.

According to the Main Menu documentation in the LXDE website, since version 1.2.0 of PCManFM, you can use this file browser to edit the menu by editing the Applications folder. I tried it, all I got was a message saying the operation is not supported. It may be necessary to open it as admin, but I didn’t try.

Apparently, this menu is built from .desktop entries on certain locations.The previously mentioned documentation says that one of those places is ~/.local/share/applications, so I decided to create a new entry there. The same documentation says that you have to delete the .cache/menus/* files. It doesn’t really say it, but it gives you a script that does just that. After doing that, my menu just disappeared, and trying to access the Applications folder in PCManFM would give a menu cache error. I had to restart the computer so that the menu would show up again. After restarting the computer, my new entry was added to the menu. Odly enough, after I restarted the computer, the item I was trying to add was already there, and my entry was too, so the item was duplicated. I think it was there all along, I just didn’t see it…

If you want to understand exactly how the applications menu is built, you can try to take a look at the source code for the lxdepanel menu plugin.

You can also open ~/.config/lxpanel/LXDE/panels/panel. This is the config file for the panel, but it is recommended that you don’t edit that file directly. I did though, and nothing broke.

2) Restoring default Launchbar. A few days ago, I was playing with the settings on the lxdepanel. To open up these settings, just right-click on the panel, and select the Add/Remove Panel Items option. That time I removed the last application launcher, which has the logout button, and the lock screen button. In my opinion, without those two buttons, the panel looks “naked”. It bothered me at the beginning, but then I decided to just leave it like that after trying to find those buttons again without any luck. Yesterday, I stumbled upon the default menu settings. Just open /usr/share/lxpanel/profile/LXDE/panels/panel and you will see the default settings there. From that point, it was just a matter of copying and pasting the last item on to my profile’s panel config file.

3) Read some good python. If you go to /usr/lib/python2.7/ you can read the python library. I think it is nice to be able to just read and learn from the official library. In my computer there is also a python3.3 directory next to the puthon2.7 one.

4) Find your trash directory. A few years ago, digging around an old computer, I found the trash directory, but since then I’d forgotten its location. More recently, I had been wondering how the restore functionality works — If you open the Trash Can in PCManFM, and right-click on an element there, you will see an option that says Restore. I wanted to know how the computer knew where the item was taken from. Now I know.

If you go to ~/.local/share/Trash/ You will see 3 directories there. We are interested in two of them:

The files directory keeps the actual files that have been moved to the trash. When you right-click a file, and choose the Delete option, you are just basically moving the file to this directory.

The info directory keeps an info file for each file in the files directory. This info file has two pieces of information: the path where it came from, and the deletion date. It is that simple. When you restore an item, the system simply reads the info file, finds where it came from, and moves it back there again. Then it deletes its info file.

Never be afraid to dig around your computer. There are many goodies waiting to be discovered. Follow one simple rule, don’t modify anything that you don’t understand, and you should be OK. If you have a spare computer, you should install some linux disto and experiment there knowing that if you break it, nothing is lost.

Finally, here is a list of documents you may want to read (some of them are gnome related):

Fixing Monitors in LXDE

Since I installed Fedora, I’ve been unable to run the computer with both, the external monitor, and the laptop monitor at the same time. So, I’ve decided to just run the external monitor, since it is bigger. I haven’t really spent too much time looking for a solution to this problem, but the times I’ve tried fixing it, I haven’t had any success.

Earlier this week, after getting tired of seeing a high amount or RAM usage, I decided to stop using GNOME, and use OpenBox without a desktop environment instead. This was easy to do. In the log screen, there is an option on the bottom where I have the options to use GNOME, LXDE, and OpenBox. I simply chose OpenBox. However, despite seeing a huge improvement on memory consumption, I was rather soon disappointed by the amount of configuration I had to do every time I turned the computer on. Sometimes I would have to log out, log into LXDE, change the monitor settings there, and see if that would work. The problem was that OpenBox would try to use both monitors, even when the external monitor was not plugged in! This cause me to not be able to see the windows, which by default would get placed in the area of the external monitor, but this would not get any signal.

As you may imagine, this quickly became too much trouble. Especially since there were no actual memory problems while running GNOME, I was just simply trying to reduce memory consumption.

Motivated by these inconveniences, I decided to give LXDE a try. LXDE also uses OpenBox as the window manager, but LXDE is a desktop environment, which means there is a lot of added benefit, such as a desktop, and a panel. All of this, while keeping memory consumption surprisingly low.

However, I made a mistake. I opened the Monitor Settings, and set the laptop monitor off by default, and the external monitor on by default. This had the same effect as OpenBox did. This time, however, I could not log into LXDE to fix it, since I was already in LXDE. I was effectively unable to see anything, since the output was being sent to the external monitor, but the monitor was receiving no signal.

Knowing that the settings must be saved somewhere, I decided to look into it. I opened the tty (ctrl+alt+F1), which fortunately runs on the laptop monitor, logged in, and decided to look in the ~/.config directory. I reviewed a couple of files before I decided to open ~/.config/autostart/lxrandr-autostart.desktop

This file has settings to start xrandr. Once I opened this file, it was just a matter of turning off the VGA-0 monitor, and turning on the LVDS monitor, which was turned off. Once I did this, I restarted the computer (sudo shutdown -r now), and I was able to login with a desktop. Then I opened the Monitor Settings again, and set the monitors to show only the external one, and apply the settings, but not save them.

I think I will have to do this every time I turn the computer on, but it may be worth it.

I still need to look for a solution that allows me to have both monitors at the same time, but for now that is not something I want to spend a lot of time on.