ubuntu base cann't excute the script of jetson_clock.sh in tx1 by r24.2.3

I implemented ubuntu16.04 base rootfs in tx1, but I get a problem when I execute jetson_cloks.sh
Like this

./jetson_clocks.sh 
./jetson_clocks.sh: line 218: echo: write error: No such file or directory
./jetson_clocks.sh: line 219: echo: write error: No such file or directory
Error: Failed to max GPU frequency!

The line 218 and 219 are:

echo $GPU_MAX_FREQ > /sys/kernel/debug/clock/override.gbus/rate                                                                                                                                          
echo 1 > /sys/kernel/debug/clock/override.gbus/state

But these two files is exist.
So I guess is that some services of gpu are not started, which leads to this problem.
I tried installing desktop such as xfce, after I run startx into the desktop, I run ./jetson_clocks don’t return any errors.I think entering the desktop will start some parameters of the gpu so that the clock’s file can be written, but I do not know what it is. Would you help me to solve this problem?

So far as I know jetson_clocks.sh does not require a GUI context. On the other hand, “/sys” itself may not be fully populated earlier on in boot, so there are stages where all of “/sys” does not exist, and stages where particular subsets of “/sys” won’t exist.

Do you get all “ok” from:

sha1sum -c /etc/nv_tegra_release

When you see the error, is it after the system is fully booted? This doesn’t mean you have to be logged in to a GUI session, but knowing if an ssh or serial console login is used, or perhaps if this is in a scripted location would help.

It might also be a permission issue. Be sure to run the script with root privileges

sudo /home/ubuntu/jetson_clocks.sh

cmd sha1sum -c /etc/nv_tegra_release is all ok.

sha1sum -c /etc/nv_tegra_release
/usr/lib/aarch64-linux-gnu/tegra/libnvosd.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_image.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmedia.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libglx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libscf.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvexif.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_gpu.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstorehdfx.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_parser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_contentpipe.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvos.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtnr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnet.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvavp.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_video.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvfnetstoredefog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvodm_imager.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtvmr.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvdc.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvapputil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcameratools.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcam_imageencoder.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstream_camconsumer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvomxilclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvwinsys.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus_socketclient.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnveglstreamproducer.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvll.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libargus_socketserver.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvrm_graphics.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcolorutil.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_2d_v2.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvtestresults.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamerautils.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvcamlog.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvparser.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvddk_vic.so: OK
/usr/lib/aarch64-linux-gnu/tegra/libnvmmlite.so: OK
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so: OK
/usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvideocodec.so: OK
/usr/lib/xorg/modules/drivers/nvidia_drv.so: OK
/usr/lib/xorg/modules/extensions/libglx.so: OK

By your means, the system has not been fully started yet. And I run this script through the serial port terminal.

So how can I debug the file system to make sure the system is fully up and the /sys is populated fulled?

Hello, I found out the root cause of this problem is gpu power management is enabled.Gpu is turned off by default when the kernel booting, When I run cmd startx, gk20a_pm_resume is called, and tegra_clk_gbus_ops is finally enabled. Is there any way to power on gpu by command, or power on gpu by default when kernel booting?

That would make sense. Although you don’t need a session the GPU does need to be powered before the clocks can be set.

I’ve never tried to do this, and I’m currently looking at a TX2 (running 28.2 so it should be a match for these purposes) this file seems relevant:

/sys/kernel/debug/bpmp/debug/powergate/gpu/state

When the GPU is powered this should contain “1” if the GPU is powered. Even if this is a writable file with the ability to power it when unpowered there will very likely be other restrictions. You can check for this being “1” and know it is up. It is a longshot, but you might be able to do this if it is not “1”:

sudo echo '1' > /sys/kernel/debug/bpmp/debug/powergate/gpu/state

(if you run this manually as a test when it is “0” then it won’t hurt to try, but I wouldn’t script it if you don’t know it will work)

Usually just waiting would do the trick, but it sounds like you are experimenting with removal or customizing of GUI login. If that doesn’t do the job then perhaps someone from NVIDIA can comment on what is needed to force GPU active…but you would have to closely describe your setup and when this needs to be available during boot.

Hello, That is no similar files have been found on my tx1 platform.My tx1 rootfs base on ubuntu service which hopied to wake up the gpu after the system started, and then execute the jetson_clock.sh .But Debugfs file system does not have such an interface to resume gpu

I looked around on a TX1 with R28.2, but also failed to find anything useful.

Normally jetson_clocks.sh can be used to set a default. Unfortunately, the default is in:

${HOME}/l4t_dfs.conf

Would someone from NVIDIA be able to suggest how the “l4t_dfs.conf” might be automatically installed during boot prior to any user logging in? I.e., how to decouple jetson_clocks.sh from any individual login requirement and without the error of running prior to “/sys” being fully loaded?

I think that l4t_dfs.conf file is created when this command is launched:

sudo jetson_clocks.sh --store

This saved config can be restored later with:

sudo jetson_clocks.sh --restore

jetson_clocks.sh with no arguments boosts clocks with max values read from sysfs. So if some sysfs nodes are missing or driver returns wrong values it would turn into problems. Maybe GPU driver isn’t ready for that before X has been started. Maybe someone from NVIDIA may comment this further.