install.func issue and improvement regarding OS version in 00_lxc_details.sh #2405

Closed
opened 2026-02-05 04:44:26 +03:00 by OVERLORD · 9 comments
Owner

Originally created by @Wendigogo on GitHub (Jan 28, 2026).

📌 Task summary

Use 'hostnamectl' instead of '/etc/os-release'

📋 Task details

When I switched my Debian LXC's to Trixie, the greeting is still saying it is a Bookworm version.
After some digging, I found it is related to /etc/profile.d/00_lxc-details.sh where it is hardcoded.

So I dig more and find that file is build by the install.func (line 233 atm). And this file uses the /etc/os-release as a base for setting the OS version. Unfortunately, Debian doesn't use this file but /etc/debian_version. So I guess this is why it is hardcoded there.

So my proposal here is to use hostnamectl instead with something like:

hostnamectl |grep Operating | cut -d ":" -f 2

It gives OS name, OS version and OS nickname all in a row.

Thanks for your support.

Originally created by @Wendigogo on GitHub (Jan 28, 2026). ### 📌 Task summary Use 'hostnamectl' instead of '/etc/os-release' ### 📋 Task details When I switched my Debian LXC's to Trixie, the greeting is still saying it is a Bookworm version. After some digging, I found it is related to `/etc/profile.d/00_lxc-details.sh` where it is hardcoded. So I dig more and find that file is build by the `install.func` (line 233 atm). And this file uses the `/etc/os-release` as a base for setting the OS version. Unfortunately, Debian doesn't use this file but `/etc/debian_version`. So I guess this is why it is hardcoded there. So my proposal here is to use `hostnamectl` instead with something like: `hostnamectl |grep Operating | cut -d ":" -f 2` It gives OS name, OS version and OS nickname all in a row. Thanks for your support.
Author
Owner

@MickLesk commented on GitHub (Jan 28, 2026):

you have an old installation, we have changed this long time ago.
The current version reads /etc/os-release dynamically at each login - its not hardcoded anymore.

You can verify by checking your /etc/profile.d/00_lxc-details.sh:

cat /etc/profile.d/00_lxc-details.sh

If it shows hardcoded values, you can regenerate it by running the update script for your container.
The current implementation already uses:

$(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"')
$(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')

--> This reads the version dynamically at each login.

@MickLesk commented on GitHub (Jan 28, 2026): you have an old installation, we have changed this long time ago. The current version reads /etc/os-release dynamically at each login - its not hardcoded anymore. You can verify by checking your /etc/profile.d/00_lxc-details.sh: ```bash cat /etc/profile.d/00_lxc-details.sh ``` If it shows hardcoded values, you can regenerate it by running the update script for your container. The current implementation already uses: ```bash $(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"') $(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"') ``` --> This reads the version dynamically at each login.
Author
Owner

@Wendigogo commented on GitHub (Jan 28, 2026):

You mean the update command to launch within an LXC?

I already ran it in my Prometheux LXC and I still got :

root@Prometheus:~# cat /etc/profile.d/00_lxc-details.sh
echo -e ""
echo -e "Prometheus LXC Container"
echo -e "    🌐   Provided by: community-scripts ORG | GitHub: https://github.com/community-scripts/ProxmoxVE"
echo ""
echo -e "    🖥️   OS: Debian GNU/Linux - Version: 12"
echo -e "    🏠   Hostname: $(hostname)"
echo -e "    💡   IP Address: $(hostname -I | awk '{print $1}')"

While in top of my shell prompt I got:

Debian GNU/Linux 13 Prometheus tty1

Prometheus login: root (automatic login)
@Wendigogo commented on GitHub (Jan 28, 2026): You mean the `update` command to launch within an LXC? I already ran it in my Prometheux LXC and I still got : ``` root@Prometheus:~# cat /etc/profile.d/00_lxc-details.sh echo -e "" echo -e "Prometheus LXC Container" echo -e " 🌐 Provided by: community-scripts ORG | GitHub: https://github.com/community-scripts/ProxmoxVE" echo "" echo -e " 🖥️ OS: Debian GNU/Linux - Version: 12" echo -e " 🏠 Hostname: $(hostname)" echo -e " 💡 IP Address: $(hostname -I | awk '{print $1}')" ``` While in top of my shell prompt I got: ``` Debian GNU/Linux 13 Prometheus tty1 Prometheus login: root (automatic login) ```
Author
Owner

@MickLesk commented on GitHub (Jan 28, 2026):

cat > /etc/profile.d/00_lxc-details.sh << 'EOF'
echo ""
echo "Prometheus LXC Container"
echo "    🌐   Provided by: community-scripts ORG | GitHub: https://github.com/community-scripts/ProxmoxVE"
echo ""
echo "    🖥️   OS: $(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"') - Version: $(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')"
echo "    🏠   Hostname: $(hostname)"
echo "    💡   IP Address: $(hostname -I | awk '{print $1}')"
EOF

we currently create this on runtime, and only replace the ip / hostname after this.

@MickLesk commented on GitHub (Jan 28, 2026): ```bash cat > /etc/profile.d/00_lxc-details.sh << 'EOF' echo "" echo "Prometheus LXC Container" echo " 🌐 Provided by: community-scripts ORG | GitHub: https://github.com/community-scripts/ProxmoxVE" echo "" echo " 🖥️ OS: $(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"') - Version: $(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')" echo " 🏠 Hostname: $(hostname)" echo " 💡 IP Address: $(hostname -I | awk '{print $1}')" EOF ``` we currently create this on runtime, and only replace the ip / hostname after this.
Author
Owner

@Wendigogo commented on GitHub (Jan 28, 2026):

How can I generate this new version for every LXC installed?

EDIT: no more colored prompt?

@Wendigogo commented on GitHub (Jan 28, 2026): How can I generate this new version for every LXC installed? EDIT: no more colored prompt?
Author
Owner

@MickLesk commented on GitHub (Jan 28, 2026):

With the script I just gave you?

@MickLesk commented on GitHub (Jan 28, 2026): With the script I just gave you?
Author
Owner

@MickLesk commented on GitHub (Jan 28, 2026):

color only with sources core.func. So just wait for #11264

@MickLesk commented on GitHub (Jan 28, 2026): color only with sources core.func. So just wait for #11264
Author
Owner

@Wendigogo commented on GitHub (Jan 28, 2026):

With the script I just gave you?

I have to run it in all my LXC's and modifying the second line, right?

Thanks for your help

@Wendigogo commented on GitHub (Jan 28, 2026): > With the script I just gave you? I have to run it in all my LXC's and modifying the second line, right? Thanks for your help
Author
Owner

@MickLesk commented on GitHub (Jan 28, 2026):

https://github.com/community-scripts/ProxmoxVE/discussions/7227

after the merge just "update"

@MickLesk commented on GitHub (Jan 28, 2026): https://github.com/community-scripts/ProxmoxVE/discussions/7227 after the merge just "update"
Author
Owner

@github-actions[bot] commented on GitHub (Jan 29, 2026):

This issue has been automatically locked since it has been closed for more than 1 day.
If you have a related issue, please open a new one and reference this issue if needed.

@github-actions[bot] commented on GitHub (Jan 29, 2026): This issue has been automatically locked since it has been closed for more than 1 day. If you have a related issue, please open a new one and reference this issue if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#2405