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.