GithubHelp home page GithubHelp logo

Comments (10)

BahaminShahriari avatar BahaminShahriari commented on May 27, 2024 1

Hold up a minute... is the error still happening? I'm not seeing that error while you run the commands.

Those errors only appears after I use source ~/.bashrc command, and they will go away if I open a new Konsole.

I mean, the Java works perfectly if I write a bash script to locate the java bin first then locate my java file after using -java command, but it does not open the Java file by double clicking as it's not added to PATH correctly.

/etc/profile.d/flatpak-bindir.sh
/etc/profile.d/flatpak.sh
/etc/profile.d/freetype2.sh
/etc/profile.d/gawk.sh
/etc/profile.d/gpm.sh
/etc/profile.d/kde.sh
/etc/profile.d/libva.sh
/etc/profile.d/locale.sh
/etc/profile.d/perlbin.sh
/etc/profile.d/steamos.sh

All these bash scripts are seeming to be default files, as I didn't touch them manually. But there might be something that decky loader have done to them, I'm not quite sure.

from install-jdk-on-steam-deck.

BlackCorsair avatar BlackCorsair commented on May 27, 2024 1

hey! I'm sorry I let you waiting for so long @BahaminShahriari

@rasitayaz

might be an issue related to the default .bashrc of steamos at the stable channel

It is! Just checked with my own SteamDeck, which I didn't reinstall the OS since it came to me on October 2022, and I had the following:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

After pasting the bashrc from @BahaminShahriari (I asumed that we all had the same file) , I've also encountered the same error. But the error persists even I you don't run my script or even if you "uninstall" it.

Your bashrc appears to be the same as the one in /etc/bash.bashrc, only that the one I have in /etc also has the following line:

[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion

Which just checks that the bash_completion exists before loading it.

The issue is definitively this line:

PROMPT_COMMAND="__steamos_prompt_command '$PS1'${PROMPT_COMMAND:+; $PROMPT_COMMAND; }"

I'm not really sure why they're concatenating the PROMPT_COMMAND, but that line is the issue.

On the bright side, even if you don't use source ~/.bashrc you can start using the java installation as soon as you open a new terminal or a new bash shell... but that isn't really a solution.

What I've found it works, it's removing the '${PROMPT_COMMAND:+; $PROMPT_COMMAND; }. Once it's no longer on the file, I'm not encountering anymore the issue. I'll try to get in touch with valve asking about the bashrc so they may enlighten us.

@rasitayaz

also, shouldn't JAVA_HOME be set to /home/deck/.local/jdk/jdk-17.0.8 instead of /home/deck/.local/jdk?

Looking at oracle's page I think it's fine. Although it's true it should be better to use the $JAVA_HOME variable instead in the PATH variable instead of setting the full path... DRY

From this issue I'll make a PR removing the source ~/.bashrc part of the guide until this is worked out. Also I'll finally add the "how to uninstall" guide and maybe later a script.

BR

from install-jdk-on-steam-deck.

BlackCorsair avatar BlackCorsair commented on May 27, 2024

Hi @BahaminShahriari ,
Could you post me your ~/.bashrc here? Please make sure that there isn't any credentials or secrets before posting it.

To temporary "fix" the warnings, open a konsole terminal and run sh. It will run a different 'shell' that won't load (or shouldn't) your .bashrc which contains errors.

from install-jdk-on-steam-deck.

BahaminShahriari avatar BahaminShahriari commented on May 27, 2024

Sure, I checked a few times for sensitive information, I didn't spot any, and let's hope I'm not wrong about it 😄
Here you are;

#  SPDX-License-Identifier: MIT
#
#  Copyright © 2020-2021 Collabora Ltd.
#  Copyright © 2020-2021 Valve Corporation.
#
#  This file is part of steamos-image-recipes.
#
#  steamos-image-recipes is free software; you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published
#  by the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
if command -v grep >/dev/null
then
	alias grep='grep --color=auto'
fi
PS1='(\u@\h \W)\$ '

# Hack for the Qemu serial
if [[ $(tty) == /dev/ttyS0 ]]
then
	TERM=linux
	eval "$(resize)"
fi

ischroot() {
	local proc_root
	local root

	if ! proc_root="$(stat --printf "%d %i" /proc/1/root/ 2>/dev/null)" ||
	   ! root="$(stat --printf "%d %i" / 2>/dev/null)"
	then
		return 1
	fi

	test "$proc_root" != "$root"
}

isremovable() {
	local devname
	local devpath
	local name

	if ! devname="$(realpath "$1")"
	then
		return 1
	fi

	if ! devpath="$(realpath "/sys/class/block/${devname##*/}")"
	then
		return 1
	fi

	if ! test -e "$devpath/removable"
	then
		devpath="${devpath%/*}"
	fi

	if ! test -e "$devpath/removable"
	then
		return 1
	fi

	if grep -q 0 "$devpath/removable"
	then
		return 1
	fi

	mapfile -t name < <(cat "$devpath/device/vendor" "$devpath/device/model" 2>/dev/null)
	name=("${name[@]//  /}")
	name=("${name[@]%% }")
	name=("${name[@]## }")
	echo "${name[@]}"
}

__steamos_ps1() {
	local read_only
	local partset
	local root
	local name
	local args
	local arg

	PS1="$1"

	# Check if user is root
	if [[ "$EUID" -ne 0 ]]
	then
		return
	fi

	# Set partition set to prompt
	read root partlabel < <(findmnt --noheading --output SOURCE,PARTLABEL /)
	if [[ "$root" ]]
	then
		# Set removable media name to prompt
		if name=$(isremovable "$root")
		then
			PS1="(\[\033[36;1m\]$name\[\033[0m\])$PS1"
		fi

		# Extract the color from the file os-release
		eval "$(. /etc/os-release; echo local ANSI_COLOR=\"$ANSI_COLOR\")"
		partset="${partlabel#rootfs-}"
		if steamos-readonly status | grep -q "enabled"
		then
			read_only=1
		fi
		if [[ "$partset" ]] && [[ ! "$read_only" ]]
		then
			partset+="+"
		fi
		if [[ "$partset" ]]
		then
			PS1="(\[\033[${ANSI_COLOR}m\]$partset\[\033[0m\])$PS1"
		fi
	fi
}

__steamos_prompt_command() {
	# Preserve return code
	local rc="$?"
	local ps1="$1"
	local partset

	# Set chroot to prompt
	if ischroot
	then
		partset="$(findmnt -no partlabel /)"
		partset="${partset#rootfs-}"
		ps1="(\[\033[33;1m\]chroot[$partset]\[\033[0m\])$ps1"
	fi

	# Set return code to prompt
	if [[ "$rc" -ne 0 ]]
	then
		ps1="(\[\033[31;1m\]$rc\[\033[0m\])$ps1"
	fi

	# Set PS1
	PS1="$ps1"

	return "$rc"
}

__steamos_ps1 '(\[\033[1;32m\]\u@\h\[\033[1;34m\] \W\[\033[0m\])\$ '
PROMPT_COMMAND="__steamos_prompt_command '$PS1'${PROMPT_COMMAND:+; $PROMPT_COMMAND; }"
[[ -f ~/.profile ]] && source ~/.profile

Thanks for your time.

from install-jdk-on-steam-deck.

BlackCorsair avatar BlackCorsair commented on May 27, 2024

it's a bit weird, I ran your .bashrc without problems. Do the following and post me all the outputs:

  • ls -la
  • cat ~/.profile
  • /bin/bash -lixc exit 2>&1 | sed -n 's/^+* \(source\|\.\) //p'

I suspect that maybe there's another file that your bash is sourcing the cause of the error, because it's executing three times the __steamos_prompt_command instead of just one and then does this weird thing: ; '

from install-jdk-on-steam-deck.

BahaminShahriari avatar BahaminShahriari commented on May 27, 2024

Hello, sorry for late response.
Here are my resaults;

(deck@Bahamin-s-Deck ~)$ ls -la
total 260
drwx------ 37 deck deck  4096 Jul 30 23:21  .
drwxr-xr-x  5 root root  4096 Jun 18 03:57  ..
drwxr-xr-x  3 deck deck  4096 Jul 14 03:05  Applications
-rw-------  1 deck deck  4046 Jul 27 01:10  .bash_history
-rw-r--r--  1 deck deck    21 Jan  8  2022  .bash_logout
-rw-r--r--  1 deck deck   489 Apr 26  2022  .bash_profile
-rw-r--r--  1 deck deck  2992 Jul 26 14:47  .bashrc
drwxr-xr-x 28 deck deck  4096 Jul 30 23:23  .cache
drwxr-xr-x 32 deck deck  4096 Jul 30 23:26  .config
drwxr-xr-x  2 deck deck  4096 Jul 16 00:55  .cryo_utilities
drwxr-xr-x  3 deck deck  4096 Jul 29 21:59  .deckycache
drwxr-xr-x  2 deck deck  4096 Jul 27 01:19  Desktop
drwxr-xr-x  6 deck deck  4096 Jul 19 14:19  Documents
drwxr-xr-x  6 deck deck  4096 Jul 26 13:14  Downloads
lrwxrwxrwx  1 deck deck   116 Jun 26 00:47 'Elder Scrolls Online' -> '/home/deck/.local/share/Steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder Scrolls Online'
drwxr-xr-x  4 deck deck  4096 Jul 14 02:19  emudeck
drwxr-xr-x  5 deck deck  4096 Jul 12 23:12  .emulationstation
-rw-r--r--  1 deck deck 69974 Feb 10  2022  .face.icon
-rw-r--r--  1 deck deck   110 Jun 18 12:29  .fonts.conf
drwxr-xr-x  3 deck deck  4096 Jul 25 02:18  Games
drwx------  3 deck deck  4096 Jun 26 00:43  .gg.minion.Minion
-rw-r--r--  1 deck deck   270 Jul 30 23:21  .gtkrc-2.0
drwxr-xr-x 10 deck deck  4096 Jul 13 19:43  homebrew
drwxr-xr-x  4 deck deck  4096 Jul 26 14:16  install-jdk-on-steam-deck
drwxr-xr-x  4 deck deck  4096 Jul 27 01:04  .java
drwxr-xr-x  2 deck deck  4096 Jun 29 19:48  .junique
drwxr-xr-x  5 deck deck  4096 Jul 26 14:16  .local
drwxr-xr-x  3 deck deck  4096 Jul 12 23:20  .mame
drwxr-xr-x 15 deck deck  4096 Jul 28 11:15  .minecraft
drwxr-xr-x  3 deck deck  4096 Jun 26 00:47  .minion
drwxr-xr-x  3 deck deck  4096 Jul  3 15:51  Music
-rw-------  1 deck deck   737 Jan 26  2022  .netrc
drwxr-xr-x  4 deck deck  4096 Jul  3 15:51  Pictures
drwx------  3 deck deck  4096 Jun 18 07:30  .pki
-rw-r--r--  1 deck deck    94 Jul 26 14:47  .profile
drwxr-xr-x  2 deck deck  4096 Jun 18 03:57  Public
drwxr-xr-x  2 deck deck  4096 Jun 27 15:49  .renderdoc
drwxr-xr-x  2 deck deck  4096 Jul 13 19:54  sdgyrodsu
drwx------  2 deck deck  4096 Jul 14 17:38  .ssh
drwxr-xr-x  2 deck deck  4096 Jul 30 23:21  .steam
lrwxrwxrwx  1 deck deck    29 Jul 30 23:21  .steampath -> /home/deck/.steam/sdk32/steam
lrwxrwxrwx  1 deck deck    27 Jul 30 23:21  .steampid -> /home/deck/.steam/steam.pid
drwxr-xr-x  2 deck deck  4096 Jun 18 03:57  Templates
drwxr-xr-x  4 deck deck  4096 Jul 29 12:49  .tlauncher
drwxr-xr-x  3 deck deck  4096 Jun 18 12:58  .var
drwxr-xr-x  3 deck deck  4096 Jul 28 17:12  Videos
drwxr-xr-x  3 deck deck  4096 Jul 27 01:12  .vscode
-rw-r--r--  1 deck deck   215 Jun 18 13:59  .wget-hsts
drwxr-xr-x  4 deck deck  4096 Jul 24 00:44  .wine
drwxr-xr-x 15 deck deck  4096 Jul 15 23:02  Zomboid



(deck@Bahamin-s-Deck ~)$ cat ~/.profile
export JAVA_HOME=/home/deck/.local/jdk
export PATH=$PATH:/home/deck/.local/jdk/jdk-17.0.8/bin



(deck@Bahamin-s-Deck ~)$ /bin/bash -lixc exit 2>&1 | sed -n 's/^+* \(source\|\.\) //p'
/etc/profile.d/flatpak-bindir.sh
/etc/profile.d/flatpak.sh
/etc/profile.d/freetype2.sh
/etc/profile.d/gawk.sh
/etc/profile.d/gpm.sh
/etc/profile.d/kde.sh
/etc/profile.d/libva.sh
/etc/profile.d/locale.sh
/etc/profile.d/perlbin.sh
/etc/profile.d/steamos.sh
/etc/bash.bashrc
/usr/share/bash-completion/bash_completion
/home/deck/.bashrc
/home/deck/.profile

from install-jdk-on-steam-deck.

BlackCorsair avatar BlackCorsair commented on May 27, 2024

Hold up a minute... is the error still happening? I'm not seeing that error while you run the commands.

If you want to uninstall the jdk installed by this script, you should:

# this is the installation dir
rm -rf /home/deck/.local/jdk

# this is the file that tells your shell and your programs where is that installation
# and by looking the contents, you don't have any other personalization
rm ~/.profile

# then in your .bashrc file, delete the following line:
[[ -f ~/.profile ]] && source ~/.profile

# although that line only loads that file if it exists

If you want to further debug this problem, I'd have to take a look at all these files in your system:

/etc/profile.d/flatpak-bindir.sh
/etc/profile.d/flatpak.sh
/etc/profile.d/freetype2.sh
/etc/profile.d/gawk.sh
/etc/profile.d/gpm.sh
/etc/profile.d/kde.sh
/etc/profile.d/libva.sh
/etc/profile.d/locale.sh
/etc/profile.d/perlbin.sh
/etc/profile.d/steamos.sh
/etc/bash.bashrc
/usr/share/bash-completion/bash_completion
/home/deck/.bashrc
/home/deck/.profile

Because these should be all the files that your bash loads every time and maybe there's the error.

BR

from install-jdk-on-steam-deck.

rasitayaz avatar rasitayaz commented on May 27, 2024

I'm getting the same prompts when I type source ~/.bashrc but java works. might be an issue related to the default .bashrc of steamos at the stable channel.

from install-jdk-on-steam-deck.

rasitayaz avatar rasitayaz commented on May 27, 2024

also, shouldn't JAVA_HOME be set to /home/deck/.local/jdk/jdk-17.0.8 instead of /home/deck/.local/jdk?

from install-jdk-on-steam-deck.

rasitayaz avatar rasitayaz commented on May 27, 2024

also, shouldn't JAVA_HOME be set to /home/deck/.local/jdk/jdk-17.0.8 instead of /home/deck/.local/jdk?

thank you for the response @BlackCorsair. I tried to run a java program that checks JAVA_HOME for the jre installation, and it was saying that the environment variable is set to an invalid path. changing it to /home/deck/.local/jdk/jdk-17.0.8 solved the problem. that's the reason why I asked this.

from install-jdk-on-steam-deck.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.