• Re: Pls help fixing /boot/efi and GRUB

    From Greg Wooledge@21:1/5 to All on Mon Mar 24 20:50:01 2025
    On Mon, Mar 24, 2025 at 22:40:52 +0300, J wrote:
    user@debian:~$ sudo for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do mount -B $i /mnt/$i; done
    bash: syntax error near unexpected token `do'

    sudo sh -c '...'

    (You're not using any bash-specific syntax there, so sh will do.)

    user@debian:~$ sudo bash bash.sh
    mount: /mnt//dev: mount point does not exist.
    dmesg(1) may have more information after failed mount system call.

    Have you considered doing something crazy like creating the mount points?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Max Nikulin on Wed Mar 26 06:40:01 2025
    On Wed, Mar 26, 2025 at 09:25:01AM +0700, Max Nikulin wrote:
    On 25/03/2025 19:47, J wrote:
    Notice that the page suggests "# for i in /dev /dev/pts /proc "
    so it is assumed that users should run

    $ sudo -i

    sudo *SH -c '...' -* as mentioned above. But it is not written in WIki.

    In my opinion, "sudo -i" might be added to the wiki articles. I would prefer to see a warning concerning compound shell commands in *sudo* docs.

    J, my impressions is that you read some docs strongly suggesting to prefix every command instead of just becoming root. It is reasonable recommendation in general case since sudo facilitates auditing and this practice encourages running most commands without elevated privileges. On the other hand system rescue using a live image is a special case. Logs are not saved by default. You need to run a bunch of commands requiring root privileges. It is more convenient to run "sudo -i" or "su -" once.

    Indeed, redirections are another issue. I usually do this "prefix thing"
    as you put it ("sudo this", "sudo that"), but have developed over the
    years a feeling on when to "sudo -i". Alas, this is too difficult to put
    in a wiki...

    If somebody is going to add a hint concerning sudo to wiki, please, make https://wiki.debian.org/RescueLive
    https://wiki.debian.org/GrubEFIReinstall https://wiki.debian.org/GrubEFIReinstallOnLUKS
    articles consistent (perhaps by including a fragment of some page to others using wiki macros).

    Good idea. Perhaps weekend...

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZ+OQ8QAKCRAFyCz1etHa RmGHAJ4pQG22aC8OJ3ZMZe//pJPs6eMGkQCeLotusQx62J12a2oSER4gYs7Rgr0=
    =L8R/
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to All on Wed Mar 26 12:30:01 2025
    On Wed, Mar 26, 2025 at 02:15:03PM +0300, J wrote:
    In my opinion, "sudo -i" might be added to the wiki articles. I would prefer to see a warning concerning compound shell commands in *sudo* docs.

    J, my impressions is that you read some docs strongly suggesting to
    prefix every command instead of just becoming root.


    Actually it is easier than this. I couldn't use a *root *account on *Live CD*, at least I didn't know how, so I had to stick with *sudo*.

    And i thought *sudo -i*, you speaking about, is something like *--interactive*, which is not, how i see now...

    The long form is "--login", not interactive. But the "-i" stands
    in for the interactive shell it gives you. Go figure :-)

    But yes, in short: with "sudo -i" you enter a shell where you are
    root, until you leave it with "exit" (or shorter: CTRL-D), which
    puts you back where you were before.

    Will this command (

    for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do
    mount -B $i /mnt/$i; done)


    work with* root?* I will try to test.

    I fully expect it to, yes.

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZ+PjsgAKCRAFyCz1etHa RhR0AJ9N9EYUKREYFEMjZYN0BV8/wMJv2gCfQ6OXv/U0OkuS3tLhpsmh5BpBRUU=
    =KQy8
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to tomas@tuxteam.de on Wed Mar 26 13:00:01 2025
    On Wed, Mar 26, 2025 at 12:23:38 +0100, tomas@tuxteam.de wrote:
    On Wed, Mar 26, 2025 at 02:15:03PM +0300, J wrote:
    And i thought *sudo -i*, you speaking about, is something like *--interactive*, which is not, how i see now...

    The long form is "--login", not interactive. But the "-i" stands
    in for the interactive shell it gives you. Go figure :-)

    "sudo -s" gives you a root shell, of the non-login variety. In the case
    of bash, this means it reads ~root/.bashrc but not /etc/profile and
    so on.

    "sudo -i" gives you a root shell, of the login variety. In the case of
    bash, this means it reads /etc/profile and ~root/.profile (or possibly ~root/.bash_profile or ~root/.bash_login).

    I normally use "sudo -s", which is the closest sudo approximation to
    the traditional behvior of "su" (before it was broken in buster).

    "sudo -i" is meant to approximate the behavior of "su -". Before buster, nobody would have used that on a Debian system. It's horrible. The
    fact that people are now embracing it as a norm is even worse.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Greg Wooledge on Wed Mar 26 13:50:01 2025
    On 3/26/25 6:55 AM, Greg Wooledge wrote:
    [SNIP]

    I normally use "sudo -s", which is the closest sudo approximation to
    the traditional behvior of "su" (before it was broken in buster).


    I don't understand the reference to some "brokenness" of "su".
    I've not closely followed this thread so I may be missing context.

    I only use "su" when doing something in MATE terminal on my local
    machine. I do not use any command line options to "su". I just wait for
    it to ask for my root password. I perform a few commands and then close
    that MATE terminal.

    Does this "brokenness" of "su" have any potential effect on my usage?

    TIA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Greg Wooledge on Wed Mar 26 14:00:01 2025
    On Wed, Mar 26, 2025 at 07:55:33AM -0400, Greg Wooledge wrote:

    [...]

    I normally use "sudo -s", which is the closest sudo approximation to
    the traditional behvior of "su" (before it was broken in buster).

    "sudo -i" is meant to approximate the behavior of "su -". Before buster, nobody would have used that on a Debian system. It's horrible. The
    fact that people are now embracing it as a norm is even worse.

    I hear you (well, I read you) and keep your notes in high esteem.

    However, I found myself more often doing "su -" back then (TM), so I
    gravitated quite naturally towards "sudo -i". Differently wired brain? Different contexts? Plain incompetence? (Mine: in things shell, I'm
    the incompetent among both of us :-)

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZ+P4XQAKCRAFyCz1etHa RjdzAJsHpyShb92KwBgt9dT/yusU4hDRkgCfZOkE9b32fZNcYgbWgp+Im75k+yM=
    =OnXI
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Richard Owlett on Wed Mar 26 14:00:01 2025
    On Wed, Mar 26, 2025 at 07:48:16AM -0500, Richard Owlett wrote:
    On 3/26/25 6:55 AM, Greg Wooledge wrote:
    [SNIP]

    I normally use "sudo -s", which is the closest sudo approximation to
    the traditional behvior of "su" (before it was broken in buster).


    I don't understand the reference to some "brokenness" of "su".
    I've not closely followed this thread so I may be missing context.

    I only use "su" when doing something in MATE terminal on my local machine. I do not use any command line options to "su". I just wait for it to ask for
    my root password. I perform a few commands and then close that MATE
    terminal.

    Does this "brokenness" of "su" have any potential effect on my usage?

    Read the first item here:

    https://wiki.debian.org/NewInBuster#Changes

    ...and kids, always read the release notes (I do fail myself in that,
    too :)

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZ+P5BQAKCRAFyCz1etHa Rk3eAJ0bd8CtjlXWUbmGScvAtmQEz4+ABgCfbuzypGu+5W6RjDPVMTh+3eT+UV8=
    =VQZ2
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Richard Owlett on Wed Mar 26 14:20:01 2025
    On Wed, Mar 26, 2025 at 07:48:16 -0500, Richard Owlett wrote:
    On 3/26/25 6:55 AM, Greg Wooledge wrote:
    I normally use "sudo -s", which is the closest sudo approximation to
    the traditional behvior of "su" (before it was broken in buster).

    I don't understand the reference to some "brokenness" of "su".
    I've not closely followed this thread so I may be missing context.

    Out of the box, in Debian 1.1 through 9, "su" with no arguments would
    give you a root shell with the PATH variable changed to include /usr/local/sbin, /usr/sbin and /sbin.

    Out of the box, in Debian 10 and later, "su" with no arguments no
    longer changes the PATH variable. Your root shell has the same PATH
    as your previous shell, with directories like /usr/games but not
    /usr/sbin or /sbin.

    This caused ALL KINDS of problems. People would do things like:

    $ su
    # apt update
    # apt install somepkg

    And the postinstall script for somepkg would fail because it couldn't
    find commands that are in /sbin or /usr/sbin, because those directories
    which should have been in PATH, which *had* been in PATH for the last
    20 years, were suddenly not there.

    Some people proposed using "su -" as a workaround. And this is fine for
    many situations:

    $ su -
    # apt update
    # apt install somepkg

    Here, it works fine. The commands spawned by apt to install the package
    don't care what directory they're executed from.

    But in other cases, it's not fine:

    $ cd /somewhere/that/is/obnoxiously/long/program-1.2.3
    $ ./configure
    $ make
    $ su -
    # make install

    Whoopsie! That just blew up catastrophically, because su - changes
    your working directory. You're no longer in the /somewhere/that/is/obnoxiously/long/program-1.2.3 directory, so you're
    no longer in the right place for "make install" to work from.

    I only use "su" when doing something in MATE terminal on my local machine. I do not use any command line options to "su". I just wait for it to ask for
    my root password. I perform a few commands and then close that MATE
    terminal.

    Does this "brokenness" of "su" have any potential effect on my usage?

    Maybe. If you haven't created an /etc/default/su file, then something
    like this:

    $ su
    # adduser richard

    may fail. You could work around it in various ways (e.g. explicitly
    typing out /usr/sbin/adduser richard).

    My recommendation is to create a one-line configuration file:

    hobbit:~$ cat /etc/default/su
    ALWAYS_SET_PATH yes

    That's all it takes. With this file, with this setting, "su" with no
    arguments will behave the way it's supposed to: it changes PATH without changing your working directory.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to All on Wed Mar 26 15:20:01 2025
    On Wed, Mar 26, 2025 at 04:19:37PM +0300, J wrote:

    work with* root?* I will try to test.

    I fully expect it to, yes.


    Oh, yes, it works. I just had to use *sudo su* and not not

    I think you never need "sudo su". "sudo -i" and "sudo -s" will do your
    bidding, depending on your needs (see Greg's instructive post in this
    thread).

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZ+QKnwAKCRAFyCz1etHa RvyNAJ0Xb1b/WMJm+aQ82KLQgWbnqq6abACfQeuQiJfdN2+1DEIpzu6NcHOM6wk=
    =XKnJ
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Greg on Wed Mar 26 15:50:01 2025
    On 3/26/25 9:04 AM, Greg wrote:
    On 2025-03-26, Greg Wooledge <greg@wooledge.org> wrote:

    Does this "brokenness" of "su" have any potential effect on my usage?

    Maybe. If you haven't created an /etc/default/su file, then something
    like this:

    If he hasn't noticed yet, I doubt it.

    I agree.
    If I understand what people want to accomplish by using command-line
    options, I would likely have gone to System->Log Out ... and then logged
    in as root.



    I noticed when I finally erased Stretch and installed Bookworm and tried
    to run some command (whose name has escaped my memory) as root. The
    command wasn't found because it wasn't in my PATH. At that moment I
    recalled the "su -" 'workaround' thanks to you.



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nicolas George@21:1/5 to All on Wed Mar 26 15:50:02 2025
    Greg Wooledge (HE12025-03-26):
    This caused ALL KINDS of problems. People would do things like:

    $ su
    # apt update
    # apt install somepkg

    And the postinstall script for somepkg would fail because it couldn't
    find commands that are in /sbin or /usr/sbin, because those directories
    which should have been in PATH, which *had* been in PATH for the last
    20 years, were suddenly not there.

    That, I would argue, is a flaw in apt: it should have set the path to a
    known valid one, possibly even excluding /usr/local/bin in case
    incompatible commands are in it.

    $ su -
    # make install

    Whoopsie!

    Oh, even:

    $ su
    # make install

    Whoopsie! The Makefile just pwned you. Or the non-hostile Makefile just overwrote some files you had not yet saved. People who run make install
    with extended privileges deserve what they get. Much safer to do:

    $ make DESTDIR=/tmp/i install
    $ sudo cp -r /tmp/i/blabla /blabla

    Will not work if what is installed there requires unusual file
    permissions, but in that case it is better to review everything anyway.
    Using fakeroot + tar is an option.

    My recommendation is to create a one-line configuration file:

    My recommendation is to learn to use sudo itself rather than trying to
    emulate su. Having the privileged commands logged is a good idea. Using privileges only with commands that need it is a good idea. Having the
    same shell history for those is convenient.

    Regards,

    --
    Nicolas George

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Owlett@21:1/5 to Greg on Wed Mar 26 16:10:01 2025
    On 3/26/25 9:55 AM, Greg wrote:
    On 2025-03-26, Richard Owlett <rowlett@access.net> wrote:

    If he hasn't noticed yet, I doubt it.

    I agree.
    If I understand what people want to accomplish by using command-line
    options, I would likely have gone to System->Log Out ... and then logged
    in as root.

    Not recommended.



    Why? I do it maybe 3 or 4 times a year at most.
    I assumed it was effectively the same as power down and then logging in
    as root on power-up.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From tomas@tuxteam.de@21:1/5 to Greg on Wed Mar 26 16:10:01 2025
    On Wed, Mar 26, 2025 at 02:55:11PM -0000, Greg wrote:
    On 2025-03-26, Richard Owlett <rowlett@access.net> wrote:

    If he hasn't noticed yet, I doubt it.

    I agree.
    If I understand what people want to accomplish by using command-line options, I would likely have gone to System->Log Out ... and then logged in as root.

    This would be running a whole modern desktop env under root...

    Not recommended.

    ... I wholeheartedly agree.

    Cheers
    --
    t

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZ+QW4gAKCRAFyCz1etHa Rv8mAJ0VrE6x5ZPbGAJYJaNZcaA1+XJbXgCZAc4TBADmKuqgM/Bmrokav2c86j0=
    =LDBj
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Nicolas George on Wed Mar 26 16:20:01 2025
    On Wed, Mar 26, 2025 at 15:46:15 +0100, Nicolas George wrote:
    $ su
    # make install

    Whoopsie! The Makefile just pwned you.

    That's a COMPLETELY separate discussion. Obviously I was referring to
    software from reputable sources.

    $ make DESTDIR=/tmp/i install
    $ sudo cp -r /tmp/i/blabla /blabla

    If the software has been maliciously altered, then nothing you do with
    it is safe. The malware might be in the installed product, rather than
    in the Makefile.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anssi Saari@21:1/5 to David Wright on Thu Mar 27 11:30:02 2025
    David Wright <deblis@lionunicorn.co.uk> writes:

    host!auser 09:57:47 /somewhere/that/is/obnoxiously/long/program-1.2.3$ /bin/su --login
    Password:
    bullseye on /dev/sda5 toto05
    host 09:57:59 ~# cd /somewhere/that/is/obnoxiously/long/program-1.2.3
    host 09:58:08 /somewhere/that/is/obnoxiously/long/program-1.2.3#

    where that's a simple cut and paste.

    Yes. I don't remember why but at some point in the distant past I got
    into the habit of su - and expect to end up in root's home dir and
    nowhere else.

    Thinking back, it could be argued some crude consoles like Sun's or old
    school text terminals might not have copy-paste available. Maybe even
    today it could be a thing, don't really know. If my old HP Microserver
    gen8 is any indication, server people like to do extremely weird stuff
    for remote management.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Ritter@21:1/5 to Anssi Saari on Thu Mar 27 12:50:01 2025
    Anssi Saari wrote:
    David Wright <deblis@lionunicorn.co.uk> writes:

    host!auser 09:57:47 /somewhere/that/is/obnoxiously/long/program-1.2.3$ /bin/su --login
    Password:
    bullseye on /dev/sda5 toto05
    host 09:57:59 ~# cd /somewhere/that/is/obnoxiously/long/program-1.2.3
    host 09:58:08 /somewhere/that/is/obnoxiously/long/program-1.2.3#

    where that's a simple cut and paste.

    Yes. I don't remember why but at some point in the distant past I got
    into the habit of su - and expect to end up in root's home dir and
    nowhere else.

    Thinking back, it could be argued some crude consoles like Sun's or old school text terminals might not have copy-paste available. Maybe even
    today it could be a thing, don't really know. If my old HP Microserver
    gen8 is any indication, server people like to do extremely weird stuff
    for remote management.

    The Linux console has no cut/paste. The text or framebuffer
    console you get when you boot without having a GUI available? No
    cut/paste there. You can add one with another daemon.

    Don't call things "crude" when they still work properly.

    -dsr-

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to David Wright on Thu Mar 27 19:00:01 2025
    On Thu, Mar 27, 2025 at 12:48:35 -0500, David Wright wrote:
    It could be argued that it would be simple enough to communicate
    the user's cwd to root, as a workaround, so that it didn't have to
    be retyped.

    You know what does that for you? sudo -s. Or su if you've configured
    it with a one-line config file.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nicolas George@21:1/5 to All on Thu Mar 27 20:00:01 2025
    Greg (HE12025-03-27):
    I'm certain sudo has its use cases, but all I do personally is su to
    root and update and upgrade my stable Bookworm using apt, so I feel no
    need to complexify the issue with sudo.

    The fallacy in here being assuming, without stating it and without
    justifying it that sudo makes things more complex than su.

    Please, when replying to this, double check you do not commit the second fallacy to assume that one thing is simpler than another when the
    difference is you already know the first and not the second.

    Regards,

    --
    Nicolas George

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to David Wright on Fri Mar 28 03:20:01 2025
    On Thu, Mar 27, 2025 at 08:29:50PM -0500, David Wright wrote:
    Excellent, that solves the problem for those on old terminals or
    lacking copy/paste. As for me, I'll continue to use /bin/su --login,
    as I have for nigh on three decades, so that I land in my preferred, >consistent cwd, /root.

    su -
    does the same thing, is less to type, and is portable. (It's technically deprecated in favor of su -l, but it's unlikely to go anywhere.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nicolas George@21:1/5 to All on Fri Mar 28 16:30:01 2025
    Max Nikulin (HE12025-03-28):
    Approximately a decade ago I
    noticed that new entries were not added to some history file, I do not remember if it was .bash_history or for some other tool, but the owner of
    the file was root. It was the reason why I decided to use some option to set $HOME.

    I strongly suggest you learn to use sudo as sudo is intended to be used
    rather than using it as an imitation for su. You would not have had this problem if you did.

    Regards,

    --
    Nicolas George

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)