grub2-mkconfig not found

1,232 views
Skip to first unread message

zack...@gmail.com

unread,
Aug 12, 2016, 11:57:53 PM8/12/16
to qubes-users
Hi all, I'm a new qubes user and have been following the guides to get trim enabled for the dom0. Everything seems to have gone smoothly until the grub steps. I can't find a grub.cfg file anywhere. The only abnormality to my installation is that it's UEFI. So the closest thing I did find to this was /boot/efi/EFI/qubes/xen.cfg which had the kernel line referenced in the trim guide. However, when I attempt to run grub2-mkconfig -o /boot/efi/EFI/qubes/xen.cfg I get "grub2-mkconfig: command not found"
All that is present in the /boot/grub2 folder is a themes folder. I am using the main dom0 terminal for all of this.

Considering that everything boots fine, I'm hesitant to reinstall grub2 (I assume it would need to be grub2-efi in this case). Any clue as to what's going on? Thanks

Andrew David Wong

unread,
Aug 13, 2016, 6:12:06 AM8/13/16
to zack...@gmail.com, qubes-users, Marek Marczykowski-Górecki
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I think grub2-mkconfig is not found because you're using UEFI rather than
legacy boot. Are you getting your instructions from here?

https://www.qubes-os.org/doc/disk-trim/

I think these instructions were written with legacy boot in mind. I'm not sure
how to enable TRIM on UEFI (CCing Marek).

- --
Andrew David Wong (Axon)
Community Manager, Qubes OS
https://www.qubes-os.org
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJXrvJsAAoJENtN07w5UDAwnc8P/35kWSsRqTEPB4cA/F2dbTg/
m4eieEBI+qyo3mgMNSb/m2/WviqGtNWyOf5KT8ecHHoi6yeXVgv/eam2YgaCMYC0
K4RRTOOWPuguZlDDuZDI4OABeWEsQsekl7Mm6aQoA55SgekmyYv1B4iYaQ6RFUS1
b4TAmDteKea9l6thaxrJimv13l/LAUpsRxKiH/vksdpjPx3QSEQVozs6XNrEbbPo
ROXTF/kzbXP1b8GPCIcZLuD+wsomFVM0NyVwXRGDvL3wTIMTxL5qYprLu/Xnzr6m
53Yb+J6alV4gmXoRUWoHm2UzlB2LxffJlkVWbTzi4xaluIC6oAQ5YNvMg0etIHY1
7bfP8eEvr/3/iPI4ut15drUJNCjCaQG/fJy4hjOZOIqihxoGRTGceA5SCpkITpbt
uua7sO2Ya4rTG3fT8NudM7TFFsnUHuQ8VrKZTLZRhWG+BbRHlb2EumDFWv9qSNgd
qQ7vhXa+upy8/ccGMbIq07q/NbjB7MXm1h9ntch6RMPMtTUZXGlpip+urkVNzx1c
WIB4aLBleIytrbZofZspc51q4oIeEqVv5ge9D4oEKMj0BE1sTmOweYviH7GeC6w3
057VRyrtZmf0Zhx2XmJVtRtPgWbT2jZvHeEMlPR0KY04xIYPmoXmuuT0lufOtGQ4
Bt4EvyaJziT7Iy0+Fwxq
=g2ha
-----END PGP SIGNATURE-----

Marek Marczykowski-Górecki

unread,
Aug 13, 2016, 6:14:44 AM8/13/16
to Andrew David Wong, zack...@gmail.com, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Sat, Aug 13, 2016 at 03:11:57AM -0700, Andrew David Wong wrote:
> On 2016-08-12 20:57, zack...@gmail.com wrote:
> > Hi all, I'm a new qubes user and have been following the guides to get
> > trim enabled for the dom0. Everything seems to have gone smoothly until the
> > grub steps. I can't find a grub.cfg file anywhere. The only abnormality to
> > my installation is that it's UEFI. So the closest thing I did find to this
> > was /boot/efi/EFI/qubes/xen.cfg which had the kernel line referenced in the
> > trim guide. However, when I attempt to run grub2-mkconfig -o
> > /boot/efi/EFI/qubes/xen.cfg I get "grub2-mkconfig: command not found" All
> > that is present in the /boot/grub2 folder is a themes folder. I am using
> > the main dom0 terminal for all of this.
> >
> > Considering that everything boots fine, I'm hesitant to reinstall grub2 (I
> > assume it would need to be grub2-efi in this case). Any clue as to what's
> > going on? Thanks
> >
>
> I think grub2-mkconfig is not found because you're using UEFI rather than
> legacy boot. Are you getting your instructions from here?
>
> https://www.qubes-os.org/doc/disk-trim/
>
> I think these instructions were written with legacy boot in mind. I'm not sure
> how to enable TRIM on UEFI (CCing Marek).

Yes, on UEFI install /boot/efi/EFI/qubes/xen.cfg is the right file - you
need to edit it directly.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJXrvMNAAoJENuP0xzK19csfqQH/0/P4FV8W2/pZhWaCeXfseqj
fw79GDTa5/ExjxSg4eehHDhHHVgG3kaeb0HafPvVnHS/DJuHzCG1Xrs1vyZJlPID
oCrH4FaaYQ2Che4L4D/Koh5lNEdEakKOrF7ILbTRN5u8Q4xvdM9KQ/paacCYkCDJ
YlYKELzyOZ1wkUvwttPynTANdrMlY797BHkHYHv2TbaMBTjw4EYmIs+VM9MRIWIv
Lis1hZn97y1z3ZIQglrQRCDLAmoNJPBsXRdMHjNyA5EeKQPX+fNxsE3/HIoqrIi3
3DHYzKIS/UBDFHOJXj7I3pK311fS1IcUlrbRCXJYCM0gF5A5EkWKxIj0ghV0YTI=
=uhvX
-----END PGP SIGNATURE-----

zack...@gmail.com

unread,
Aug 13, 2016, 9:53:20 AM8/13/16
to qubes-users, a...@qubes-os.org, zack...@gmail.com
So I'm editing the right file, that's all and good. Here's what I've done so far:

#Find UUID of ssd
ls /dev/mapper/luks-*
#Set trim in crypttab
sudo nano /etc/crypttab
#Add "allow-discards" at end of entry for ssd with matching UUID
#Set trim in fstab
sudo nano /etc/fstab
#Add "discard" after other flags (like "default") for everything but swap
sudo nano /etc/lvm/lvm.conf
#Change "issue_discards" from "0" to "1"
#Add discard to grub
sudo nano /boot/efi/EFI/qubes/xen.cfg
#At the end of the kernel line, add "rd.luks.allow-discards=1"
#Rebuild initramfs
sudo dracut -H -f
##Check if discard (trim) is enabled:
lsblk -D
#OR
sudo dmsetup table

Everything above works except that lsblk still shows no trim support so I guess that the rebuilding of grub is an important step in this. How do I rebuild it with UEFI? I tried:

grub2-mkconfig -o /boot/efi/EFI/qubes/xen.cfg

but I just get the grub2-mkconfig not found error

Andrew David Wong

unread,
Aug 13, 2016, 10:32:12 AM8/13/16
to zack...@gmail.com, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 2016-08-13 06:53, zack...@gmail.com wrote:
> On Saturday, August 13, 2016 at 6:14:44 AM UTC-4, Marek
> Marczykowski-Górecki wrote: On Sat, Aug 13, 2016 at 03:11:57AM -0700,
> Andrew David Wong wrote:
>>>> On 2016-08-12 20:57, zack...@gmail.com wrote:
>>>>> Hi all, I'm a new qubes user and have been following the guides to
>>>>> get trim enabled for the dom0. Everything seems to have gone
>>>>> smoothly until the grub steps. I can't find a grub.cfg file
>>>>> anywhere. The only abnormality to my installation is that it's
>>>>> UEFI. So the closest thing I did find to this was
>>>>> /boot/efi/EFI/qubes/xen.cfg which had the kernel line referenced
>>>>> in the trim guide. However, when I attempt to run grub2-mkconfig -o
>>>>> /boot/efi/EFI/qubes/xen.cfg I get "grub2-mkconfig: command not
>>>>> found" All that is present in the /boot/grub2 folder is a themes
>>>>> folder. I am using the main dom0 terminal for all of this.
>>>>>
>>>>> Considering that everything boots fine, I'm hesitant to reinstall
>>>>> grub2 (I assume it would need to be grub2-efi in this case). Any
>>>>> clue as to what's going on? Thanks
>>>>>
>>>>
>>>> I think grub2-mkconfig is not found because you're using UEFI rather
>>>> than legacy boot. Are you getting your instructions from here?
>>>>
>>>> https://www.qubes-os.org/doc/disk-trim/
>>>>
>>>> I think these instructions were written with legacy boot in mind.
>>>> I'm not sure how to enable TRIM on UEFI (CCing Marek).
>
> Yes, on UEFI install /boot/efi/EFI/qubes/xen.cfg is the right file - you
> need to edit it directly.
>
>
> So I'm editing the right file, that's all and good. Here's what I've done
> so far:
>
> #Find UUID of ssd ls /dev/mapper/luks-* #Set trim in crypttab sudo nano
> /etc/crypttab #Add "allow-discards" at end of entry for ssd with matching
> UUID #Set trim in fstab sudo nano /etc/fstab #Add "discard" after other
> flags (like "default") for everything but swap sudo nano /etc/lvm/lvm.conf
> #Change "issue_discards" from "0" to "1" #Add discard to grub sudo nano
> /boot/efi/EFI/qubes/xen.cfg #At the end of the kernel line, add
> "rd.luks.allow-discards=1" #Rebuild initramfs sudo dracut -H -f ##Check if
> discard (trim) is enabled: lsblk -D #OR sudo dmsetup table
>
> Everything above works except that lsblk still shows no trim support so I
> guess that the rebuilding of grub is an important step in this. How do I
> rebuild it with UEFI? I tried:
>
> grub2-mkconfig -o /boot/efi/EFI/qubes/xen.cfg
>
> but I just get the grub2-mkconfig not found error
>

Quoting Marek from a different thread [1]:

> By default, if you install Qubes OS in EFI mode (which is the case when
> you launch installer as such), grub is not installed at all and Qubes is
> configured to boot xen.efi directly from UEFI BIOS.
>
> In that case, xen and kernel command line can be configured in
> /boot/efi/EFI/qubes/xen.cfg.
>
> Some details here: https://github.com/QubesOS/qubes-issues/issues/794

So, I don't think you're supposed to try to rebuild grub. Have you tried
simply rebooting after editing xen.cfg?


[1] https://groups.google.com/d/msg/qubes-users/0855TpoheY8/qxOnC_ZCDQAJ

- --
Andrew David Wong (Axon)
Community Manager, Qubes OS
https://www.qubes-os.org
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJXry9fAAoJENtN07w5UDAwXnoP/3fFWf9MsgDdu9Frr7yOn5Fn
gtotENq4qZlpBwY/k1zSa8jGN8wT0nZcYZthUQgeIe4mUzh8Db/m2uAKDZCpFFRH
QzWvRBChcssXtzrtslkn5uf78g3d/VEonl0Fp/RQPl3bleKNMrssbhk0LchFXe/U
uDYdKWlTbTOYKP5Ucl/fEi+KxBWMx3EhBcKzbBi6WYuvy4/juyAAn/wF5xBWWzkP
zv0bTfsPSIP+HMqZ6P0bbcy5Fe4PTib8InsRiiRucwIZ2ulxXbd5S7WPws/lNTVD
rzgz/myv1ptIm8H5D1bliCVbBHaaDGNzNJMIoNCd1gcDgucI2Ov4kgfVbfxvENHg
/JAMmbZvyFW7nnXW46goYBtZ+MOBnidA8DhSpY5tLJiJ+MNsamwStc08mtoL7uqx
qNX2JDrW/SEzKzPwoEatVlVbdsfg7omjI4cLpUBfuQgbc6x4g/iol7lPn03DfCO0
3+lQFmx5/HWGBg00Ta3rznYK78mWfwpFaxVlQ4y7y7STjPOZ2AVE1V811oqLrtfO
xN3fYiCXGFHrgDukPhyHyzwnVifyWqiP7YsEdR4fUeFolmoiynKTFfSC75be7FOg
V5xEpS/qhAA979IVwOT0OGUUy1nkqEeXvhQbFQVSo1k+FHUucjCbrgsdb8EHbMlH
voRCXtsaCyMpCdZi1hNw
=fSFj
-----END PGP SIGNATURE-----

zack...@gmail.com

unread,
Aug 13, 2016, 10:43:43 AM8/13/16
to qubes-users
I have tried rebooting. The lsblk output has 0s under DISC-ZERO for the dom0 partitions and the dsmsetup output has a ton of zeros in it which I'm not sure what that means (my internet is down, I can post the output hopefully tomorrow if that helps)

Marek Marczykowski-Górecki

unread,
Aug 13, 2016, 5:45:58 PM8/13/16
to zack...@gmail.com, qubes-users, a...@qubes-os.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

I think dracut by default place output file in
/boot/initramfs-(kernel version), while on UEFI system bootloader loads
it from /boot/efi/EFI/qubes/. Try to copy it there.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJXr5UPAAoJENuP0xzK19csZGMH/RUxcWpX8666s3xhNptrw7NH
d5bgtzZu9kHWCGILyeLAmnJcW8y36VPMhdWcbyLcakh4WSKqPqIIqJeq+1CAm6bG
SRMTMnMTIjlQsP9ODNGFpS/JaW8tN6qQA4Cg33NSs92mlWIcRDy/ufb7A8S+NxEu
0LssHH7A7y+aY13ZDy9osd3S/cKf1c8v/fQOTcg29QRq8hq0KKaD8J/a/xiCbvth
yc2eknJGOnG8j1Q3v3X6ByaA8StbmlR9LibkmSH7Y8DV3cV7Rmbv/0M7IbSf7V7F
oeehHK+AhFHZLHidQUxd4UkIfI7CKymHyzHIqClYXvdjiZui5ClSvsLmJPR+ovw=
=jCSn
-----END PGP SIGNATURE-----

zack...@gmail.com

unread,
Aug 14, 2016, 9:14:12 PM8/14/16
to qubes-users, zack...@gmail.com, a...@qubes-os.org
I checked the date and time of creation of the initramfs file in the directories you specified and you are correct in that dracut created it in /boot. However, after copying it to /boot/efi/EFI/qubes and replacing the one there, there's still no trim support. Here's my output:

sudo dmsetup table
snapshot-fb01:3278378-fb01:3279033: 0 20971520 snapshot 7:7 7:8 P 256
qubes_dom0-swap: 0 15990784 linear 251:0 2048
qubes_dom0-root: 0 451420160 linear 251:0 15992832
luks-07201718-857d-4108-a722-a5956c443e1e: 0 467421184 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:19 4096 1 allow_discards
snapshot-fb01:3278350-fb01:3278346: 0 20971520 snapshot 7:0 7:1 P 256

lsblk -D
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda 0 512B 2G 0
├─sda1 0 512B 2G 0
├─sda2 0 512B 2G 0
├─sda3 0 512B 2G 0
└─sda4 0 512B 2G 0
sdb 0 512B 2G 0
├─sdb1 0 512B 2G 0
├─sdb2 0 512B 2G 0
└─sdb3 0 512B 2G 0
└─luks-07201718-857d-4108-a722-a5956c443e1e
0 512B 2G 0
├─qubes_dom0-root 0 512B 2G 0
└─qubes_dom0-swap 0 512B 2G 0
sdc 0 0B 0B 0
└─sdc1 0 0B 0B 0
sdd 0 0B 0B 0
├─sdd1 0 0B 0B 0
├─sdd2 0 0B 0B 0
└─sdd3 0 0B 0B 0
sde 0 0B 0B 0
└─sde1 0 0B 0B 0
sdf 0 0B 0B 0
└─sdf1 0 0B 0B 0
sr0 0 0B 0B 0
loop0 0 4K 4G 1
└─snapshot-fb01:3278350-fb01:3278346 0 4K 4G 1
loop1 0 4K 4G 1
└─snapshot-fb01:3278350-fb01:3278346 0 4K 4G 1
loop2 0 4K 4G 1
loop3 0 4K 4G 1
loop4 0 4K 4G 1
loop5 0 4K 4G 1
loop6 0 4K 4G 1
loop7 0 4K 4G 1
└─snapshot-fb01:3278378-fb01:3279033 0 4K 4G 1
loop8 0 4K 4G 1
└─snapshot-fb01:3278378-fb01:3279033 0 4K 4G 1
loop9 0 4K 4G 1
loop10 0 4K 4G 1

Sdb is obviously the drive I have qubes installed on

Marek Marczykowski-Górecki

unread,
Aug 29, 2016, 10:18:44 PM8/29/16
to zack...@gmail.com, qubes-users, a...@qubes-os.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

> I checked the date and time of creation of the initramfs file in the directories you specified and you are correct in that dracut created it in /boot. However, after copying it to /boot/efi/EFI/qubes and replacing the one there, there's still no trim support. Here's my output:
>
> sudo dmsetup table
> snapshot-fb01:3278378-fb01:3279033: 0 20971520 snapshot 7:7 7:8 P 256
> qubes_dom0-swap: 0 15990784 linear 251:0 2048
> qubes_dom0-root: 0 451420160 linear 251:0 15992832
> luks-07201718-857d-4108-a722-a5956c443e1e: 0 467421184 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:19 4096 1 allow_discards

The "allow_discards" is here, so it worked.

> snapshot-fb01:3278350-fb01:3278346: 0 20971520 snapshot 7:0 7:1 P 256
>
> lsblk -D
> NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
> sda 0 512B 2G 0
> ├─sda1 0 512B 2G 0
> ├─sda2 0 512B 2G 0
> ├─sda3 0 512B 2G 0
> └─sda4 0 512B 2G 0
> sdb 0 512B 2G 0
> ├─sdb1 0 512B 2G 0
> ├─sdb2 0 512B 2G 0
> └─sdb3 0 512B 2G 0
> └─luks-07201718-857d-4108-a722-a5956c443e1e
> 0 512B 2G 0
> ├─qubes_dom0-root 0 512B 2G 0
> └─qubes_dom0-swap 0 512B 2G 0

I don't see anything wrong here.
Just to be sure, you can trim empty space:

sudo fstrim -v /

You should get info about trimmed space (and not an error).

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJXxOz5AAoJENuP0xzK19csjYMH/3sZUWL9qrwp0cy3rVZ6D46S
VT4fe5FOEceGbmmVKmDI7WIT8pF4PXT8gK9bsgHLcfy6CqfoLR0SwsbMgaWtp1WE
2qnBN8+gzgVlQUTSzTv/1LkhSH8J3+OsTu4ZidwuxMx9Ae8hrprjjNhsC7z5JOAD
kZwQQCN34voP9GJmEDMOxG2UebOI1bIHoPvyVsaPsoZLLNsBB5K2q4hxBGXCM6JX
eKSfbS65AowTrKk/ayQjJ5kuc/F2Clh6/rTd80kDy3gq5VVCpRWb5Z9vnVRTOIGZ
pgcPUX4W3P+IqZxFnymgavkApREVFjMlFzo5/2xP8uj0IAZiDvmnsIIKBxw/GXo=
=nlor
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages