0

And yes: for a few days i have problems with one of systems on my PC -LMDE. Recently i got repaired there one thing as shown here : ("Mint" - a bunch of errors in boot). Now i have yet bigger problem - system ask me password for non-existing user (root) error code is here:

Give root password for maintenance (or press Control-D to continue):

When i press these button it shows me:

Reloading system manager configuration
Starting default target
You are in emergency mode. After logging in, type “journal -xb” to view system logs, “systemctl reboot” to reboot, “systemctl default” or “exit” to boot into default mode.
Give root password for maintenance (or press Control-D to continue)

When i chrooted into this OS (with live-boot) i saw that there are problems with sudo and pkexec, so i cant use root even in chroot (and modify system files, etc...) is there any way to boot PC normally or i need to always use “initramfs error” and boot only to busybox cli (i can do that because i accidentally uninstalled grub and now i have cli when booting up pc)?

Ps: I didnt setted up root (su) account (no password, user, etc) and i was really messing up with sudo so now i think that this also doesnt exist.

———————————————-

Edit: i’ve done it with passwd as @cas said. Now i have bigger problem.

My second problem is that all my partition is r/o. Even with modified /etc/fstab to open all partitions as writable. My system didn’t exited cli to the now - system doesn’t load without writable permission and my current (logged-in) user looks like root (have # before command and whoami shows me as root) but it isn’t. When i try mount command they said that i need to have root permission ( how i cant have them when currently i am root?!). Is there something i forgot, all my PC is corrupt or im a real n00b?

enter image description here

  • Does this answer your question? Manually generate password for /etc/shadow - I.e. manually add the password using a live session. – FelixJN Apr 27 '21 at 16:08
  • run sudo -i to get a root shell in the live-cd if you're not already logged in as root, before chrooting into your filesystem. You can then use passwd to set a password for root. And fix whatever's broken on your system. fixing it probably involves bind-mounting /proc, /sys, and /dev under the chroot target (e.g. if mounted as /mnt, for i in proc dev sys ; do mount -o bind /$i /mnt/$i ; done) before chrooting, and then running update-grub and/or update-initramfs while in the chroot. – cas Apr 27 '21 at 16:20
  • This sort of problem is why i think some distros are making a huge mistake by discouraging people from setting a root password. Sure, root's password has to be a good, long, secure one and password logins for ssh need to be disabled, but root needs a password. for situations like this, which would be unfixable without a rescue CD/USB/tftp image/etc – cas Apr 27 '21 at 16:25
  • I am always root when i chroot... and okie - i’ll try this method... (because i see that i’ll need to...) – hacknorris Apr 27 '21 at 16:29
  • If you're already root when you chroot, then problems with sudo should be irrelevant - you don't need sudo to fix the system because you're already root and should have RW access to everything. BTW, I just noticed you said you accidentally uninstalled grub - you will need to re-install it while you're in the chroot too. also btw, grub is why you need to do the bind-mounts, grub won't work without them. – cas Apr 27 '21 at 16:39
  • Grub doesnt want to be reinstalled ;) anyways - grub cli is even better cause i can boot to my external hdd and my bios/uefi on pc doesnt support that – hacknorris Apr 27 '21 at 16:40
  • Did it worked https://i.postimg.cc/tJJDr6tM/image.jpg @cas ? – hacknorris Apr 27 '21 at 16:53
  • no. the for loop I gave you was an example that only works if the chroot is /mnt. Adjust to suit your chroot's mount point (which looks to be /media/mint/). Also, you need to run that loop before chrooting, otherwise the bind mount won't work. – cas Apr 27 '21 at 18:38
  • RE: the passwd change failing - did you mount the mint directories read-only? if so, remount it as RW. Or have you changed the perms on /etc/shadow? If so, change them back with chmod 640 /etc/shadow while in the chroot. Otherwise try running passwd root instead of just passwd - some PAM configs can give that error when trying to change a password for a user which doesn't have one yet. – cas Apr 27 '21 at 18:43
  • All filesystem is r/o. Even with modified /etc/fstab (i tried to set it up as rw but even from there it doesn’t work...) – hacknorris Apr 28 '21 at 07:24
  • You've mistyped remount as remout. and that -t option is just wrong - it's not needed AND you've misused it. You need to be careful and methodical, stay calm, plan each step in advance, and then double-check everything you type before you hit enter. You're messing with the system's boot process, any mistake could be disastrous (and is probably how you got into this mess in the first place). Try mount -o rw,remount / (from within the chroot. or, from outside it, use the mount-point - e.g. mount -o rw,remount /mnt). – cas Apr 28 '21 at 08:27
  • Yeah? Even when i repaired command i got that : https://i.postimg.cc/wvbsT07x/76-B36-D13-0-B79-4-C2-F-B048-1-AB9-D6-D194-A6.jpg and now i dont use chroot because now i know my “root” password (i set that as simple “admin”) – hacknorris Apr 28 '21 at 09:03

0 Answers0