~alpine/users

9 4

[alpine-user] How to setup BTRFS and LUKS

Tristan Kohl <tristan@icetown.de>
Details
Message ID
<885afe4f-3231-468d-7928-7e41bf4cffd4@icetown.de>
Sender timestamp
1534159163
DKIM signature
missing
Download raw message
Hey guys,

I stumbled upon Alpine a while back when building new docker images for
my home server currently running Debian stable. Since I was quite
intrigued by its minimalism, I gave it a shot in a VM to play around. I
must admit, I fell in love and made an USB drive to use on my home
server. Most things work flawelessly (samba, docker, etc.) but I do not
get how one would get a BTRFS pool on LUKS drives working.

I think I have to dig into OpenRC and drop some service in "sysinit" to
decrypt my drives before fstab kicks in (which as far as I can tell
happens in devfs). I have my crypttab setup to work with a keyfile which
resides in /root.

What I need:
1. Mapping all LUKS drives to /dev/mapper/poolX (setup in /etc/crypttab)
2. Run btrfs device scan to detect my pool
3. Mount pool according to fstab

I am a Linux desktop user for 7 years and I do prefer command line for
many tasks but when it comes to server setups that are just a tad more
advanced I feel like an absolute beginner. When I build my server some 5
years ago I did just some copypasta from a vast number of sites without
documenting anything. Plus Debian did a lot of magic out of the box I
did not even knew of. However this "featurefullness" also always bugged
me since I had no idea what was actually going on behind the scenes.

Hope someone can help me out here, any help is greatly appreciated.

Cheers,
Tristan






---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Marco Dickert <marco@misterunknown.de>
Details
Message ID
<20180813115815.yhcnfmofdzvl5e2d@kronos.misterunknown.de>
In-Reply-To
<885afe4f-3231-468d-7928-7e41bf4cffd4@icetown.de> (view parent)
Sender timestamp
1534161495
DKIM signature
missing
Download raw message
On 2018-08-13 13:19:23, Tristan Kohl wrote:
> Most things work flawelessly (samba, docker, etc.) but I do not get how one
> would get a BTRFS pool on LUKS drives working.
> 
> I think I have to dig into OpenRC and drop some service in "sysinit" to
> decrypt my drives before fstab kicks in (which as far as I can tell
> happens in devfs). I have my crypttab setup to work with a keyfile which
> resides in /root.
> 
> What I need:
> 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in /etc/crypttab)
> 2. Run btrfs device scan to detect my pool
> 3. Mount pool according to fstab

I don't quite understand your problem. Did you read this [1]? Do you use
software raid (mdadm) or lvm? Anyway, make sure all the necessary features are
enabled in /etc/mkinitfs/mkinitfs.conf and rebuild it like described on the
linked wiki page.

If that does not work, please describe your exact problem with the setup.

[1] https://wiki.alpinelinux.org/wiki/Setting_up_disks_manually

Cheers,
-- 
Marco Dickert
marco@misterunknown.de
https://misterunknown.de
Tristan Kohl <tristan@icetown.de>
Details
Message ID
<62f28780-fcc7-6c47-5cd4-1a4c4d729d08@icetown.de>
In-Reply-To
<20180813115815.yhcnfmofdzvl5e2d@kronos.misterunknown.de> (view parent)
Sender timestamp
1534162208
DKIM signature
missing
Download raw message
Sorry if I was not clear about my setup.

I do not encrypt my root partition which is an unencrypted 16G ext4 on a
cheap USB drive. But I do have 8 HDDs in my tower ranging from 2-8TB
which are setup as a BTRFS pool holding a bunch of subvolumes which get
mounted all over the place.

When I boot I need Alpine to decrypt those drives, map them to
/dev/mapper/pool{0,1,2,...} and then run "btrfs device scan" so BTRFS
knows about the pool before Alpine executes my fstab holding all mounts
for those subvolumes.

This is my drive setup from the old Debian install. If I SSH into Alpine
and perform those steps manually, everything works. However I do not
want to SSH into my server, decrypt every drive by hand, run "btrfs
device scan" and "mount -a" everytime it has to reboot. Plus my
containers break if those pools are not present when Docker starts up.

I hope this clarifies things, thank you for your quick response.

Cheers,
Tristan

On 13.08.2018 13:58, Marco Dickert wrote:
> On 2018-08-13 13:19:23, Tristan Kohl wrote:
>> Most things work flawelessly (samba, docker, etc.) but I do not get how one
>> would get a BTRFS pool on LUKS drives working.
>>
>> I think I have to dig into OpenRC and drop some service in "sysinit" to
>> decrypt my drives before fstab kicks in (which as far as I can tell
>> happens in devfs). I have my crypttab setup to work with a keyfile which
>> resides in /root.
>>
>> What I need:
>> 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in /etc/crypttab)
>> 2. Run btrfs device scan to detect my pool
>> 3. Mount pool according to fstab
> 
> I don't quite understand your problem. Did you read this [1]? Do you use
> software raid (mdadm) or lvm? Anyway, make sure all the necessary features are
> enabled in /etc/mkinitfs/mkinitfs.conf and rebuild it like described on the
> linked wiki page.
> 
> If that does not work, please describe your exact problem with the setup.
> 
> [1] https://wiki.alpinelinux.org/wiki/Setting_up_disks_manually
> 
> Cheers,
> 


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Adam Růžička <cahircz@gmail.com>
Details
Message ID
<CALZ497bUo=rUe9S_-gWCJnQ_sBWoZ_hBe+osmww4UmgW6hdDRw@mail.gmail.com>
In-Reply-To
<62f28780-fcc7-6c47-5cd4-1a4c4d729d08@icetown.de> (view parent)
Sender timestamp
1534165407
DKIM signature
missing
Download raw message
Take a look at the dmcrypt service (configured in /etc/conf.d/dmcrypt).
Maybe there's some other way but that's what I use.

-- Adam

On Mon, Aug 13, 2018, 14:10 Tristan Kohl <tristan@icetown.de> wrote:

> Sorry if I was not clear about my setup.
>
> I do not encrypt my root partition which is an unencrypted 16G ext4 on a
> cheap USB drive. But I do have 8 HDDs in my tower ranging from 2-8TB
> which are setup as a BTRFS pool holding a bunch of subvolumes which get
> mounted all over the place.
>
> When I boot I need Alpine to decrypt those drives, map them to
> /dev/mapper/pool{0,1,2,...} and then run "btrfs device scan" so BTRFS
> knows about the pool before Alpine executes my fstab holding all mounts
> for those subvolumes.
>
> This is my drive setup from the old Debian install. If I SSH into Alpine
> and perform those steps manually, everything works. However I do not
> want to SSH into my server, decrypt every drive by hand, run "btrfs
> device scan" and "mount -a" everytime it has to reboot. Plus my
> containers break if those pools are not present when Docker starts up.
>
> I hope this clarifies things, thank you for your quick response.
>
> Cheers,
> Tristan
>
> On 13.08.2018 13:58, Marco Dickert wrote:
> > On 2018-08-13 13:19:23, Tristan Kohl wrote:
> >> Most things work flawelessly (samba, docker, etc.) but I do not get how
> one
> >> would get a BTRFS pool on LUKS drives working.
> >>
> >> I think I have to dig into OpenRC and drop some service in "sysinit" to
> >> decrypt my drives before fstab kicks in (which as far as I can tell
> >> happens in devfs). I have my crypttab setup to work with a keyfile which
> >> resides in /root.
> >>
> >> What I need:
> >> 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in /etc/crypttab)
> >> 2. Run btrfs device scan to detect my pool
> >> 3. Mount pool according to fstab
> >
> > I don't quite understand your problem. Did you read this [1]? Do you use
> > software raid (mdadm) or lvm? Anyway, make sure all the necessary
> features are
> > enabled in /etc/mkinitfs/mkinitfs.conf and rebuild it like described on
> the
> > linked wiki page.
> >
> > If that does not work, please describe your exact problem with the setup.
> >
> > [1] https://wiki.alpinelinux.org/wiki/Setting_up_disks_manually
> >
> > Cheers,
> >
>
>
> ---
> Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> Help:         alpine-user+help@lists.alpinelinux.org
> ---
>
>
Tristan Kohl <tristan@icetown.de>
Details
Message ID
<9a286f61-aaec-96be-9fbc-edf203876079@icetown.de>
In-Reply-To
<CALZ497bUo=rUe9S_-gWCJnQ_sBWoZ_hBe+osmww4UmgW6hdDRw@mail.gmail.com> (view parent)
Sender timestamp
1534169232
DKIM signature
missing
Download raw message
Thanks, that did the trick decrypting my drives. But I do not get why
crypttab does not work since it is mentioned in the wiki?

However I still have half of the problem left, BTRFS is not made aware
of the pool before fstab tries to mount it which obviously fails. I need
to run "btrfs device scan" before that.

Cheers,
Tristan

On 13.08.2018 15:03, Adam Růžička wrote:
> Take a look at the dmcrypt service (configured in /etc/conf.d/dmcrypt).
> Maybe there's some other way but that's what I use.
> 
> -- Adam
> 
> On Mon, Aug 13, 2018, 14:10 Tristan Kohl <tristan@icetown.de
> <tristan@icetown.de>> wrote:
> 
>     Sorry if I was not clear about my setup.
> 
>     I do not encrypt my root partition which is an unencrypted 16G ext4 on a
>     cheap USB drive. But I do have 8 HDDs in my tower ranging from 2-8TB
>     which are setup as a BTRFS pool holding a bunch of subvolumes which get
>     mounted all over the place.
> 
>     When I boot I need Alpine to decrypt those drives, map them to
>     /dev/mapper/pool{0,1,2,...} and then run "btrfs device scan" so BTRFS
>     knows about the pool before Alpine executes my fstab holding all mounts
>     for those subvolumes.
> 
>     This is my drive setup from the old Debian install. If I SSH into Alpine
>     and perform those steps manually, everything works. However I do not
>     want to SSH into my server, decrypt every drive by hand, run "btrfs
>     device scan" and "mount -a" everytime it has to reboot. Plus my
>     containers break if those pools are not present when Docker starts up.
> 
>     I hope this clarifies things, thank you for your quick response.
> 
>     Cheers,
>     Tristan
> 
>     On 13.08.2018 13:58, Marco Dickert wrote:
>     > On 2018-08-13 13:19:23, Tristan Kohl wrote:
>     >> Most things work flawelessly (samba, docker, etc.) but I do not
>     get how one
>     >> would get a BTRFS pool on LUKS drives working.
>     >>
>     >> I think I have to dig into OpenRC and drop some service in
>     "sysinit" to
>     >> decrypt my drives before fstab kicks in (which as far as I can tell
>     >> happens in devfs). I have my crypttab setup to work with a
>     keyfile which
>     >> resides in /root.
>     >>
>     >> What I need:
>     >> 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in
>     /etc/crypttab)
>     >> 2. Run btrfs device scan to detect my pool
>     >> 3. Mount pool according to fstab
>     >
>     > I don't quite understand your problem. Did you read this [1]? Do
>     you use
>     > software raid (mdadm) or lvm? Anyway, make sure all the necessary
>     features are
>     > enabled in /etc/mkinitfs/mkinitfs.conf and rebuild it like
>     described on the
>     > linked wiki page.
>     >
>     > If that does not work, please describe your exact problem with the
>     setup.
>     >
>     > [1] https://wiki.alpinelinux.org/wiki/Setting_up_disks_manually
>     >
>     > Cheers,
>     >
> 
> 
>     ---
>     Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     Help:         alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     ---
> 


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Tristan Kohl <tristan@icetown.de>
Details
Message ID
<91ffe437-8e42-978b-9247-811ce1c0a58c@icetown.de>
In-Reply-To
<885afe4f-3231-468d-7928-7e41bf4cffd4@icetown.de> (view parent)
Sender timestamp
1534244315
DKIM signature
missing
Download raw message
I want to give a little update on my progress so far:

Thanks to Adam I was able to have my drives encrypted during boot.
However they still were not recognized by BTRFS as one coherent pool.

I then tried to put "btrfs device scan" at various places in
/etc/runlevel/boot/localmount and others but that did not change
anything. I can confirm that the command got executed since I wrote
"btrfs device scan > /scan.txt" which created a file containing
"Scanning for Btrfs filesystems" after boot. But somehow the scans'
result got lost afterwards. Even puttig it right before the line "moun
-at ..." inside localmount did not have any effect. I am lost right now
as to what else I can try to fix this.

As I read in Arch and Gentoo wiki they use some hooks in their initramfs
but I am not sure if that will help since decryption has to run before
scanning plus I do not find anything as to how one would use/configure
them in Alpine.

Does anyone smarter than me has any idea what else I could try?

Cheers,
Tristan

On 13.08.2018 13:19, Tristan Kohl wrote:
> Hey guys,
> 
> I stumbled upon Alpine a while back when building new docker images for
> my home server currently running Debian stable. Since I was quite
> intrigued by its minimalism, I gave it a shot in a VM to play around. I
> must admit, I fell in love and made an USB drive to use on my home
> server. Most things work flawelessly (samba, docker, etc.) but I do not
> get how one would get a BTRFS pool on LUKS drives working.
> 
> I think I have to dig into OpenRC and drop some service in "sysinit" to
> decrypt my drives before fstab kicks in (which as far as I can tell
> happens in devfs). I have my crypttab setup to work with a keyfile which
> resides in /root.
> 
> What I need:
> 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in /etc/crypttab)
> 2. Run btrfs device scan to detect my pool
> 3. Mount pool according to fstab
> 
> I am a Linux desktop user for 7 years and I do prefer command line for
> many tasks but when it comes to server setups that are just a tad more
> advanced I feel like an absolute beginner. When I build my server some 5
> years ago I did just some copypasta from a vast number of sites without
> documenting anything. Plus Debian did a lot of magic out of the box I
> did not even knew of. However this "featurefullness" also always bugged
> me since I had no idea what was actually going on behind the scenes.
> 
> Hope someone can help me out here, any help is greatly appreciated.
> 
> Cheers,
> Tristan
> 
> 
> 
> 
> 
> 
> ---
> Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> Help:         alpine-user+help@lists.alpinelinux.org
> ---
> 


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Adam Růžička <cahircz@gmail.com>
Details
Message ID
<CALZ497ZDzhtV4yL3yL_Eyh8QLw_Hipuemu_iveUf4QzPW_4QBA@mail.gmail.com>
In-Reply-To
<91ffe437-8e42-978b-9247-811ce1c0a58c@icetown.de> (view parent)
Sender timestamp
1534258181
DKIM signature
missing
Download raw message
Hi,
one thing comes to mind. I think I encountered something similar
and the cause was that the btrfs kernel module was not loaded
at the time when "btrfs device scan" was run. To put it another way,
the userspace btrfs tool tries to look for the drives but doesn't know
how to read them. Could you try

echo 'btrfs' > /etc/modules.d/btrfs.conf

and then reboot (+ lbu if you're using that).  Hope this helps

-- Adam

On Tue, Aug 14, 2018 at 12:58 PM, Tristan Kohl <tristan@icetown.de> wrote:

> I want to give a little update on my progress so far:
>
> Thanks to Adam I was able to have my drives encrypted during boot.
> However they still were not recognized by BTRFS as one coherent pool.
>
> I then tried to put "btrfs device scan" at various places in
> /etc/runlevel/boot/localmount and others but that did not change
> anything. I can confirm that the command got executed since I wrote
> "btrfs device scan > /scan.txt" which created a file containing
> "Scanning for Btrfs filesystems" after boot. But somehow the scans'
> result got lost afterwards. Even puttig it right before the line "moun
> -at ..." inside localmount did not have any effect. I am lost right now
> as to what else I can try to fix this.
>
> As I read in Arch and Gentoo wiki they use some hooks in their initramfs
> but I am not sure if that will help since decryption has to run before
> scanning plus I do not find anything as to how one would use/configure
> them in Alpine.
>
> Does anyone smarter than me has any idea what else I could try?
>
> Cheers,
> Tristan
>
> On 13.08.2018 13:19, Tristan Kohl wrote:
> > Hey guys,
> >
> > I stumbled upon Alpine a while back when building new docker images for
> > my home server currently running Debian stable. Since I was quite
> > intrigued by its minimalism, I gave it a shot in a VM to play around. I
> > must admit, I fell in love and made an USB drive to use on my home
> > server. Most things work flawelessly (samba, docker, etc.) but I do not
> > get how one would get a BTRFS pool on LUKS drives working.
> >
> > I think I have to dig into OpenRC and drop some service in "sysinit" to
> > decrypt my drives before fstab kicks in (which as far as I can tell
> > happens in devfs). I have my crypttab setup to work with a keyfile which
> > resides in /root.
> >
> > What I need:
> > 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in /etc/crypttab)
> > 2. Run btrfs device scan to detect my pool
> > 3. Mount pool according to fstab
> >
> > I am a Linux desktop user for 7 years and I do prefer command line for
> > many tasks but when it comes to server setups that are just a tad more
> > advanced I feel like an absolute beginner. When I build my server some 5
> > years ago I did just some copypasta from a vast number of sites without
> > documenting anything. Plus Debian did a lot of magic out of the box I
> > did not even knew of. However this "featurefullness" also always bugged
> > me since I had no idea what was actually going on behind the scenes.
> >
> > Hope someone can help me out here, any help is greatly appreciated.
> >
> > Cheers,
> > Tristan
> >
> >
> >
> >
> >
> >
> > ---
> > Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> > Help:         alpine-user+help@lists.alpinelinux.org
> > ---
> >
>
>
> ---
> Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> Help:         alpine-user+help@lists.alpinelinux.org
> ---
>
>
Tristan Kohl <tristan@icetown.de>
Details
Message ID
<521b6968-57dc-8116-02f1-ec3b0dd8e8bb@icetown.de>
In-Reply-To
<CALZ497ZDzhtV4yL3yL_Eyh8QLw_Hipuemu_iveUf4QzPW_4QBA@mail.gmail.com> (view parent)
Sender timestamp
1534263607
DKIM signature
missing
Download raw message
Oh...wait...That works!

You sir deserve a medal! Thank you so much, I was absolutely sure I put
it in there but must have removed it during one of my countless tries.

Thanks again, I can finally move my full setup over to Alpine now :)

Cheers,
Tristan

On 14.08.2018 16:49, Adam Růžička wrote:
> Hi,
> one thing comes to mind. I think I encountered something similar
> and the cause was that the btrfs kernel module was not loaded
> at the time when "btrfs device scan" was run. To put it another way,
> the userspace btrfs tool tries to look for the drives but doesn't know
> how to read them. Could you try
> 
> echo 'btrfs' > /etc/modules.d/btrfs.conf
> 
> and then reboot (+ lbu if you're using that).  Hope this helps
> 
> -- Adam
> 
> On Tue, Aug 14, 2018 at 12:58 PM, Tristan Kohl <tristan@icetown.de
> <tristan@icetown.de>> wrote:
> 
>     I want to give a little update on my progress so far:
> 
>     Thanks to Adam I was able to have my drives encrypted during boot.
>     However they still were not recognized by BTRFS as one coherent pool.
> 
>     I then tried to put "btrfs device scan" at various places in
>     /etc/runlevel/boot/localmount and others but that did not change
>     anything. I can confirm that the command got executed since I wrote
>     "btrfs device scan > /scan.txt" which created a file containing
>     "Scanning for Btrfs filesystems" after boot. But somehow the scans'
>     result got lost afterwards. Even puttig it right before the line "moun
>     -at ..." inside localmount did not have any effect. I am lost right now
>     as to what else I can try to fix this.
> 
>     As I read in Arch and Gentoo wiki they use some hooks in their initramfs
>     but I am not sure if that will help since decryption has to run before
>     scanning plus I do not find anything as to how one would use/configure
>     them in Alpine.
> 
>     Does anyone smarter than me has any idea what else I could try?
> 
>     Cheers,
>     Tristan
> 
>     On 13.08.2018 13:19, Tristan Kohl wrote:
>     > Hey guys,
>     >
>     > I stumbled upon Alpine a while back when building new docker
>     images for
>     > my home server currently running Debian stable. Since I was quite
>     > intrigued by its minimalism, I gave it a shot in a VM to play
>     around. I
>     > must admit, I fell in love and made an USB drive to use on my home
>     > server. Most things work flawelessly (samba, docker, etc.) but I
>     do not
>     > get how one would get a BTRFS pool on LUKS drives working.
>     >
>     > I think I have to dig into OpenRC and drop some service in
>     "sysinit" to
>     > decrypt my drives before fstab kicks in (which as far as I can tell
>     > happens in devfs). I have my crypttab setup to work with a keyfile
>     which
>     > resides in /root.
>     >
>     > What I need:
>     > 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in
>     /etc/crypttab)
>     > 2. Run btrfs device scan to detect my pool
>     > 3. Mount pool according to fstab
>     >
>     > I am a Linux desktop user for 7 years and I do prefer command line for
>     > many tasks but when it comes to server setups that are just a tad more
>     > advanced I feel like an absolute beginner. When I build my server
>     some 5
>     > years ago I did just some copypasta from a vast number of sites
>     without
>     > documenting anything. Plus Debian did a lot of magic out of the box I
>     > did not even knew of. However this "featurefullness" also always
>     bugged
>     > me since I had no idea what was actually going on behind the scenes.
>     >
>     > Hope someone can help me out here, any help is greatly appreciated.
>     >
>     > Cheers,
>     > Tristan
>     >
>     >
>     >
>     >
>     >
>     >
>     > ---
>     > Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     > Help:         alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     > ---
>     >
> 
> 
>     ---
>     Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     Help:         alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     ---
> 
> 


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Details
Message ID
<CANf5e8aByDVT1p_h6sZRSf6hKU0Y42cDeLGRVemhr5oW46EpEQ@mail.gmail.com>
In-Reply-To
<521b6968-57dc-8116-02f1-ec3b0dd8e8bb@icetown.de> (view parent)
Sender timestamp
1534493951
DKIM signature
missing
Download raw message
Hi Tristan,

Would you mind sharing your setup?  I tried to use keyfile to automount a
luks encrypted volume: root(/) partiton, added the line
"lvmcrypt /dev/vda2 /etc/mykeyfile luks" to /etc/crypttab, then run
"mkinitfs"
to regenerate initramfs, but it doesn't work.
Still prompts for passphrase :(

btw, i use ext4 file system, thanks.

On Wed, Aug 15, 2018 at 12:20 AM, Tristan Kohl  wrote:

> Oh...wait...That works!
>
> You sir deserve a medal! Thank you so much, I was absolutely sure I put
> it in there but must have removed it during one of my countless tries.
>
> Thanks again, I can finally move my full setup over to Alpine now :)
>
> Cheers,
> Tristan
>
> On 14.08.2018 16:49, Adam Růžička wrote:
> > Hi,
> > one thing comes to mind. I think I encountered something similar
> > and the cause was that the btrfs kernel module was not loaded
> > at the time when "btrfs device scan" was run. To put it another way,
> > the userspace btrfs tool tries to look for the drives but doesn't know
> > how to read them. Could you try
> >
> > echo 'btrfs' > /etc/modules.d/btrfs.conf
> >
> > and then reboot (+ lbu if you're using that).  Hope this helps
> >
> > -- Adam
> >
> > On Tue, Aug 14, 2018 at 12:58 PM, Tristan Kohl <tristan@icetown.de
> > <tristan@icetown.de>> wrote:
> >
> >     I want to give a little update on my progress so far:
> >
> >     Thanks to Adam I was able to have my drives encrypted during boot.
> >     However they still were not recognized by BTRFS as one coherent pool.
> >
> >     I then tried to put "btrfs device scan" at various places in
> >     /etc/runlevel/boot/localmount and others but that did not change
> >     anything. I can confirm that the command got executed since I wrote
> >     "btrfs device scan > /scan.txt" which created a file containing
> >     "Scanning for Btrfs filesystems" after boot. But somehow the scans'
> >     result got lost afterwards. Even puttig it right before the line
> "moun
> >     -at ..." inside localmount did not have any effect. I am lost right
> now
> >     as to what else I can try to fix this.
> >
> >     As I read in Arch and Gentoo wiki they use some hooks in their
> initramfs
> >     but I am not sure if that will help since decryption has to run
> before
> >     scanning plus I do not find anything as to how one would
> use/configure
> >     them in Alpine.
> >
> >     Does anyone smarter than me has any idea what else I could try?
> >
> >     Cheers,
> >     Tristan
> >
> >     On 13.08.2018 13:19, Tristan Kohl wrote:
> >     > Hey guys,
> >     >
> >     > I stumbled upon Alpine a while back when building new docker
> >     images for
> >     > my home server currently running Debian stable. Since I was quite
> >     > intrigued by its minimalism, I gave it a shot in a VM to play
> >     around. I
> >     > must admit, I fell in love and made an USB drive to use on my home
> >     > server. Most things work flawelessly (samba, docker, etc.) but I
> >     do not
> >     > get how one would get a BTRFS pool on LUKS drives working.
> >     >
> >     > I think I have to dig into OpenRC and drop some service in
> >     "sysinit" to
> >     > decrypt my drives before fstab kicks in (which as far as I can tell
> >     > happens in devfs). I have my crypttab setup to work with a keyfile
> >     which
> >     > resides in /root.
> >     >
> >     > What I need:
> >     > 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in
> >     /etc/crypttab)
> >     > 2. Run btrfs device scan to detect my pool
> >     > 3. Mount pool according to fstab
> >     >
> >     > I am a Linux desktop user for 7 years and I do prefer command line
> for
> >     > many tasks but when it comes to server setups that are just a tad
> more
> >     > advanced I feel like an absolute beginner. When I build my server
> >     some 5
> >     > years ago I did just some copypasta from a vast number of sites
> >     without
> >     > documenting anything. Plus Debian did a lot of magic out of the
> box I
> >     > did not even knew of. However this "featurefullness" also always
> >     bugged
> >     > me since I had no idea what was actually going on behind the
> scenes.
> >     >
> >     > Hope someone can help me out here, any help is greatly appreciated.
> >     >
> >     > Cheers,
> >     > Tristan
> >     >
> >     >
> >     >
> >     >
> >     >
> >     >
> >     > ---
> >     > Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> >     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
> >     > Help:         alpine-user+help@lists.alpinelinux.org
> >     <alpine-user%2Bhelp@lists.alpinelinux.org>
> >     > ---
> >     >
> >
> >
> >     ---
> >     Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> >     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
> >     Help:         alpine-user+help@lists.alpinelinux.org
> >     <alpine-user%2Bhelp@lists.alpinelinux.org>
> >     ---
> >
> >
>
>
> ---
> Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> Help:         alpine-user+help@lists.alpinelinux.org
> ---
>
>
Tristan Kohl <tristan@icetown.de>
Details
Message ID
<bbc518ca-ca0d-f817-5d64-f9cd1a551127@icetown.de>
In-Reply-To
<CANf5e8aByDVT1p_h6sZRSf6hKU0Y42cDeLGRVemhr5oW46EpEQ@mail.gmail.com> (view parent)
Sender timestamp
1534700782
DKIM signature
missing
Download raw message
Well it it quite simple, I just use a RAID1 configuration for my home
server.

/etc/crypttab is not bein used by Alpine to decrypt volumes, I had this
figured out by Adam's tip. Rather you enter your details in
/etc/conf.d/dmcrypt like this:

target=pool0
source=UUID="<UUID>"
key=/root/keyfile

Afterwards you add "btrfs" to /etc/modules so your kernel knows how to
handle those volumes once dmcrypt has mapped them after decryption. The
only thing to do then is to drop "/sbin/btrfs device scan" above "mount
-at "$types" $no_netdev" in /etc/init.d/localmount so there is a BTRFS
device scan run before fstab gets executed.

This should be all you have to do in order for your RAID1/5/6/10 to work
properly.

Cheers,
Tristan


On 17.08.2018 10:19, Dave Jones wrote:
> Hi Tristan,
> 
> Would you mind sharing your setup?  I tried to use keyfile to automount a
> luks encrypted volume: root(/) partiton, added the line
> "lvmcrypt /dev/vda2 /etc/mykeyfile luks" to /etc/crypttab, then run
> "mkinitfs"
> to regenerate initramfs, but it doesn't work.
> Still prompts for passphrase :(
> 
> btw, i use ext4 file system, thanks.
> 
> On Wed, Aug 15, 2018 at 12:20 AM, Tristan Kohl wrote:
> 
>     Oh...wait...That works!
> 
>     You sir deserve a medal! Thank you so much, I was absolutely sure I put
>     it in there but must have removed it during one of my countless tries.
> 
>     Thanks again, I can finally move my full setup over to Alpine now :)
> 
>     Cheers,
>     Tristan
> 
>     On 14.08.2018 16:49, Adam Růžička wrote:
>     > Hi,
>     > one thing comes to mind. I think I encountered something similar
>     > and the cause was that the btrfs kernel module was not loaded
>     > at the time when "btrfs device scan" was run. To put it another way,
>     > the userspace btrfs tool tries to look for the drives but doesn't know
>     > how to read them. Could you try
>     > 
>     > echo 'btrfs' > /etc/modules.d/btrfs.conf
>     > 
>     > and then reboot (+ lbu if you're using that).  Hope this helps
>     > 
>     > -- Adam
>     > 
>     > On Tue, Aug 14, 2018 at 12:58 PM, Tristan Kohl <tristan@icetown.de <tristan@icetown.de>
>     > <tristan@icetown.de <tristan@icetown.de>>> wrote:
>     >
>     >     I want to give a little update on my progress so far:
>     >
>     >     Thanks to Adam I was able to have my drives encrypted during boot.
>     >     However they still were not recognized by BTRFS as one
>     coherent pool.
>     >
>     >     I then tried to put "btrfs device scan" at various places in
>     >     /etc/runlevel/boot/localmount and others but that did not change
>     >     anything. I can confirm that the command got executed since I
>     wrote
>     >     "btrfs device scan > /scan.txt" which created a file containing
>     >     "Scanning for Btrfs filesystems" after boot. But somehow the
>     scans'
>     >     result got lost afterwards. Even puttig it right before the
>     line "moun
>     >     -at ..." inside localmount did not have any effect. I am lost
>     right now
>     >     as to what else I can try to fix this.
>     >
>     >     As I read in Arch and Gentoo wiki they use some hooks in their
>     initramfs
>     >     but I am not sure if that will help since decryption has to
>     run before
>     >     scanning plus I do not find anything as to how one would
>     use/configure
>     >     them in Alpine.
>     >
>     >     Does anyone smarter than me has any idea what else I could try?
>     >
>     >     Cheers,
>     >     Tristan
>     >
>     >     On 13.08.2018 13:19, Tristan Kohl wrote:
>     >     > Hey guys,
>     >     >
>     >     > I stumbled upon Alpine a while back when building new docker
>     >     images for
>     >     > my home server currently running Debian stable. Since I was
>     quite
>     >     > intrigued by its minimalism, I gave it a shot in a VM to play
>     >     around. I
>     >     > must admit, I fell in love and made an USB drive to use on
>     my home
>     >     > server. Most things work flawelessly (samba, docker, etc.) but I
>     >     do not
>     >     > get how one would get a BTRFS pool on LUKS drives working.
>     >     >
>     >     > I think I have to dig into OpenRC and drop some service in
>     >     "sysinit" to
>     >     > decrypt my drives before fstab kicks in (which as far as I
>     can tell
>     >     > happens in devfs). I have my crypttab setup to work with a
>     keyfile
>     >     which
>     >     > resides in /root.
>     >     >
>     >     > What I need:
>     >     > 1. Mapping all LUKS drives to /dev/mapper/poolX (setup in
>     >     /etc/crypttab)
>     >     > 2. Run btrfs device scan to detect my pool
>     >     > 3. Mount pool according to fstab
>     >     >
>     >     > I am a Linux desktop user for 7 years and I do prefer
>     command line for
>     >     > many tasks but when it comes to server setups that are just
>     a tad more
>     >     > advanced I feel like an absolute beginner. When I build my
>     server
>     >     some 5
>     >     > years ago I did just some copypasta from a vast number of sites
>     >     without
>     >     > documenting anything. Plus Debian did a lot of magic out of
>     the box I
>     >     > did not even knew of. However this "featurefullness" also always
>     >     bugged
>     >     > me since I had no idea what was actually going on behind the
>     scenes.
>     >     >
>     >     > Hope someone can help me out here, any help is greatly
>     appreciated.
>     >     >
>     >     > Cheers,
>     >     > Tristan
>     >     >
>     >     >
>     >     >
>     >     >
>     >     >
>     >     >
>     >     > ---
>     >     > Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     >     <alpine-user%2Bunsubscribe@lists.alpinelinux.org
>     <alpine-user%252Bunsubscribe@lists.alpinelinux.org>>
>     >     > Help:         alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     >     <alpine-user%2Bhelp@lists.alpinelinux.org
>     <alpine-user%252Bhelp@lists.alpinelinux.org>>
>     >     > ---
>     >     >
>     > 
>     > 
>     >     ---
>     >     Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     >     <alpine-user%2Bunsubscribe@lists.alpinelinux.org
>     <alpine-user%252Bunsubscribe@lists.alpinelinux.org>>
>     >     Help:         alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     >     <alpine-user%2Bhelp@lists.alpinelinux.org
>     <alpine-user%252Bhelp@lists.alpinelinux.org>>
>     >     ---
>     >
>     >
> 
> 
>     ---
>     Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     Help:         alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     ---
> 
> 


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)