Privileged mode question

I was able to use hwclock successfully with your Uno app. It’s as I said before if the root user is the one executing the application then you can use hwclock:

I used docker exec to get into your container and manually executed the application as root:

root@7ec0260cc3a3:/TestHwclock# dotnet TestHwclock.Skia.Gtk.dll
warn: Uno.UI.ResourceResolver[0]
      Couldn't statically resolve resource DefaultRepeatButtonStyle
warn: Uno.UI.Runtime.Skia.GtkHost[0]
      Unable to find icon file [/TestHwclock/ms-appx://logo] specified in the Package.appxmanifest file.
warn: Windows.UI.Xaml.UIElement[0]
      The BorderThicknessProperty dependency property does not exist on Uno.UI.Xaml.Core.RootVisual
hwclock from util-linux 2.36.1
System Time: 1651787504.012972
Trying to open: /dev/rtc0
Using the rtc interface to the clock.
Assuming hardware clock is kept in UTC time.
Waiting for clock tick... clock tick
Time read from Hardware Clock: 2022/05/05 21:51:45
Hw clock time : 2022/05/05 21:51:45 = 1651787505 seconds since 1969
Time since last adjustment is 1651787505 seconds
Calculated Hardware Clock drift is 0.000000 seconds
2022-05-05 21:51:44.511821+00:00

As you can see it works. Again you need to execute as the root user inside the container. If the application is executed by a non-root user then you see the permission issues as usual.

Best Regards,

Hi Jeremias,
Thank you very much for your investigations and response.
Could you please help, what changes should be done from VS Code project to execute this application as a root user. What we are doing now it just using the existing template and it looks like has some limitations.
Best regards,

There should be a property in the extension called user/username. You probably have it as the default of the torizon user.

Best Regards,

It works with test Uno application (TestHwclock)
This is what we tried to do with original application (App),
it could not run and provides the following:
root@c2a68635609c:/App# dotnet App.Skia.Gtk.dll
No protocol specified
No protocol specified
Segmentation fault (core dumped)
Our final application App based on Uno platform and Avalonia.
Looks like graphics does not run for root user?
best regards,

So your original application works with non-root but fails with root? That’s odd and I’m not sure why that would happen. Are you sure you’re executing it correctly?

Looks like graphics does not run for root user?

This doesn’t seem to be true. The test Uno application (TestHwclock) you provided ran a simple graphical app and that was able to be executed as root.

I’m not sure why you’re seeing this behavior, but it seems to be an issue with your Uno/Avalonia application that you’ll need to debug yourself.

Best Regards,

Thank you.
What is the default password for root user after the itstallation of TorizonCore?
Best regards.

Root has no active password and it’s actually not possible to login as root on TorizonCore. We do this for security reasons.

What you can do is login as another user then switch to the root user via sudo -i.

By the way keep in mind I’m talking about on TorizonCore outside of the container.

Best Regards,

Application GUI using X11 server and it cannot be run by root user by default because security reason.
I could not find a procedure which works for our setup. The initial question was how invoke hwclock from dotnet and run application as a root works, but creates a problem with GUI.
Does any other solution exists for hwclock? Here we have a bump when it accesses /dev/rtc0. May be bound/mount something will help?
Thank you.

Okay, initially your question started with how to use the --privileged flag and I assisted you here.

Then you asked about using hwclock in a container and I also helped here.

Then I assisted you with using hwclock from a dotnet app.

Now you’re asking help for your GUI app. This is now an issue with your application that you need to research and come up with a solution for. I don’t know or understand how your GUI application works as that is your code and logic. I don’t know why your Uno/Avalonia app fails to run as root. But the simple Uno UI by itself was able to run as root so this isn’t a general issue.

Maybe have one application/process that runs as root and access hwclock and then another that runs as non-root and runs your GUI, then devise a way to communicate the information between the two. It depends what you’re ultimately trying to do here.

Best Regards,

Thank you for the reply.
Best regards.