You are not logged in.

#1 2017-10-30 21:58:00

zuntik
Member
Registered: 2017-08-11
Posts: 37

New mkinitcpio config syntax

Hi, just now I installed the latest  system upgrades and I noticed a new file showed up:

/etc/mkinitcpio.conf.pacnew

What do I need to know about it? Can I just ignore it?

I have the old file (mkinitcpio.conf) with the encrypt and lvm2 hooks set up, do I need to move them to the new?

I shall wait for a reply before shuting down my computer.

Thanks

Offline

#2 2017-10-30 22:20:56

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: New mkinitcpio config syntax

The new format just moves each of the lines into an array. You can manually edit your file and delete the pacnew.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-10-30 23:26:45

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,846
Website

Re: New mkinitcpio config syntax

Ignoring any .pacnew is not a good idea. In this case, the old style should continue to work, but is probably deprecated and may be dropped in a future version.

https://git.archlinux.org/mkinitcpio.gi … 3852008c80


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2017-10-31 03:07:44

WFV
Member
From: ☭USSA⛧⭒⭒⭒⭒
Registered: 2013-04-23
Posts: 288

Re: New mkinitcpio config syntax

changes from "space delimited" to array (as mentioned), any changes you made to mkinitcpio retain those changes in the pacnew file in array(s) where required, you can always save the old one as mkinitcpio.conf.old in case you need to fall back on it, drop the .pacnew from the new one and you should be good to go, you can always run it to make sure it will run.

mkinitcpio -P

or -p or ? depending on your system. Can usually diff the existing vs pacnew files to see what needs to be done before using the new file.


∞ hard times make the strong, the strong make good times, good times make the weak, the weak make hard times ∞

Offline

#5 2017-11-02 19:04:53

brainfucksec
Member
Registered: 2017-03-01
Posts: 40
Website

Re: New mkinitcpio config syntax

The new syntax of mkinitcpio.conf has replaced the () with ""

e.g.

HOOKS=""

instead of

HOOKS=()

for security, backup your old mkinitcpio.conf before the changes.

On Arch Linux there is "pacdiff" for manage the .pacnew files: https://wiki.archlinux.org/index.php/Pa … nd_Pacsave

Last edited by brainfucksec (2017-11-03 10:45:54)


--= [ |<!55 ]=--

Offline

#6 2017-11-15 21:21:39

probackup-nl
Member
From: Delft
Registered: 2017-11-15
Posts: 83
Website

Re: New mkinitcpio config syntax

Is there any info why this mkinitcpio.conf syntax change from literal strings to arrays was made?

I have these nice explanatory and easily toggle-able MODULES line switches which now need to be reworked:

#MODULES=()
MODULES="btrfs crc32c_intel"   # filesystems
MODULES+=" sd_mod uas"  # storage
#MODULES+=" ahci"  # SATA
MODULES+=" hid_generic usbhid serio_raw atkbd i8042"  # keyboard
MODULES+=" xhci_pci"  # USB 3.1, 3.0, 2.0, 1.1
MODULES+=" ehci_pci"  # USB 2.0
#MODULES+=" ohci_pci"  # USB 1.1 non Intel or VIA chipset, like NEC
#MODULES+=" uhci_pci"  # USB 1.x Intel or VIA chipset
#MODULES+=""  # miscellaneous

Last edited by probackup-nl (2017-11-15 21:40:43)

Offline

#7 2017-11-15 22:08:50

probackup-nl
Member
From: Delft
Registered: 2017-11-15
Posts: 83
Website

Re: New mkinitcpio config syntax

After rework:

#MODULES=()
MODULES=(btrfs crc32c_intel)   # filesystems
MODULES=("${MODULES[@]}" sd_mod uas)  # storage
#MODULES=("${MODULES[@]}" ahci)  # SATA
MODULES=("${MODULES[@]}" hid_generic usbhid serio_raw atkbd i8042)  # keyboard
MODULES=("${MODULES[@]}" xhci_pci)  # USB 3.1, 3.0, 2.0, 1.1
MODULES=("${MODULES[@]}" ehci_pci)  # USB 2.0
#MODULES=("${MODULES[@]}" ohci_pci)  # USB 1.1 non Intel or VIA chipset, like NEC
#MODULES=("${MODULES[@]}" uhci_pci)  # USB 1.x Intel or VIA chipset
#MODULES=("${MODULES[@]}")  # miscellaneous

So much for readability of the shell array notation.

Offline

#8 2017-11-15 22:13:17

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,412
Website

Re: New mkinitcpio config syntax

So much for your basic understanding of how the shell works.

foo+=(bar)

Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#9 2017-11-16 10:34:20

probackup-nl
Member
From: Delft
Registered: 2017-11-15
Posts: 83
Website

Re: New mkinitcpio config syntax

@Alad Thanks for your reply and make me learn and improve.

I have not much clue of how the shell works. The search query for "bash array initialization round brackets" resulted in "The Ultimate Bash Array Tutorial with 15 Examples". The MODULES=("${MODULES[@]}"... config change was made based upon example #9: "Add an element to an existing Bash Array".

After changing mkinitcpio.conf to below, image creation still works as expected:

#     MODULES=(piix ide_disk reiserfs)
#MODULES=()
MODULES=(btrfs crc32c_intel)   # filesystems
MODULES+=(sd_mod uas)  # storage
#MODULES+=(ahci)  # SATA
MODULES+=(hid_generic usbhid serio_raw atkbd i8042)  # keyboard
MODULES+=(xhci_pci)  # USB 3.1, 3.0, 2.0, 1.1
MODULES+=(ehci_pci)  # USB 2.0
#MODULES+=(ohci_pci)  # USB 1.1 non Intel or VIA chipset, like NEC
#MODULES+=(uhci_pci)  # USB 1.x Intel or VIA chipset
#MODULES+=()  # miscellaneous

http://mywiki.wooledge.org/BashGuide is a better guide for Bash.

Last edited by probackup-nl (2017-11-16 11:26:23)

Offline

Board footer

Powered by FluxBB