• Re: Access and Back-up a Root locked laptop

    From eben@gmx.us@21:1/5 to HERIBERTO AVELINO on Mon Jun 17 22:10:01 2024
    On 6/17/24 15:33, HERIBERTO AVELINO wrote:
    Dear all
    My root account is locked. I experienced the well known issue "Debian authentication failure" at the log-in stage, i.e. it would not accept the root password.
    I accessed the BIOS to enter the safe mode, and discovered that my hard
    drive is almost full.
    I shall not attempt a fresh partitioning as many files are not backed up.
    So, I would like to ask:
    - Can I access the system to back up my working files?
    - How can I back up the files to an external device?
    Distributor ID: Debian
    Description: Debian GNU/Linux 12 (bookworm)
    Release: 12
    Codename: bookworm
    running on a Laptop hp ProBook 445

    I would appreciate it if any kind soul could help me. I will buy you a cake! Heriberto

    Move enough files to another device that root can log in? But, some point
    in that process might require root permissions. Maybe boot off a rescue
    thumb drive (like the one from system-rescue.org), mount the relevant partitions from your hard drive(s) and you can do whatever.


    --
    "It can be shown that for any nutty theory, beyond-the-fringe political
    view or strange religion there exists a proponent on the Net. The proof
    is left as an exercise for your kill-file." -- Bertil Jonell

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Smith@21:1/5 to HERIBERTO AVELINO on Mon Jun 17 22:20:02 2024
    Hi,

    On Mon, Jun 17, 2024 at 01:33:12PM -0600, HERIBERTO AVELINO wrote:
    My root account is locked. I experienced the well known issue "Debian authentication failure" at the log-in stage, i.e. it would not accept the root password.

    With physical access to the machine and without an encrypted
    filesystem it's really quite trivial to regain access.

    Example for Debian 10 but still applies for other versions:

    https://www.tecmint.com/reset-forgotten-root-password-in-debian/

    So, I would like to ask:
    - Can I access the system to back up my working files?

    Yes, you can boot the Debian installer in "rescue" mode and access
    your files, or any other "Live" version of Linux to do same.

    - How can I back up the files to an external device?

    You probably should try resetting your password(s) first as using
    your normal system will be a lot more convenient. But if for some
    reason you don't want to do that, pretty much any external storage
    device should also show up under a "live" environment so the answer
    is: boot one of those and plug the storage in (or do it over the
    network to some storage).

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael =?utf-8?B?S2rDtnJsaW5n?=@21:1/5 to All on Mon Jun 17 23:00:02 2024
    On 17 Jun 2024 13:33 -0600, from avelinoheriberto@gmail.com (HERIBERTO AVELINO):
    My root account is locked. I experienced the well known issue "Debian authentication failure" at the log-in stage, i.e. it would not accept the root password.

    I haven't heard of any specific issue like that, but the file system
    being nearly full should not prevent root from logging in on a typical
    system. For example ext2/3/4 has a _specific_ margin of storage space
    reserved for root (which can be displayed using tune2fs -l and set
    using tune2fs -m; historically it has defaulted to 5%).

    That said, if files can't be written because the file system is out of
    space, _some_ things probably will break, and your desktop environment
    might not particularly like that. But you absolutely should be able to
    get to a shell.

    I shall not attempt a fresh partitioning as many files are not backed up.

    I really recommend that you start making regular backups, but that's
    unrelated to this particular issue. User error like overwriting or
    deleting the wrong file, software bugs corrupting files, and storage
    device malfunctions are just some examples of when a backup can be
    very useful; and particularly a laptop can be physically lost or
    damaged in ways most desktop systems typically aren't at great risk
    of. (Which is not to say that backups aren't beneficial also with
    desktop systems; they absolutely are.) But I digress.

    So, I would like to ask:
    - Can I access the system to back up my working files?
    - How can I back up the files to an external device?

    Yes. If you're comfortable with the command line, then most
    straightforward way is probably to switch to a non-X virtual terminal
    (try each of Ctrl+Alt+F[1..8] until you get to a text-based login
    prompt; note that a laptop may require you to also hold a Fn or
    similar key to actually get F-key semantics), log in as root there
    using your normal root password; and start looking around with cd, ls,
    du and df. `ls -lhrS` will probably be helpful (that's long format
    list, human-readable file sizes, sort with largest files at the
    bottom); also `du -bsmx */` (the slash is important) will tell you the
    size of what's in each subdirectory of the current directory. If there
    are many, try something like `du -bsmx */ | sort -k1 -nr | head -n10`
    to get a list of the largest subdirectories of the current directory.
    Note that this may take a while to complete; be patient.

    You can plug in external storage such as a USB stick, use lsblk to
    determine its device node path, and mount it somewhere convenient
    using something like `mount /dev/sdx /mnt`. You can then use mv to
    move files to it (or cp to copy). Remember to `umount /mnt` and wait
    for the command prompt _before unplugging it!_

    Or if you find large files that you don't need, you can use rm to
    delete them. Of course be careful to only do this with things you
    _know_ that you don't need.

    Another good place to start to free up space is `apt-get autoclean`,
    which will delete old package files from apt's local cache (it can get
    quite large over time if not cleaned).

    If you can free up a few tens of megabytes, then I suggest installing
    Midnight Commander. (`apt-get install mc`) Launch it by typing mc at
    the command prompt. It will make looking around the file system much
    smoother. Help is available within it by pressing F1, and you can
    access the drop-down menus by pressing F9. If the F keys don't work,
    then F1..F10 maps to Esc followed by plain digits 1 through 0.

    Once you free up maybe a few hundred megabytes to a gigabyte or so,
    assuming that the problem in the first place was lack of space, you
    should definitely be able to log in to a graphical session and
    continue there.

    --
    Michael Kjörling 🔗 https://michael.kjorling.se “Remember when, on the Internet, nobody cared that you were a dog?”

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