Skip to content

Problem with grub in autoinstall script that I wrote

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!

3 points6 comments
Open on Reddit
About this post
Posted
Archived
Score
3 · 71% up
Kind
Text
ID
q8most

Author

13
posts
52
comments
2
media
View profile

6 comments

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

goes after

grub-install --target=x86_64-efi --efi-directory=/boot

?

4 points

I was about to comment the same thing, without the grub-install being run first I don't think the grub folder exists to place the grub.cfg file into hence the error reported.

4 points

Ya I saw that and was like... Yikes how did grub config anything before the /etc/default/grub was created by grub-install

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.