You are not logged in.

#1 2020-07-07 19:12:55

ironman3
Member
Registered: 2020-07-07
Posts: 7

Pacman hook moving linux boot files to another ESP folder

Hello Arch Linux community.

Im relatively new to this distro and linux overall - so I need help on creating my first pacman hook.
As mentioned in the topic I want to move all the updated boot files from /boot to the /EFI/arch folder on my ESP partition. My custom script looks like:

[Trigger]
Operation = Upgrade
Type = Package
Target = linux
Target = linux-headers

[Achtion]
Discription = Moving files from /boot to /boot/EFI/arch
When = PostTransaction
Exec = mv /boot/vmlinux-linux /boot/EFI/arch/
Exec = mv /boot/initramfs-linux.img /boot/EFI/arch/             
Exec = mv /boot/initramfs-linux-fallback.img /boot/EFI/arch/

Is this solution possible/Can I actually launch bash commands in a hook? I didnt find a more aesthetic way so far...

Best regards

Offline

#2 2020-07-07 19:22:38

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: Pacman hook moving linux boot files to another ESP folder

Why do you want the kernel in a subfolder on the ESP?  What boot manager are you using?  Do you even need the kernel on the ESP?

As for "bash commands" that depends on what you need.  `mv` is a binary under /usr/bin/, so you can use that.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2020-07-07 21:11:26

ironman3
Member
Registered: 2020-07-07
Posts: 7

Re: Pacman hook moving linux boot files to another ESP folder

I'm using rEFInd and want to store all the boot necessary files in the arch folder to get the arch icon displayed on the boot menu.
I actually don't know if I need the whole kernel on my esp but the boot files which initialize the os and further. And this are the files I want to move.

Offline

#4 2020-07-07 21:41:23

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: Pacman hook moving linux boot files to another ESP folder

You could create an entry in refind.conf for the kernel with the icon you want or  bind mount  /boot/EFI/arch/ to /boot both avoiding using the custom hook.

Offline

#5 2020-07-07 22:08:42

ironman3
Member
Registered: 2020-07-07
Posts: 7

Re: Pacman hook moving linux boot files to another ESP folder

Thanks. The first choice may be the easiest but if I imagine a dual boot whith multiple kernel files at the same place it could get really hard to overview.
The second guess sound really nice but Im not sure how to do this? just creating a fstab entry which says like "boot/EFI/arch/ /boot ..." ? Doesn't looking right to me.

Offline

#6 2020-07-07 22:12:52

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: Pacman hook moving linux boot files to another ESP folder

Untested but something such as

/boot/EFI/arch/    /boot    none    bind    0    0

Offline

#7 2020-07-08 15:07:33

ironman3
Member
Registered: 2020-07-07
Posts: 7

Re: Pacman hook moving linux boot files to another ESP folder

Tested it - seems to not work as expected. Files even placed in the /boot folder...

# <devices> <dir> <type> <options> <dump> <pass>

# /dev/sda1
PARTUUID=19c99006-6c81-44eb-891a-b44228dc4f46    /boot    vfat    defaults    0 2

/boot/EFI/arch/    /boot    none    bind    0 0

# /dev/sda2
PARTUUID=49e228a7-8fd0-42a5-b465-fa7b41e90ee3    none    swap    defaults    0 0

# /dev/sda3
PARTUUID=15c4ceb7-bfe8-47a9-82fb-45f6fa6a32ae    /    ext4    rw,relatime    0 1

Offline

#8 2020-07-08 15:13:29

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,461

Re: Pacman hook moving linux boot files to another ESP folder

Yeah, you need to mount the ESP somewhere other than /boot for that to work.

Offline

#9 2020-07-08 18:17:20

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: Pacman hook moving linux boot files to another ESP folder

Using /esp for the ESP

# <devices> <dir> <type> <options> <dump> <pass>

# /dev/sda3
PARTUUID=15c4ceb7-bfe8-47a9-82fb-45f6fa6a32ae    /    ext4    rw,relatime    0 1

# /dev/sda2
PARTUUID=49e228a7-8fd0-42a5-b465-fa7b41e90ee3    none    swap    defaults    0 0

# /dev/sda1
PARTUUID=19c99006-6c81-44eb-891a-b44228dc4f46    /esp    vfat    defaults    0 2

/esp/EFI/arch/    /boot    none    bind    0 0

Offline

#10 2020-07-08 20:20:09

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,679
Website

Re: Pacman hook moving linux boot files to another ESP folder

ironman3 wrote:

I actually don't know if I need the whole kernel on my esp

No, rEFInd does not require that the kernel & initramfs be on the ESP. It includes EFI filesystem drivers.

Offline

#11 2020-07-10 08:05:02

ironman3
Member
Registered: 2020-07-07
Posts: 7

Re: Pacman hook moving linux boot files to another ESP folder

loqs wrote:

Using /esp for the ESP

# <devices> <dir> <type> <options> <dump> <pass>

# /dev/sda3
PARTUUID=15c4ceb7-bfe8-47a9-82fb-45f6fa6a32ae    /    ext4    rw,relatime    0 1

# /dev/sda2
PARTUUID=49e228a7-8fd0-42a5-b465-fa7b41e90ee3    none    swap    defaults    0 0

# /dev/sda1
PARTUUID=19c99006-6c81-44eb-891a-b44228dc4f46    /esp    vfat    defaults    0 2

/esp/EFI/arch/    /boot    none    bind    0 0

Tried and it seemed to work. Just had to change the "bind" to "defaults,bind" to boot properly.
Thank you!

Offline

Board footer

Powered by FluxBB