duminică, 19 decembrie 2021

Ubuntu 20.04 - A few things to do

1) Connect to VPN

In order for a VPN PPTP connection to work, you must do the following:

1) Edit /etc/ufw/before.rules

2) Add the following lines before segment # drop INVALID packets …
# gre
-A ufw-before-input -p 47 -j ACCEPT
-A ufw-before-output -p 47 -j ACCEPT

3) Save file

4) Restart ufw:
sudo ufw disable
sudo ufw enable

Now, a VPN client can be created from Network menu

joi, 6 decembrie 2018

Kubuntu 18.04 Remote Desktop Connection - from Windows and Linux

(1) Xrdp Server

Just type:
sudo apt install xrdp
sudo systemctl enable xrdp

Then you can use Windows Remote Desktop or Remmina on Linux to connect to your system
If you want acces from internet, open/route port 3389


(2) Google Chrome Remote Desktop Connection

Well, not much to be said here: you need Chrome, then just follow the wizards. The best part is that if associate it with your Google Account, you can easy use it across all your devices that support Chrome, and there is also a application for Android

In Windows it works out of the box. In Linux, however, there might be some things to do:

- You must add your user to group "chrome-remote-desktop"
- You must create a folder with the following command (apparently it's a bug and that's the sollution):
        mkdir ~/.config/chrome-remote-desktop
- It might not work with Ubuntu Unity, so I installed lxde
    sudo apt-get install lxde

After installation and configuration restart the system

luni, 22 octombrie 2018

Kubuntu 18.04 / KDE 5.12.6 - A few thoughts and things to do

[This post is a work in progress. I will add things until I change Linux version/distribution. Again]


1) KDE Desktop crashes when changing virtual destops. 
Apparently, the solution is to open System Setting > Desktop Behavior > Virtual Desktops > Switching and disable "Desktop Switching On-screes Display"

2) System enters stabdby on startup if the laptop lead is closed
I had that problem on OpenSuSE some yars ago. I thought it was solved years ago.
Edit the file /etc/systemd/login.conf and make sure you have the following uncommented lines:
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore

3) BlueTooth is always on by default
We SHOULD BE able to change the default value from BlueTooth interface. Well, in 2018, after so many years of developing operating systems, we are not. For me it's not working, but some said that the following worked:

Edit the file /etc/bluetooth/main.conf and make sure you have one of the following uncommented lines:
AutoEnable=false
InitiallyPowered = false

4) Prevent FPC/Lazarus from automatic updates
...Because it will be a mess.
sudo apt-mark hold fpc
sudo apt-mark hold fpc-src
sudo apt-mark hold lazarus



5) Speed up boot time
I managed to speed up boot time by doing the following:

a) Reduce the log history by limiting it to 5 days (not sure it is a good idea)
sudo journalctl --vacuum-time=5d

b) Delay the apt-daily.service which shouldn't run at startup. So...
sudo systemctl edit apt-daily.timer
...then paste this and save:
# apt-daily timer configuration override
[Timer]
OnBootSec=15min
OnUnitActiveSec=1d
AccuracySec=1h
RandomizedDelaySec=30min

Source: https://askubuntu.com/questions/800479/ubuntu-16-04-slow-boot-apt-daily-service


miercuri, 17 octombrie 2018

Lazarus/FPC/ compile from Kubuntu 18.04 (64) to Linux 32, Windows 64 , Windows 32

I have a Linux Kubuntu 18.04 64 bit version.

Compile to Linux 32

1)  sudo apt-get install libc6-dev-i386
   sudo apt-get install g++-7-multilib
   sudo apt-get install gcc-multilib

2) Create a text file on Desktop and name it script.sh (for example)
    Open the file with a text editor (Kate for example) and add the following text:

#!/bin/bash

# Create /usr/bin/i386-linux-ld
cat >/usr/bin/i386-linux-ld << EOF
#!/bin/bash
ld -A elf32-i386 $@
EOF
chmod +x /usr/bin/i386-linux-ld

# Create /usr/bin/i386-linux-as
cat >/usr/bin/i386-linux-as << EOF
#!/bin/bash
as --32 $@
EOF
chmod +x /usr/bin/i386-linux-as


   Save the file and close the editor.
   Right-click on file, ghive it all permissions and mark it as executable.
   Run the file.
   Run the following commands:
which i386-linux-ld
which i386-linux-as
   If they return the location of the files, then the script was successful

3) Run the following commands:
cd /usr/share/fpcsrc/<version> (in my case: cd /usr/share/fpcsrc/3.0.4)
sudo make all CPU_TARGET=i386
sudo make crossinstall CPU_TARGET=i386
sudo make crossinstall CPU_TARGET=i386 INSTALL_PREFIX=/usr

sudo ln -sf /usr/lib/fpc/<version>/ppcross386 /usr/bin/ppcross386
   Locate the file /etc/fpc.cfg end open it with a text editor (like Kate).
   Locate the following lines:
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/7
#endif 
  and modify them like this
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/7/32
-Fl/usr/lib32
#endif

   Save the file and close

4) create the following links (many thanks: https://tondrej.blogspot.com/2015/05/fpc-and-lazarus-development-environment.html) :

sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
sudo ln -s /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0 /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so.0 /usr/lib/i386-linux-gnu/libgdk_pixbuf-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0 /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 /usr/lib/i386-linux-gnu/libgobject-2.0.so
sudo ln -s /lib/i386-linux-gnu/libglib-2.0.so.0 /lib/i386-linux-gnu/libglib-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 /usr/lib/i386-linux-gnu/libgthread-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libgmodule-2.0.so.0 /usr/lib/i386-linux-gnu/libgmodule-2.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libpango-1.0.so.0 /usr/lib/i386-linux-gnu/libpango-1.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libcairo.so.2 /usr/lib/i386-linux-gnu/libcairo.so
sudo ln -s /usr/lib/i386-linux-gnu/libpangocairo-1.0.so.0 /usr/lib/i386-linux-gnu/libpangocairo-1.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libatk-1.0.so.0 /usr/lib/i386-linux-gnu/libatk-1.0.so
sudo ln -s /usr/lib/i386-linux-gnu/libglib-2.0.so.0 /usr/lib/i386-linux-gnu/libglib-2.0.so
 
Now it should work!



Compile to Windows 32

Simple and easy

cd /usr/share/fpcsrc/<version> (in my case: cd /usr/share/fpcsrc/3.0.4)
sudo make clean all OS_TARGET=win32 CPU_TARGET=i386
sudo make crossinstall OS_TARGET=win32 CPU_TARGET=i386 INSTALL_PREFIX=/usr
sudo ln -sf /usr/lib/fpc/<version>/ppcross386 /usr/bin/ppcross386



Compile to Windows 64

Just as simple and easy

cd /usr/share/fpcsrc/<version> (in my case: cd /usr/share/fpcsrc/3.0.4)
sudo make clean all OS_TARGET=win64
sudo make crossinstall OS_TARGET=win64 INSTALL_PREFIX=/usr
sudo ln -sf /usr/lib/fpc/<version>/ppcx64 /usr/bin/ppcx64

It might be necessary to edit the file /etc/fpc.cfg and add the following line:

-Fl/usr/lib/gcc/x86_64-linux-gnu/7


marți, 16 octombrie 2018

Kubuntu 18.04 - running 32 bit program on 64 bit system

In order to run 32 bit program on a 64 bit system, some packages are required. For me, the following commands did the job:
  sudo dpkg --add-architecture i386
  sudo apt-get update
  sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
  sudo apt-get install libgtk2.0-0:i386
  sudo apt-get install gnome-themes-extra gnome-themes-extra:i386

When installing a i386 package, if it announce you that it must remove some packages because they are no longer required, you should be careful: it might actually remove 64 bit packages and you will get a broken system. 

vineri, 29 decembrie 2017

Mint 18.2 / KDE Connect - firewall and writing permission

     In order for KDE Connect to work, the appropriate ports in Mint firewall must be opened. The simplest way to do it is trough command line like this:
     sudo ufw allow 1714:1764/udp
     sudo ufw allow 1714:1764/tcp
     sudo ufw reload
  

     Another problem with KDE Connect was an error about writing to file  /home/neklar/.local/share/user-places.xbel
Solution:
1. open Dolphin as root (sudo dolphin) and go to specified folder
2. right-click on files, Properties
3. in Permission section give to "Others" permission to read and write
4. click OK


sâmbătă, 21 octombrie 2017

From OpenSuSE 32 bits to Mint 64 bits: The Problems of Idealism

From 32 bits to 64 bits: the theory
After 8 (eight) years I decided that it is time to change my good old laptop. Not because it was not working anymore, but because it was just too old. So, I bought a new i5 with 4 GB RAM, 1 TB HDD and nVidia GeForce 940MX video card. 
Everybody is saying: 32 bits is dead, has no future, so switch to 64 bits as soon as possible. I keep hearing this for some years... So if I have a new system, let's install a 64 bits OS. And since OpenSuSE no longer came in 32 bits version and because I'm using it since 2011, the new SuSE Leap was the obvious choice...

From SuSE to Mint
I really don't know what's the problem with SuSE Leap. I'd prefer a longer release cycle in order to have a more trustworthy system. I knew that there will be some issues, but I never expected not to be able to install the nVidia drivers so that the system can work acceptable.
I started to install SuSE Leap... everything was fine. The video card started with the "nouveu" drivers, as expected... So I installed the proprietary nVidia ones. But the video card just didn't work. I tried everything I knew... I made another clean installation.. then another and then another. I read everything I could find on forums, blogs or articles. After 3 days and some 10 clean installations, I decided to try another distribution, because I was beginning to suspect that my new laptop might have an issue...
So, I downloaded Mint 64 (for a moment I even considered Windows), I installed it, and the first thing it asked me (after installation) was that if I want to use the proprietary nVidia drivers. I said yes, it installed something, asked for reboot, and... everything was just working! 3 days of failures were solved in less than one hour.
The reason I chose SuSE back in 2011 was that I liked that distribution: it was secure, reliable, faster than the popular Ubuntu (at least on m computer), "made in Europe" and I really loved YaST (I still do, it's superior to anything Mint had to show so far - my opinion, of course). By using it daily, it was my way of supporting it. But... I didn't have more days to spare, so "good bye SuSE". After all, Linux is, by definition, the freedom of choice. I just don't like the fact that I HAD TO change in stead of WANT TO. But that's the problem with idealism...

From 32 bits to 64 bits: the reality
Well, my idealism was about to be forced again. For years I was using Mozilla Firefox, for the same reason: I could choose. So, I chose to support a certain organisation (Mozilla) because Google does not need more support (it has plenty). Everything appeared to be fine, until I tried to play AngryBirds from Facebook. It wasn't working. I started to google for that error, only to find out that it was something about the 64 bits version. So, 32 bits is dead, 64 bits is the future, but the first is working and the other one is not?! Ok, I don' really need AngryBirds. Then I tried to access my Netflix account (I am also a StarTrek fan) and it wasn't working either. That moment I decided to give Chrome a try, to see if it's a Firefox problem, a 64 bit problem or a Linux problem. Like in SuSE case, everithing just vorked in Chrome (AngryBirds, Netflix, even HBO-Go, although I was told that HBO-Go does not work on Linux). Maybe those issues can be fixed; maybe there is a workaround; with no more time to spare, I uninstalled Firefox and made Chrome my default browser.
Another problem is with the 32 bits applications. They have to work. like I said, 32 bit is dead, but for some strange reason, everybody is still using it and most applications are still created for 32 bits OS. I don't know how many packages I had to install in order to get things work... maybe I will write another blog about this, if I can remember everything.
Then came my real problem and test: how many issues will I have with Lazarus on a 64 bits OS? Will I be able to compile my projects? In short? yes, but in another 3 days of try, error and search.

Ready to work. Really?
I installed Lazarus for Debian with very little problems, except for the software management of Mint (did I say that I miss YaST?). No problem, I'm starting to know how to use "apt-get install". I knew that there will be issues with the "integer" type, but again I had problems finding the documentation for 64 bits... everybody is writhing about the dead 32 bits version, with little reference to what might happen if you try to compile for 64 bits. My people has a saying with the following approximate translation: "about the dead ones we will say only good things".
So, I have to compile in Lazarus for 32 bit systems, both Linux and Windows. It took me about 3 days to figure it out and that's another story...