After an update of Debian 9 ('Stretch'), I can't open any program. Is there anything I can do on grub? Can't even open a terminal.
I'm going to take your question literally and not try too discuss too much how to fix your environment. That is I'm going to explain how to get to a terminal. From there you will need to start to diagnose the problem and fix. You are always welcome to come and ask a new question when you know more about what's wrong.
Before you try doing anything in grub, check to see if you can get to a terminal without the GUI. From the (non-functional) GUI, press ctrlalt5. That's 5 on the top row of your keyboard, not the number pad. Actually most of the numbers would work, but either 1 or 2 will be the GUI itself. You can go back to the GUI using ctrlalt1 or ctrlalt2 depending on which terminal the GUI is running on.
This is the best option for getting a terminal as everything will be mounted as you need it.
Getting to a command prompt using grub
If you really can't get to any terminal then the "nuclear option" is to boot directly into a command (bash) prompt. That is, assuming you want to use a bash command line you can make bash be the only thing run at boot.
To do this you need to power on your system and when the grub menu comes you can press ↓↑ quickly to stop it automatically booting. Then select your usual boot option and press e. This will present you with the menu entry's config. This might look something like this:
load_video insmod gzio if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi insmod part_gpt insmod ext2 set root='hd0,gpt8' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt8 --hint-efi=hd0,gpt8 --hint-baremetal=ahci0,gpt8 cb015492-4ca4-4fae-a416-6d89443e4680 else search --no-floppy --fs-uuid --set=root cb015492-4ca4-4fae-a416-6d89443e4680 fi echo 'Loading Linux 5.3.0-19-generic ...' linux /vmlinuz-5.3.0-19-generic root=UUID=ff6f177b-8261-4ea7-a088-bfbf7556c7b0 ro recovery nomodeset echo 'Loading initial ramdisk ...' initrd /initrd.img-5.3.0-19-generic
Look through this config for a line that starts with
linux. Then carefully add to the end of that line:
linux /vmlinuz-5.3.0-19-generic root=UUID=ff6f177b-8261-4ea7-a088-bfbf7556c7b0 ro recovery nomodeset init=/bin/bash
Then press F10 to boot.
Once you get to a command prompt this way you will find that a lot of things have not been mounted as you normally expect. Root (
/) will be read-only and you will not have
/run. There may be other things not mounted including
/boot/efi or other paritions.
# Mount / as RW mount -o remount,rw / # Mount dev sys proc and run mount -t devtmpfs devtmpfs /dev mount -t proc proc /proc mount -t sysfs sysfs /sys mount -t tmpfs tmpfs /run
Then read through
/etc/fstab to look for anything else you might need. For example if I type
cat /etc/fstab I can see an entry
# /boot was on /dev/sda8 during installation UUID=cb015492-4ca4-4fae-a416-6d89443e4680 /boot ext4 defaults 0 2
I could ...
mount UUID=cb015492-4ca4-4fae-a416-6d89443e4680 /boot
Or, simpler to type would be to use
blkid to find the device:
blkid /dev/mapper/ubuntu: UUID="ff6f177b-8261-4ea7-a088-bfbf7556c7b0" TYPE="ext4" /dev/sda2: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="2641-087E" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="27141f73-5de4-4785-8894-3c774fae7e79" /dev/sda5: UUID="d7a0c72d-e9cc-49d6-8482-d08c5225d22d" LABEL="Ubuntu" TYPE="crypto_LUKS" PARTLABEL="Linux Home" PARTUUID="0fc32a26-808a-4f1c-8d15-3369da0b564b" /dev/sda8: UUID="cb015492-4ca4-4fae-a416-6d89443e4680" TYPE="ext4"
mount /dev/sda8 /booot
This is enough to get you to a working command line. After that I'm afraid you've got to work the problem and try to discover what went wrong.
If this was just a system update that broke your UI then it may be that your profile settings are not compatible with the new upgraded UI. As a precaution you could move your home directory out of the way and re-create an empty one, then restart your machine. At least that way you are logging in with a blank profile.
eg for user philip:
cd ~/.. mv philip philip_old mkdir philip chown philip:philip philip reboot