dariuszb
Posts: 33
Joined: Sun Feb 21, 2016 3:55 pm

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 11:31 am

jamesh wrote:
Thu Oct 17, 2019 11:21 am
sudo cryptdisks_start cryptswap

Is there a problem with using ext4 (or vfat)?

[warn] Starting crypto disk...cryptswap (starting)...[....] cryptswap: the precheck for '/dev/mmcblk0p2' failed: - The device /dev/mmcblk0p2 contains a filesystem type ext4. ... (warning).
failed.
I am talking about encrypting swap partition not ext4.

if /dev/mmcblk0p2 is indeed partition you intend to use (all data will be deleted) run before

Code: Select all

sudo mkswap /dev/mmcblk0p2
at this stage you can enable it as not encrypted swap:

Code: Select all

sudo swapon /dev/mmcblk0p2
and see that

Code: Select all

stress -m 2  --vm-bytes 500M
works

then you can disable it

Code: Select all

sudo swapoff -a
and try encryption

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23879
Joined: Sat Jul 30, 2011 7:41 pm

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 11:54 am

Ah, OK, so encrypting an entire partition, not just a swap file. My mistake. Sounds like a load of effort to go to for very little benefit.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

Kendek
Posts: 127
Joined: Thu Jul 25, 2019 4:39 pm
Location: Kaposvár, Hungary

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 12:00 pm

jamesh wrote:
Thu Oct 17, 2019 11:54 am
Ah, OK, so encrypting an entire partition, not just a swap file. My mistake. Sounds like a load of effort to go to for very little benefit.
You can try it with a SWAP file, I've just described the steps. It's a minute, including the stability test, just a little effort. :)

User avatar
DougieLawson
Posts: 36312
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 12:03 pm

Have you tried ditching the swapfile and creating a TYPE82 swap parition? Then encrypting that.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23879
Joined: Sat Jul 30, 2011 7:41 pm

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 12:19 pm

Kendek wrote:
Thu Oct 17, 2019 12:00 pm
jamesh wrote:
Thu Oct 17, 2019 11:54 am
Ah, OK, so encrypting an entire partition, not just a swap file. My mistake. Sounds like a load of effort to go to for very little benefit.
You can try it with a SWAP file, I've just described the steps. It's a minute, including the stability test, just a little effort. :)
OK, will do that.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23879
Joined: Sat Jul 30, 2011 7:41 pm

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 12:56 pm

So, got some sort of kernel crash dump via serial console, not yet sure what it all means.

Code: Select all

[  143.156303] swapper/0: page allocation failure: order:0, mode:0x480020(GFP_ATOMIC), nodemask=(null)
[  143.156310] swapper/0 cpuset=/ mems_allowed=0
[  143.156324] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G         C        4.19.75-v7l+ #1270
[  143.156327] Hardware name: BCM2835
[  143.156349] [<c0212d10>] (unwind_backtrace) from [<c020d530>] (show_stack+0x20/0x24)
[  143.156359] [<c020d530>] (show_stack) from [<c097fb20>] (dump_stack+0xd4/0x118)
[  143.156367] [<c097fb20>] (dump_stack) from [<c0344638>] (warn_alloc+0xcc/0x170)
[  143.156376] [<c0344638>] (warn_alloc) from [<c03457dc>] (__alloc_pages_nodemask+0x104c/0x1180)
[  143.156382] [<c03457dc>] (__alloc_pages_nodemask) from [<c0345b00>] (page_frag_alloc+0x14c/0x160)
[  143.156391] [<c0345b00>] (page_frag_alloc) from [<c0854d44>] (__netdev_alloc_skb+0xb4/0x158)
[  143.156403] [<c0854d44>] (__netdev_alloc_skb) from [<c073d1a4>] (bcmgenet_rx_refill+0x44/0x264)
[  143.156412] [<c073d1a4>] (bcmgenet_rx_refill) from [<c073d900>] (bcmgenet_rx_poll+0x254/0xa3c)
[  143.156419] [<c073d900>] (bcmgenet_rx_poll) from [<c086f890>] (net_rx_action+0x310/0x494)
[  143.156427] [<c086f890>] (net_rx_action) from [<c0202410>] (__do_softirq+0x190/0x3f0)
[  143.156435] [<c0202410>] (__do_softirq) from [<c0228308>] (irq_exit+0xfc/0x120)
[  143.156445] [<c0228308>] (irq_exit) from [<c0280e08>] (__handle_domain_irq+0x70/0xc4)
[  143.156453] [<c0280e08>] (__handle_domain_irq) from [<c0202244>] (gic_handle_irq+0x4c/0x88)
[  143.156459] [<c0202244>] (gic_handle_irq) from [<c02019bc>] (__irq_svc+0x5c/0x7c)
[  143.156463] Exception stack(0xc1001ed8 to 0xc1001f20)
[  143.156467] 1ec0:                                                       c0209a84 00000000
[  143.156472] 1ee0: 40000193 40000193 c1004dbc c1000000 c1004e04 00000001 c109641a c10a56c0
[  143.156477] 1f00: c0e67a38 c1001f34 c10051c4 c1001f28 00000000 c0209a88 40000113 ffffffff
[  143.156484] [<c02019bc>] (__irq_svc) from [<c0209a88>] (arch_cpu_idle+0x34/0x4c)
[  143.156491] [<c0209a88>] (arch_cpu_idle) from [<c099cd2c>] (default_idle_call+0x34/0x48)
[  143.156500] [<c099cd2c>] (default_idle_call) from [<c02542b4>] (do_idle+0xec/0x17c)
[  143.156509] [<c02542b4>] (do_idle) from [<c0254604>] (cpu_startup_entry+0x28/0x2c)
[  143.156516] [<c0254604>] (cpu_startup_entry) from [<c09963c0>] (rest_init+0xbc/0xc0)
[  143.156526] [<c09963c0>] (rest_init) from [<c0e00fe4>] (start_kernel+0x4b8/0x4e8)
[  143.156531] Mem-Info:
[  143.156539] active_anon:883724 inactive_anon:24732 isolated_anon:11
                active_file:17532 inactive_file:20998 isolated_file:37
                unevictable:4 dirty:0 writeback:73 unstable:0
                slab_reclaimable:4261 slab_unreclaimable:7671
                mapped:18022 shmem:12516 pagetables:2532 bounce:68
                free:7131 free_pcp:63 free_cma:5866
[  143.156547] Node 0 active_anon:3534896kB inactive_anon:98928kB active_file:70128kB inactive_file:83992kB unevictable:16kB isolated(anon):44kB isolated(file):148kB mapped:72088kB dirty:0kB writeback:292kB shmem:50064kB writeback_tmp:0kB unstable:0kB all_unreclaimable? no
[  143.156555] DMA free:28472kB min:16384kB low:20480kB high:24576kB active_anon:570980kB inactive_anon:0kB active_file:14824kB inactive_file:7100kB unevictable:0kB writepending:0kB present:786432kB managed:735740kB mlocked:0kB kernel_stack:1736kB pagetables:692kB bounce:272kB free_pcp:0kB local_pcp:0kB free_cma:23464kB
[  143.156558] lowmem_reserve[]: 0 0 3136 3136
[  143.156579] HighMem free:52kB min:512kB low:18388kB high:36264kB active_anon:2963500kB inactive_anon:98164kB active_file:56380kB inactive_file:77232kB unevictable:16kB writepending:292kB present:3211264kB managed:3211264kB mlocked:16kB kernel_stack:0kB pagetables:9436kB bounce:0kB free_pcp:252kB local_pcp:252kB free_cma:0kB
[  143.156581] lowmem_reserve[]: 0 0 0 0
[  143.156597] DMA: 188*4kB (UMEC) 46*8kB (UMEC) 32*16kB (UMEC) 18*32kB (UMEC) 10*64kB (UEC) 4*128kB (U) 0*256kB 2*512kB (EC) 0*1024kB 2*2048kB (EC) 5*4096kB (C) = 28960kB
[  143.156658] HighMem: 5*4kB (UM) 16*8kB (UM) 7*16kB (U) 1*32kB (M) 3*64kB (M) 1*128kB (M) 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 612kB
[  143.156709] 51199 total pagecache pages
[  143.156713] 115 pages in swap cache
[  143.156716] Swap cache stats: add 169, delete 54, find 0/0
[  143.156719] Free swap  = 625400kB
[  143.156722] Total swap = 626680kB
[  143.156725] 999424 pages RAM
[  143.156728] 802816 pages HighMem/MovableOnly
[  143.156731] 12673 pages reserved
[  143.156734] 65536 pages cma reserved
[  143.477671] swapper/0: page allocation failure: order:0, mode:0x480020(GFP_ATOMIC), nodemask=(null)
[  143.477677] swapper/0 cpuset=/ mems_allowed=0
[  143.477692] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G         C        4.19.75-v7l+ #1270
[  143.477695] Hardware name: BCM2835
[  143.477716] [<c0212d10>] (unwind_backtrace) from [<c020d530>] (show_stack+0x20/0x24)
[  143.477727] [<c020d530>] (show_stack) from [<c097fb20>] (dump_stack+0xd4/0x118)
[  143.477736] [<c097fb20>] (dump_stack) from [<c0344638>] (warn_alloc+0xcc/0x170)
[  143.477745] [<c0344638>] (warn_alloc) from [<c03457dc>] (__alloc_pages_nodemask+0x104c/0x1180)
[  143.477751] [<c03457dc>] (__alloc_pages_nodemask) from [<c0345b00>] (page_frag_alloc+0x14c/0x160)
[  143.477760] [<c0345b00>] (page_frag_alloc) from [<c0854d44>] (__netdev_alloc_skb+0xb4/0x158)
[  143.477771] [<c0854d44>] (__netdev_alloc_skb) from [<c073d1a4>] (bcmgenet_rx_refill+0x44/0x264)
[  143.477780] [<c073d1a4>] (bcmgenet_rx_refill) from [<c073d900>] (bcmgenet_rx_poll+0x254/0xa3c)
[  143.477787] [<c073d900>] (bcmgenet_rx_poll) from [<c086f890>] (net_rx_action+0x310/0x494)
[  143.477795] [<c086f890>] (net_rx_action) from [<c0202410>] (__do_softirq+0x190/0x3f0)
[  143.477804] [<c0202410>] (__do_softirq) from [<c0228308>] (irq_exit+0xfc/0x120)
[  143.477814] [<c0228308>] (irq_exit) from [<c0280e08>] (__handle_domain_irq+0x70/0xc4)
[  143.477822] [<c0280e08>] (__handle_domain_irq) from [<c0202244>] (gic_handle_irq+0x4c/0x88)
[  143.477828] [<c0202244>] (gic_handle_irq) from [<c02019bc>] (__irq_svc+0x5c/0x7c)
[  143.477832] Exception stack(0xc1001ed8 to 0xc1001f20)
[  143.477836] 1ec0:                                                       c0209a84 00000000
[  143.477841] 1ee0: 40000193 40000193 c1004dbc c1000000 c1004e04 00000001 c109641a c10a56c0
[  143.477846] 1f00: c0e67a38 c1001f34 c10051c4 c1001f28 00000000 c0209a88 40000113 ffffffff
[  143.477853] [<c02019bc>] (__irq_svc) from [<c0209a88>] (arch_cpu_idle+0x34/0x4c)
[  143.477860] [<c0209a88>] (arch_cpu_idle) from [<c099cd2c>] (default_idle_call+0x34/0x48)
[  143.477869] [<c099cd2c>] (default_idle_call) from [<c02542b4>] (do_idle+0xec/0x17c)
[  143.477877] [<c02542b4>] (do_idle) from [<c0254604>] (cpu_startup_entry+0x28/0x2c)
[  143.477884] [<c0254604>] (cpu_startup_entry) from [<c09963c0>] (rest_init+0xbc/0xc0)
[  143.477894] [<c09963c0>] (rest_init) from [<c0e00fe4>] (start_kernel+0x4b8/0x4e8)
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

dariuszb
Posts: 33
Joined: Sun Feb 21, 2016 3:55 pm

Re: Encrypted swap crashes all system

Thu Oct 17, 2019 1:11 pm

DougieLawson wrote:
Thu Oct 17, 2019 12:03 pm
Have you tried ditching the swapfile and creating a TYPE82 swap parition? Then encrypting that.
I have tried it. Actually this is the main purpose of my original post. For some mysterious reasons encrypted swap files do not work even when I try on latest Debian on desktop. Partitions do but not on raspbian.

Return to “Advanced users”