grub-mkconfig: line 261: /boot/grub/grub.cfg.new: no such file or directory

I do not understand this problem, here is my script:

echo This is a script to install Arch automatically, make sure to have booted into an efi vm

echo Also please make sure to have partitioned the disks using tools such as cfdisk -tui- or fdisk -commandline-

#make the file systems

mkfs.ext4 /dev/sda3

mkswap /dev/sda2

mkfs.fat -F 32 /dev/sda1

#mount root and swap

mount /dev/sda3 /mnt

swapon /dev/sda2

#install needed packages in new install

pacstrap /mnt base linux linux-firmware linux-headers vim networkmanager sudo git grub os-prober efibootmgr xdg-user-dirs

#mount efi

mkdir /mnt/boot/efi

mount /dev/sda1 /mnt/boot/efi

#generate the fstab

genfstab -U /mnt >> /mnt/etc/fstab

#all things in chroot (cant add comments in code)

cat << EOF | sudo arch-chroot /mnt

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

hwclock --systohc

sed -i "s/#en_GB/en_GB/g; s/#en_US.UTF-8/en_US.UTF-8/g" /etc/locale.gen

echo "LANG=en_GB.UTF-8" > /etc/locale.conf

locale-gen

echo -e "arch" > /etc/hostname

echo -e "127.0.0.1\tlocalhost" >> /etc/hosts

echo -e "::1\t\tlocalhost" >> /etc/hosts

echo -e "127.0.1.1\tarch" >> /etc/hosts

mkinitcpio -P

systemctl enable NetworkManager

useradd -m -g users -G wheel,games,power,optical,storage,scanner,lp,audio,video,input,adm,users -s /bin/bash max

echo -en "12345\n12345" | passwd

echo -en "12345\n12345" | passwd max

sed -i "s/^# %wheel/%wheel/g" /etc/sudoers

tee -a /etc/sudoers << END

END

mkdir -p /etc/X11/xorg.conf.d && tee <<'END' /etc/X11/xorg.conf.d/90-touchpad.conf 1> /dev/null

Section "InputClass"

Identifier "touchpad"

MatchIsTouchpad "on"

Driver "libinput"

Option "Tapping" "on"

EndSection

END

os-prober

grub-mkconfig -o /boot/grub/grub.cfg

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

su max

cd

xdg-user-dirs-update

EOF

#chroot exited

#unmount all partitions

umount -a

Any help appreciated!

submitted by /u/max12mx13
[link] [comments]