Kernel panic after running an install script

Done. The entire output won’t fit in the character limit.

[manjaro@manjaro ~]$ sudo sed -i 's/ trap/#trap/' /usr/lib/manjaro-tools/util-mount.sh
[manjaro@manjaro ~]$ exit | manjaro-chroot -a
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
==> Mounting (ManjaroLinux) [/dev/sda1]
 --> mount: [/mnt]
[manjaro@manjaro ~]$ pacman-mirrors -f5
.: ERROR Must have root privileges
[manjaro@manjaro ~]$ sudo pacman-mirrors -f5
::INFO Downloading mirrors from Manjaro
::INFO => Mirror pool: https://repo.manjaro.org/mirrors.json
::INFO => Mirror status: https://repo.manjaro.org/status.json
::INFO Using default mirror file
::INFO Querying mirrors - This may take some time
  0.902 Austria        : https://mirror.easyname.at/manjaro/
  2.344 Thailand       : https://mirror.kku.ac.th/manjaro/
  0.606 Estonia        : https://mirrors.xtom.ee/manjaro/
  0.667 Germany        : https://mirror.moson.org/manjaro/
  ..... China          : https://mirrors.sjtug.sjtu.edu.cn/manjaro/
::INFO Writing mirror list
::Estonia         : https://mirrors.xtom.ee/manjaro/stable
::Germany         : https://mirror.moson.org/manjaro/stable
::Austria         : https://mirror.easyname.at/manjaro/stable
::Thailand        : https://mirror.kku.ac.th/manjaro/stable
::China           : https://mirrors.sjtug.sjtu.edu.cn/manjaro/stable
::INFO Mirror list generated and saved to: /etc/pacman.d/mirrorlist
[manjaro@manjaro ~]$ pacman --sysroot /mnt -Qqn | pacman --sysroot /mnt -Syu -
error: you cannot perform this operation unless you are root.
error: you cannot perform this operation unless you are root.
[manjaro@manjaro ~]$ sudo pacman --sysroot /mnt -Qqn | pacman --sysroot /mnt -Syu -
error: you cannot perform this operation unless you are root.
[manjaro@manjaro ~]$ sudo
usage: sudo -h | -K | -k | -V
usage: sudo -v [-ABknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-ABknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-ABbEHknPS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T
            timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-ABknS] [-C num] [-D directory] [-g group] [-h host] [-p prompt] [-R directory] [-T
            timeout] [-u user] file ...
[manjaro@manjaro ~]$ sudo pacman --sysroot /mnt -Qqn | sudo pacman --sysroot /mnt -Syu -
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date

::INFO Downloading mirrors from Manjaro
::INFO => Mirror pool: https://repo.manjaro.org/mirrors.json
::INFO => Mirror status: https://repo.manjaro.org/status.json
hint: use `pacman-mirrors` to generate and update your pacman mirrorlist.
(37/41) Updating the info directory file...
(38/41) Copy Thunderbird Distribution Settings
(39/41) Updating the desktop file MIME type cache...
(40/41) Updating the vlc plugin cache...
(41/41) Updating X fontdir indices...

Seemed to go through without problems.

Remove usb and try if the actual system works then.

Thank you very much, that seems to have worked. With some quirks. Like I mentioned before (post #23), I had for some reason several kernels installed, and only 5.4 and 5.10 booted into a gui. I could open tty2 in 5.13, but at least now I’m running 5.10.

I’m assuming I should update it, but honestly, that sounds like an incredibly daunting thing right now, and every time I’ve done a larger update via the graphical interface (which I assume is for dumb people like me), something catastrophic happens, usually related to the nvidia GPU. Before we’re done here, any pointers on how to update my system without destroying it again? A link to a helpful thread of avoiding pitfalls or something? A particular kernel version I should go with where I can avoid updating for as long as possible?

Well, you didn’t post important output at the end, so I don’t know what kernels you have. Remove all EOL kernels and re-/install others you want.

Don’t use rolling distro if you don’t want to update regulary, period. Other than that, use LTS kernels.

this is an excellent command:

sudo pacman --sysroot /mnt -Qqn | sudo pacman --sysroot /mnt -Syu -

does it work without this:

sudo sed -i 's/ trap/#trap/' /usr/lib/manjaro-tools/util-mount.sh

or they have to be run together?

Thing is, you need to mount all partitions and /sys, /proc, /dev to prepare for chrooting (pacman --sysroot does the chrooting for you, similar to pacstrap which you use when you install Arch).

And I figured it’s easier if you just use manjaro-chroot -a which does everything for you. But you need to exit chroot then and perform pacman --sysroot outside, in live iso. The problem is that when you exit chroot, manjaro-chroot wil clean up aka unmount everything after itself so you didn’t achieve anything.

That sed command just comments out that section so that everything stays mounted after exiting chroot. Hacky way.

i see, so normally the sed -i command is not needed, just run the pacman sysroot …

No, it is needed if you use manjaro-chroot -a. It is not needed only if you mount things manually beforehand. TBH, I’m not sure how smart pacman --sysroot is, maybe it’s enough to only mount necessary partitions before you run the command.

Either way, this is mostly useful only when pacman in your system is broken. And there is also an alternative way with --root/-r, but you need to specify cachedir and other things AFAIK. And there is also pacman-static.

so you could just mount the root partition and then use pacman from the live usb to modify/install onto it?
and the pacman-static didnt work, didnt find any documentation on it, any guides, have no idea how to use it…

I just tested it, seems like mounting only partitions is not enough. And if you want to update everything then you have to mount your /boot partition as well (and/or any other relevant partitions).

You can test it yourself. If you haven’t updated yet today, try booting live iso and try updating your system via pacman --sysroot /mnt -Syu.

It’s just pacman with statically linked libraries, so it doesn’t matter if some pacman dependency is broken. Could be that you need to manually specify --cachedir, --gpgdir, etc. or whatever other flags are there. Never really looked into it much. :stuck_out_tongue: Could be that system is just so broken, that even pacman-static won’t help. Link: Using pacman-static

i believe you…
so chrooting and using external pacman as you did is the best option … no need for downloading pacman-static or installing the arch install scripts and thus wasting your time

Again, just to be absolutely clear: You use external pacman (as name suggests) outside of chroot. I just used manjaro-chroot to do all the mounting (and sed to not unmount everything on exit). But you can do it manually as described here: chroot - ArchWiki

i think i understand now… so lets say you chroot, then you open new instance of terminal and from this non chrooted terminal you can use external pacman, and in this case there would be no need to use the sed command?

Nice thinking. That should work too. (Btw, you are using sed command on live iso image, so it gets reverted on a reboot.)

ok so last thing, how would the sysroot command look when using overwrite:
sudo pacman --sysroot /mnt -S glibc --overwrite '*'
like this?

Yes, everything else is same. You can do pacman --sysroot /mnt -Qi mkinitcpio, etc.
Just remember, this won’t magically fix any other problems that might exist on the actual system, ie. with keyring or whatever - again, it’s mostly only useful when pacman in chroot doesn’t work.

ok, thank you very much … cant wait till someones system breaks, to test this stuff out

:rofl:

Tell them to delete /usr/lib/libalpm* before updating and then act surprised.

Give me a few minutes and I’ll see if I can break mine.I’ll come back using all caps and act concerned and won’t listen to any suggestions.