Re: X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-18 Thread John Radek
>
> > That means I managed to narrow down the issue. It’s firewall with
> > default policy DROP instead of REJECT. It also says something about Xorg 
> > doing
> > something on network I have no idea what
>
> OK, It's even weirder - it's not firewall. It's a network. When I
> disconnect RJ45, no issues, no freezes. When I connect it back and
> start using GUI app from within LXC container, it starts freezing. I
> need to narrow down if it's Network Manager or maybe it's just when a
> host network interface has IP...

It's DNS on host ("> /etc/resolv.conf" fixes the problem). I know I
have some issues with the DNS but I had no idea that this might have
such an effect. So Will was right - DNS. I just didn't realize I
should debug DNS outside of a container (on host) ;-).

Thank you both Marco and Will!



Re: X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-18 Thread John Radek
> That means I managed to narrow down the issue. It’s firewall with
> default policy DROP instead of REJECT. It also says something about Xorg doing
> something on network I have no idea what

OK, It's even weirder - it's not firewall. It's a network. When I
disconnect RJ45, no issues, no freezes. When I connect it back and
start using GUI app from within LXC container, it starts freezing. I
need to narrow down if it's Network Manager or maybe it's just when a
host network interface has IP...

JR



Re: X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-17 Thread John Radek
> On Wed, 17 Jun 2020 at 17:23, Marco Möller 
>  wrote:

> You will need to study the relevant documentation first. You then will
> find why two of the parameters are equal to "0" (it is because others
> are in use..., I mentioned already that there are more parameters
> present and I only mentioned some of them to provide you the key words
> for your research). I am sorry for not having time to explain everything
> here on the list, but I know that you will find a lot of information
> published and discussed already. This could be one of the many entry
> points into your studies:
> https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/
> Sorry for not being able to answer in more detail, I am simply not
> having time for it right now. :-(  But at least you got some idea where
> you could search for a solution. I am not even sure if this will solve
> your problem, but at least you have this idea now on your list.
> Best wishes, and good luck! Maybe others can contribute more ideas
> and/or solutions!
> Marco.

Thank you very much Marco. After changing many things including filesystem and
disk the containers are running on... It’s not storage! ;-)

E-mail from Will about DNS timeouts let me think about network
timeouts in general.
My containers usually don’t have network access. They don’t even have network
interface which means if you run “ip link” inside of LXC container you
get just “1: lo:”.

BUT on host I have custom config in /etc/nftables.conf. I disconnected
the testing laptop from internet and I cleared ALL rules in /etc/nftables.conf
and after fresh reboot I tested GUI app in a container again. And NO ISSUES!

That means I managed to narrow down the issue. It’s firewall with
default policy DROP instead of REJECT. It also says something about Xorg doing
something on network I have no idea what

Of course I don’t want to disable firewall on my other laptops that are not
for testing only so I need to get logs from Nftables and make sure they’re
REJECTing and not DROPing and therefore they don’t cause timeouts. Or maybe
I can change Xorg behavior but I assume it’ll be easier
to reconfigure nftables...

Thank you both Marco and Will!

Kind regards,
JR



Re: X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-17 Thread Marco Möller

On 16.06.20 12:59, John Radek wrote:

On Tue, 16 Jun 2020 at 09:41, Marco Möller  
wrote:
sudo sysctl vm.swappiness=
sudo sysctl vm.vfs_cache_pressure=
sudo sysctl vm.dirty_background_bytes=
sudo sysctl vm.dirty_bytes=


Thank you Marco.

I checked my current values

---
sudo sysctl vm.swappiness
# vm.swappiness = 60

sudo sysctl vm.vfs_cache_pressure
# vm.vfs_cache_pressure = 100

sudo sysctl vm.dirty_background_bytes
# vm.dirty_background_bytes = 0

sudo sysctl vm.dirty_bytes
# vm.dirty_bytes = 0
---

but I haven't changed anything yet. Will try to change something and
let's see what is going to happen.





On Tue, 16 Jun 2020 at 10:16, Will Mengarini  wrote:


30 s is suspicious for a DNS timeout, but I don't know
how to identify what's causing it.


Thank you Will. It's not exactly 30sec - sometime it's just 5-10sec,
sometime it is even longer than 30sec.

But that made me think since the container has no interfaces / no IPs
(except localhost).
In Ubuntu container I stopped and disabled systemd-resolvd and add a network
interface with static IP 10.33.44.55 and in /etc/resolv.conf I set the same IP.
Nothing it listening on 53 inside LXC so if a program requests DNS
the request should get immediately refused (no timeout).
But unfortunately that  didn't help. But thank you for trying!




Meanwhile I setup testing laptop. I have identical Debian Buster setup
on multiple laptops
(all have the same issue) so I'm connecting the testing laptop from
the main laptop over SSH.
On testing laptop I'm clicking inside VSCodium to trigger the freeze
and meanwhile I'm in LXC
container (lxc-attach over SSH) from main laptop. I can confirm that
when I'm attached
the system is responsive during the freeze so it's really just GUI,
not the system.

Kind regards,
JR

You will need to study the relevant documentation first. You then will 
find why two of the parameters are equal to "0" (it is because others 
are in use..., I mentioned already that there are more parameters 
present and I only mentioned some of them to provide you the key words 
for your research). I am sorry for not having time to explain everything 
here on the list, but I know that you will find a lot of information 
published and discussed already. This could be one of the many entry 
points into your studies:

https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/
Sorry for not being able to answer in more detail, I am simply not 
having time for it right now. :-(  But at least you got some idea where 
you could search for a solution. I am not even sure if this will solve 
your problem, but at least you have this idea now on your list.
Best wishes, and good luck! Maybe others can contribute more ideas 
and/or solutions!

Marco.



Re: X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-16 Thread John Radek
> On Tue, 16 Jun 2020 at 09:41, Marco Möller 
>  wrote:
> sudo sysctl vm.swappiness=
> sudo sysctl vm.vfs_cache_pressure=
> sudo sysctl vm.dirty_background_bytes=
> sudo sysctl vm.dirty_bytes=

Thank you Marco.

I checked my current values

---
sudo sysctl vm.swappiness
# vm.swappiness = 60

sudo sysctl vm.vfs_cache_pressure
# vm.vfs_cache_pressure = 100

sudo sysctl vm.dirty_background_bytes
# vm.dirty_background_bytes = 0

sudo sysctl vm.dirty_bytes
# vm.dirty_bytes = 0
---

but I haven't changed anything yet. Will try to change something and
let's see what is going to happen.




> On Tue, 16 Jun 2020 at 10:16, Will Mengarini  wrote:
>
>
> 30 s is suspicious for a DNS timeout, but I don't know
> how to identify what's causing it.

Thank you Will. It's not exactly 30sec - sometime it's just 5-10sec,
sometime it is even longer than 30sec.

But that made me think since the container has no interfaces / no IPs
(except localhost).
In Ubuntu container I stopped and disabled systemd-resolvd and add a network
interface with static IP 10.33.44.55 and in /etc/resolv.conf I set the same IP.
Nothing it listening on 53 inside LXC so if a program requests DNS
the request should get immediately refused (no timeout).
But unfortunately that  didn't help. But thank you for trying!




Meanwhile I setup testing laptop. I have identical Debian Buster setup
on multiple laptops
(all have the same issue) so I'm connecting the testing laptop from
the main laptop over SSH.
On testing laptop I'm clicking inside VSCodium to trigger the freeze
and meanwhile I'm in LXC
container (lxc-attach over SSH) from main laptop. I can confirm that
when I'm attached
the system is responsive during the freeze so it's really just GUI,
not the system.

Kind regards,
JR



Re: X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-16 Thread Marco Möller

On 16.06.20 10:11, John Radek wrote:

It usually takes 30sec and then the desktop unfreeze and everything is
fine again.


This could be caused by the "vm.swappiness", "vm.vfs_cache_pressure" or 
"vm.dirty" settings. These could be configured permanently in 
/etc/sysctl.conf  or  /etc/sysctl.d/myfile.conf , but it is also 
possible to adjust them only temporarily until the next boot.


You could show some of the relevant values (there are more than the ones 
which I list here!) by these commands:

sysctl vm.swappiness
sysctl vm.vfs_cache_pressure
sysctl vm.dirty_background_bytes
sysctl vm.dirty_bytes

For adjusting them temporarily:
sudo sysctl vm.swappiness=
sudo sysctl vm.vfs_cache_pressure=
sudo sysctl vm.dirty_background_bytes=
sudo sysctl vm.dirty_bytes=
I did not write values behind the "=", but of course you have to write 
your values there (I removed my values, because mine are only valid for 
my hardware).


Sorry, I cannot help you more than pointing you to this potential 
solution. I am not experienced enough to give a recommendation on the 
values which you for this parameters should use in your situation. I 
figured out mine for my very old hardware by studying the documentation 
followed by some promising guess and then observing if the freezes which 
occurred to the responsiveness of my desktop GUI disappeared. Well, if 
someone would know which values to recommend for your special situation, 
then I would be curious to read about it.

Good Luck!
Marco



X11 / KDE Plasma 5 periodically freezes when I use GUI app inside LXC container

2020-06-16 Thread John Radek
Hi Everybody ;-),

---
TL;DR: Could you please help me to get logs / trace or debug X (or KDE Plasma 5)
that is freezing when I run (and actively use) X app inside LXC container?
---

I'm trying to run GUI apps inside LXC container. I know that there are other
ways (snapd) but I really like the idea of LXC...

I followed the following guide:
https://gudok.xyz/lxcdeb/#_x11_applications_via_unix_socket
since it is almost exactly mirrors my setup.

My setup is:

- Debian Buster with KDE Plasma 5 with LXC container running
Debian 10, Debian 11 and Ubuntu 20.04 (I tested them all)

- I have same user in the container (same username and UID) as outside the
container with 1:1 UID mapping for this user.
I also tried to run GUI apps as root inside the container.

-
lxc.idmap = u 0 10 1000
lxc.idmap = g 0 10 1000
lxc.idmap = u 1000 1000 1
lxc.idmap = g 1000 1000 1
lxc.idmap = u 1001 101001 64535
lxc.idmap = g 1001 101001 64535

lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none ro,bind,create=dir 0 0
lxc.environment = DISPLAY=:0
lxc.environment = XAUTHORITY=/home/my_user_name/.Xauthority

# optional (works both with and without this):
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file
-

I was pleasantly surprised that after following the guide I was able
very quickly lunch GUI apps.
The problem that I'm facing is that when I start using the app my
desktop sometimes
completely freeze for approx 30sec. I tested "retext", "meld" and "VSCodium"
and a few other apps... It's all the same.


I know that it's only GUI (not the Linux) that freezes. For example
when I played video in VLC outside of the container and the freeze
happened - the VLC window froze with rest of the screen but I still heard
the audio.


It usually takes 30sec and then the desktop unfreeze and everything is
fine again.
During the freeze I can see / move with mouse cursor and when I click on for
example inactive window then the window becomes active after the freeze
which tells me that the desktop responds but I can’t see the change
during the freeze.


I'm not asking anyone to debug this complicated setup since I
understand that it's
complicated. There are too many layers - Xorg, KDE Plasma, LXC and
it's difficult to say what exactly is misbehaving.


Can somebody please just tell me how to narrow down to app/configuration
that is causing issues?


I tried following:

- Host: tail --follow /var/log/Xorg.0.log
- Host: sudo journalctl --follow
- Inside LXC cont.: journalctl --follow

But I don't get anything interesting when/after the freeze happens.

Thank you very much for any suggestions.

JR