You are not logged in.

#1 2013-10-01 14:22:21

oboenerd
Member
From: Right behind you.
Registered: 2012-08-15
Posts: 52

pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

Hi all,

In the past few weeks I've been playing around with Vagrant/Virtualbox to create disposable virtual machines.  However, the 3.11 kernel causes a regression with Virtualbox guest systems which causes shared folders to stop working.  Although this regression has already been fixed in VBox's SVN and will propagate into the next release, I realized that I don't need a bleeding-edge kernel in my virtual machine anyways, so I decided to switch to the linux-lts package.  This way if any further regressions happen in the future I have a much slimmer chance of ever having to deal with them.

Here's the catch: at the moment I'd like to find a way to avoid having to install the linux kernel before I install linux-lts, because having the newer kernel around increases my virtual machine disk size by 100MB, roughly 40% larger than what I usually get.  Since virtualbox works by wrapping around a raw disk image, uninstalling the linux kernel after installing linux-lts doesn't help.  I would like to find a way to exclude linux and install the lts kernel directly.

One way that I've devised is querying the groups in the base group, using sed s/^linux/linux-lts/g to substitute the new kernel, and then using pacstrapping the updated list to the new system - but I'm quite sure this isn't update-safe.  Isn't 'base' itself necessary in the case that new packages are added or removed from the base group?

An easier way, though incredibly unlikely, would be to have a base-lts group that would be the same as the base group but install the lts kernel instead.  Of course, this is unlikely because package groups are actually embedded inside the repos themselves, right?  Doing so would involve having an extra group for a very, very limited use scenario.

tl;dr, a quick summary of my goals:
- Install linux-lts properly without ever installing linux package
- Find a way to do this properly while installing "base" group (for update-proofing), or determine if it is not necessary
- Automate this process (mostly completed, just need to figure out the lts part of the puzzle)

Any help/expertise on the inner workings of pacman would be appreciated!  Thanks.

Last edited by oboenerd (2013-10-01 18:31:07)


"I quoted myself." -oboenerd

Offline

#2 2013-10-01 16:02:01

arcon
Member
Registered: 2013-05-27
Posts: 128

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

I am not sure but you can try:

# pacstrap -i /mnt <your_package_here>

EDIT: <your_package_here> is going to be a package not a package group. That package will (may be) pull all the needed packages, do some research.

Last edited by arcon (2013-10-01 16:04:08)


The short cuts are only short because they don't actually go anywhere. -- Trilby
Nothing feels better than being understood -- awayand
A pathetic dreamer smile

Offline

#3 2013-10-01 16:08:14

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

One way that I've devised is querying the groups in the base group, using sed s/^linux/linux-lts/g to substitute the new kernel, and then using pacstrapping the updated list to the new system - but I'm quite sure this isn't update-safe.  Isn't 'base' itself necessary in the case that new packages are added or removed from the base group?

This method is safe. pacman does not store the names of installed groups. Necessary packages are always listed as dependencies. groups are only there to facilitate the installation of a group of packages. There is no difference between installing a group and installing all members of a group, the result is exactly the same.

Last edited by progandy (2013-10-01 16:12:41)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2013-10-01 18:28:11

oboenerd
Member
From: Right behind you.
Registered: 2012-08-15
Posts: 52

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

progandy wrote:

One way that I've devised is querying the groups in the base group, using sed s/^linux/linux-lts/g to substitute the new kernel, and then using pacstrapping the updated list to the new system - but I'm quite sure this isn't update-safe.  Isn't 'base' itself necessary in the case that new packages are added or removed from the base group?

This method is safe. pacman does not store the names of installed groups. Necessary packages are always listed as dependencies. groups are only there to facilitate the installation of a group of packages. There is no difference between installing a group and installing all members of a group, the result is exactly the same.

Excellent!

For anyone else who wants to try this, the solution to installing linux-lts without ever touching linux is:

pacman -Sg base | cut -d ' ' -f 2 | sed s/^linux\$/linux-lts/g | pacstrap /mnt -

All done.  Thanks Progandy for the very crucial point.

EDIT: added \$ character for extra future-proofing.

Last edited by oboenerd (2013-10-01 18:30:39)


"I quoted myself." -oboenerd

Offline

#5 2013-12-08 18:30:26

ODra
Member
Registered: 2012-01-22
Posts: 11

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

Excellent!

For anyone else who wants to try this, the solution to installing linux-lts without ever touching linux is:

pacman -Sg base | cut -d ' ' -f 2 | sed s/^linux\$/linux-lts/g | pacstrap /mnt -

All done.  Thanks Progandy for the very crucial point.

EDIT: added \$ character for extra future-proofing.

Howdy oboenerd,
can you tell me how to do that step by step, please? I mean what else do I have to do? I put this line:

pacman -Sg base | cut -d ' ' -f 2 | sed s/^linux\$/linux-lts/g | pacstrap /mnt -

to the terminal, but it ends up with synchronized databases without proceed installation. Can you tell me how to pacstrapping the updated list to the new system?

Offline

#6 2013-12-08 20:47:43

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

This command would use the current pacman sync to pass along all the package names in the base group to the pacstrap command.  So if you are running from the live media, it will be necessary to sync the databases first.

This command could do without the pipe to cut as well.  Just pass another 'q' to the first pacman command to get only the package name.

pacman -Sqg base | sed 's/^\(linux\)$/\1-lts/' | pacstrap /mnt - 

You could also just use command substitution to achieve the same thing.  Maybe this might be easier to understand.

pacstrap /mnt $(pacman -Sqg base | sed 's/^\(linux\)$/\1-lts/') 

Offline

#7 2013-12-08 21:23:51

ODra
Member
Registered: 2012-01-22
Posts: 11

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

WonderWoofy wrote:

This command would use the current pacman sync to pass along all the package names in the base group to the pacstrap command.  So if you are running from the live media, it will be necessary to sync the databases first.

This command could do without the pipe to cut as well.  Just pass another 'q' to the first pacman command to get only the package name.

pacman -Sqg base | sed 's/^\(linux\)$/\1-lts/' | pacstrap /mnt - 

You could also just use command substitution to achieve the same thing.  Maybe this might be easier to understand.

pacstrap /mnt $(pacman -Sqg base | sed 's/^\(linux\)$/\1-lts/') 

Thank WonderWoofy very much for reply.
But those commands just start downloading base with linux instead of linux-lts. :-( I'm lost.

Offline

#8 2013-12-08 21:37:43

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

The pacstrap command is really just a wrapper around pacman.  So typically you would do 'pacstrap /mnt base' which would install the base package group to /mnt.  So instead of 'base' you want to pass it along all the packages you wish to install, which in this case is all the packages of 'base' with the exception of 'linux-lts' instead of 'linux'. 

The first command is piping  all the packages of 'base' to sed, which simply searches for the string "linux" and then appends "-lts" to the end of it, then all those packages are passed to pactrap (the '-' at the end means that it should use stdin as the arguments).  The second example there just sticks the list of packages in a command substitution.

I just tested both of these on a spare partition, and they both worked fine...

Offline

#9 2013-12-09 02:20:28

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

The command with $() might cause problems if there are too many packages in the base group and there is not enough space in the commandline for them. The limit for me is about 2MB of data. Using "-" and sending the package names with a pipe and stdin prevents that from happening however unlikely it is. Some systems might have a limit of 4096 characters maximum.

@Wonderwoofy: the sed command can be shortened further with &:

sed 's/^linux$/&-lts/'

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#10 2013-12-09 02:41:16

oboenerd
Member
From: Right behind you.
Registered: 2012-08-15
Posts: 52

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

Beautiful.  I always love more elegant ways to do things.

If you're on an install livecd you must sync your pacman databases to load the list of the base group into memory.  If you fail to do this this triggers a bug which simply causes the string "base" to be passed on to the pacstrap command, which expands to the unaltered base group.  At least, that's what would happen on my earlier version of the command.

So I repeat, on a live install disk you must run pacman -Sy to load the "base" list before doing the following pacstrap.

pacman -Sy
pacstrap /mnt $(pacman -Sqg base | sed 's/^linux$/&-lts/') 

PS: Thanks to WonderWoofy and progandy for your wonderfully bash-ing tips!  I tip my hat to both of you.

Last edited by oboenerd (2013-12-09 02:43:05)


"I quoted myself." -oboenerd

Offline

#11 2013-12-09 02:55:36

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

progandy wrote:

@Wonderwoofy: the sed command can be shortened further with &:

sed 's/^linux$/&-lts/'

This is nice smile

Offline

#12 2013-12-12 18:42:30

ODra
Member
Registered: 2012-01-22
Posts: 11

Re: pacstrap linux-lts without ever installing 'linux' package [SOLVED!]

pacman -Sy
pacstrap /mnt $(pacman -Sqg base | sed 's/^linux$/&-lts/') 

Hey,
that's exactly what I've been looking for. It works, thank you guys.

Offline

Board footer

Powered by FluxBB