Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian 10 issue with sudo as a root user in hyperion-prepare.sh #2

Closed
N3Cr0N opened this issue Dec 4, 2020 · 9 comments
Closed

Debian 10 issue with sudo as a root user in hyperion-prepare.sh #2

N3Cr0N opened this issue Dec 4, 2020 · 9 comments
Assignees

Comments

@N3Cr0N
Copy link

N3Cr0N commented Dec 4, 2020

Hi,
issue on Debian 10 as a root user in hyperion-prepare.sh.

root@server:~# ~/hercules-helper/hyperion-prepare.sh
OS               : Debian variant
OS Version       : 10
-----------------------------------------------------------------
Checking for package: git
package: git is already installed
-----------------------------------------------------------------
Checking for package: build-essential
dpkg-query: Kein Paket gefunden, das auf build-essential passt
installing package: build-essential
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: autoconf
dpkg-query: Kein Paket gefunden, das auf autoconf passt
installing package: autoconf
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: automake
dpkg-query: Kein Paket gefunden, das auf automake passt
installing package: automake
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: cmake
dpkg-query: Kein Paket gefunden, das auf cmake passt
installing package: cmake
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: flex
dpkg-query: Kein Paket gefunden, das auf flex passt
installing package: flex
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: gawk
dpkg-query: Kein Paket gefunden, das auf gawk passt
installing package: gawk
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: libbz2-dev
dpkg-query: Kein Paket gefunden, das auf libbz2-dev passt
installing package: libbz2-dev
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
-----------------------------------------------------------------
Checking for package: zlib1g-dev
dpkg-query: Kein Paket gefunden, das auf zlib1g-dev passt
installing package: zlib1g-dev
/root/hercules-helper/hyperion-prepare.sh: Zeile 162: sudo: Kommando nicht gefunden.
Done!

My System:

root@server:~# uname --all
Linux server 4.19.0-12-amd64 #1 SMP Debian 4.19.152-1 (2020-10-18) x86_64 GNU/Linux

Kind regards

@N3Cr0N N3Cr0N changed the title Debian 10 issue with sudo as a root user Debian 10 issue with sudo as a root user in hyperion-prepare.sh Dec 4, 2020
@wrljet wrljet self-assigned this Dec 4, 2020
@wrljet
Copy link
Owner

wrljet commented Dec 4, 2020

I will look into that for you.

@N3Cr0N
Copy link
Author

N3Cr0N commented Dec 4, 2020

The problem here is Debian has not as default sudo installed, Ubuntu has a sudo as default installed.

i am not so good in shell coding but i think an extra if statment for debian will fix the bug:

if [[ $VERSION_ID == debian* ]]; then
	    echo "installing package: $package"
	    apt-get -y install $package
	fi
    done

or you check is sudo installed and make then a if else statement with and without sudo

@wrljet
Copy link
Owner

wrljet commented Dec 4, 2020

On Debian there's a bit more to setting up sudo.
I'm going to add instructions for that to the README.

There may be more problems because I completely didn't think about non-English
messages coming back from commands.

(working on your CentOS now)

@N3Cr0N
Copy link
Author

N3Cr0N commented Dec 4, 2020

Yes my system language is in german but that is not the problem, i have tested this and deleted the sudo in line 162, it works fine under debian!

root@server:~# ./hercules-helper/hyperion-prepare.sh
OS               : Debian variant
OS Version       : 10
-----------------------------------------------------------------
Checking for package: git
package: git is already installed
-----------------------------------------------------------------
Checking for package: build-essential
dpkg-query: Kein Paket gefunden, das auf build-essential passt
installing package: build-essential
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden zusätzlichen Pakete werden installiert:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8 dirmngr dpkg-dev fakeroot g++ g++-8 gcc gcc-8 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf
  gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libassuan0 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libfakeroot
  libfile-fcntllock-perl libgcc-8-dev libgomp1 libisl19 libitm1 libksba8 liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libquadmath0 libstdc++-8-dev libtsan0 libubsan1 linux-libc-dev make
  manpages-dev pinentry-curses
Vorgeschlagene Pakete:
  binutils-doc cpp-doc gcc-8-locales dbus-user-session pinentry-gnome3 tor debian-keyring g++-multilib g++-8-multilib gcc-8-doc libstdc++6-8-dbg gcc-multilib autoconf automake libtool flex
  bison gdb gcc-doc gcc-8-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg libquadmath0-dbg parcimonie xloadimage
  scdaemon glibc-doc bzr libstdc++-8-doc make-doc pinentry-doc
Die folgenden NEUEN Pakete werden installiert:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-8 dirmngr dpkg-dev fakeroot g++ g++-8 gcc gcc-8 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libassuan0 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl
  libfakeroot libfile-fcntllock-perl libgcc-8-dev libgomp1 libisl19 libitm1 libksba8 liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libquadmath0 libstdc++-8-dev libtsan0 libubsan1 linux-libc-dev
  make manpages-dev pinentry-curses
0 aktualisiert, 53 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 56,5 MB an Archiven heruntergeladen werden.
Nach dieser Operation werden 200 MB Plattenplatz zusätzlich benutzt.
Holen:1 http://security.debian.org/debian-security buster/updates/main amd64 linux-libc-dev amd64 4.19.152-1 [1.402 kB]
Holen:2 http://deb.debian.org/debian buster/main amd64 binutils-common amd64 2.31.1-16 [2.073 kB]
Holen:3 http://deb.debian.org/debian buster/main amd64 libbinutils amd64 2.31.1-16 [478 kB]
Holen:4 http://deb.debian.org/debian buster/main amd64 binutils-x86-64-linux-gnu amd64 2.31.1-16 [1.823 kB]
.....................................................

Checking for package: zlib1g-dev
dpkg-query: Kein Paket gefunden, das auf zlib1g-dev passt
installing package: zlib1g-dev
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden NEUEN Pakete werden installiert:
  zlib1g-dev
0 aktualisiert, 1 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Es müssen 214 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 457 kB Plattenplatz zusätzlich benutzt.
Holen:1 http://deb.debian.org/debian buster/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-1 [214 kB]
Es wurden 214 kB in 0 s geholt (2.358 kB/s).
Vormals nicht ausgewähltes Paket zlib1g-dev:amd64 wird gewählt.
(Lese Datenbank ... 43754 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von .../zlib1g-dev_1%3a1.2.11.dfsg-1_amd64.deb ...
Entpacken von zlib1g-dev:amd64 (1:1.2.11.dfsg-1) ...
zlib1g-dev:amd64 (1:1.2.11.dfsg-1) wird eingerichtet ...
Trigger für man-db (2.8.5-2) werden verarbeitet ...
Done!
root@server:~#

@wrljet
Copy link
Owner

wrljet commented Dec 4, 2020

Are you logged on as root?
A normal user cannot do apt-get install

But the English language may be the next problem we encounter.
The script looks for the word "installed" as part of the presence detection.

I will address this after I finish up with the CentOS stuff.
Testing that now on 7.8 and 8.2.

Bill

@N3Cr0N
Copy link
Author

N3Cr0N commented Dec 4, 2020

yes im logged in as a root user, the system is a fresh installation only updated.

i am not so deep in Debian Systems specs but i think the system returns a "installed" and not in german a "installiert" , or a "not installed" in german "nicht installiert"

This was installed from your script:

Die folgenden zusätzlichen Pakete werden installiert:
  binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-8 dirmngr dpkg-dev fakeroot g++ g++-8 gcc gcc-8 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf
  gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libassuan0 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl libfakeroot
  libfile-fcntllock-perl libgcc-8-dev libgomp1 libisl19 libitm1 libksba8 liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libquadmath0 libstdc++-8-dev libtsan0 libubsan1 linux-libc-dev make
  manpages-dev pinentry-curses
Vorgeschlagene Pakete:
  binutils-doc cpp-doc gcc-8-locales dbus-user-session pinentry-gnome3 tor debian-keyring g++-multilib g++-8-multilib gcc-8-doc libstdc++6-8-dbg gcc-multilib autoconf automake libtool flex
  bison gdb gcc-doc gcc-8-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan5-dbg liblsan0-dbg libtsan0-dbg libubsan1-dbg libmpx2-dbg libquadmath0-dbg parcimonie xloadimage
  scdaemon glibc-doc bzr libstdc++-8-doc make-doc pinentry-doc
Die folgenden NEUEN Pakete werden installiert:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-8 dirmngr dpkg-dev fakeroot g++ g++-8 gcc gcc-8 gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libassuan0 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libdpkg-perl
  libfakeroot libfile-fcntllock-perl libgcc-8-dev libgomp1 libisl19 libitm1 libksba8 liblsan0 libmpc3 libmpfr6 libmpx2 libnpth0 libquadmath0 libstdc++-8-dev libtsan0 libubsan1 linux-libc-dev
  make manpages-dev pinentry-curses

can you check from the script installed packets on a english debian?

@wrljet
Copy link
Owner

wrljet commented Dec 4, 2020

The root user probably doesn't have a sudo command in its search path. I will check for that condition.

@N3Cr0N N3Cr0N closed this as completed Dec 5, 2020
@wrljet
Copy link
Owner

wrljet commented Dec 5, 2020

Disallow running as root, for safety, with commit 0cb05d2.

Added some URLs to web pages that explain why running as root for normal activity can be a bad idea.

@wrljet
Copy link
Owner

wrljet commented Dec 5, 2020

Just so we're sure, regarding checking for the string "installed", can you run this command on your
German language Debian, and tell me what it says.

env | grep LANG

Just for reference, on mine it shows: "LANG=en_US.UTF-8"

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants