Cannot boot after creating swap file - btrfs

Hi all,

I am new with btrfs and wanted to increase my swapfile to use hibernation.

I swapoff the old one (/swap/swapfile) and created a new one following the arch wiki. Modified the /etc/fstab:

# /etc/fstab: static file system information.
#
# Use ‘blkid’ to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
#      

UUID=1C40-BF0F /boot/efi vfat defaults,umask=0077 0 2

UUID=5d459365-f006-4056-b726-3b3897b780c1 / btrfs subvol=/@,defaults,compress=zstd:1 0 0

UUID=5d459365-f006-4056-b726-3b3897b780c1 /home btrfs subvol=/@homehome,defaults,compress=zstd:1 0 0

UUID=5d459365-f006-4056-b726-3b3897b780c1 /var/cache btrfs subv@cachel=/@cache,defaults,compress=zstd:1 0 0

UUID=5d459365-f006-4056-b726-3b3897b780c1 /var/log btrfs@logsubvol=/@log,defaults,compress=zstd:1 0 0

UUID=5d459365-f006-4056-b726-3b3897b780c1 /swapSub btrfs subvol=/@swapSub,defaults,noatime 0 0

#/swap/swapfile swap swap defaults 0 0

/swapSub/swapfile none swap defaults 0 0

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

This text will be hidden

The images are showing the current situation after reboot. It seems the system cannot mount /swapSub.

I think the minimum goal is to get the system to boot again, even without swap. However, I don’t have experience with btrfs.

Thank you.

Edit1:

inxi -zv8                                                        ✔ 
System:
  Kernel: 6.12.48-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 15.2.1
    clocksource: tsc avail: hpet,acpi_pm
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.12-x86_64
    root=UUID=5d459365-f006-4056-b726-3b3897b780c1 rw rootflags=subvol=@
    quiet splash apparmor=1 security=apparmor udev.log_priority=3
  Desktop: Xfce v: 4.20.1 tk: Gtk v: 3.24.48 wm: xfwm4 v: 4.20.0
    with: xfce4-panel tools: xfce4-screensaver vt: 7 dm: LightDM v: 1.32.0
    Distro: Manjaro base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 20FMS03600 v: ThinkPad T460
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: LENOVO model: 20FMS03600 serial: <superuser required>
    part-nu: LENOVO_MT_20FM_BU_Think_FM_ThinkPad T460 uuid: <superuser required>
    UEFI: LENOVO v: R06ET68W (1.42 ) date: 10/08/2019
Battery:
  ID-1: BAT0 charge: 14.8 Wh (99.9%) condition: 14.8/23.2 Wh (63.7%)
    volts: 12.32 min: 11.1 model: SANYO 45N1773 type: Li-ion serial: <filter>
    charging: status: not charging control: start: 0% end: 100% cycles: N/A
  ID-2: BAT1 charge: 2.7 Wh (14.6%) condition: 18.6/23.2 Wh (80.3%)
    power: 7.8 W volts: 10.85 min: 11.1 model: SANYO 45N1775 type: Li-ion
    serial: <filter> charging: status: discharging control: start: 0%
    end: 100% cycles: N/A
Memory:
  System RAM: total: 16 GiB available: 15.49 GiB used: 3.51 GiB (22.6%)
  Message: For most reliable report, use superuser + dmidecode.
  Array-1: capacity: 32 GiB slots: 2 modules: 2 EC: None
    max-module-size: 16 GiB note: est.
  Device-1: ChannelA-DIMM0 type: DDR3 detail: synchronous size: 8 GiB
    speed: 1600 MT/s volts: curr: 1.35 width (bits): data: 64 total: 64
    manufacturer: Kingston part-no: 99U5428-018.A00LF serial: <filter>
  Device-2: ChannelB-DIMM0 type: DDR3 detail: synchronous size: 8 GiB
    speed: 1600 MT/s volts: curr: 1.35 width (bits): data: 64 total: 64
    manufacturer: SK Hynix part-no: HMT41GS6BFR8A-PB serial: <filter>
PCI Slots:
  Permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Core i5-6200U bits: 64 type: MT MCP arch: Skylake
    gen: core 6 level: v3 note: check built: 2015 process: Intel 14nm family: 6
    model-id: 0x4E (78) stepping: 3 microcode: 0xF0
  Topology: cpus: 1x dies: 1 clusters: 2 cores: 2 threads: 4 tpc: 2
    smt: enabled cache: L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB
    desc: 2x256 KiB L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 500 min/max: 400/2800 scaling: driver: intel_pstate
    governor: powersave cores: 1: 500 2: 500 3: 500 4: 500 bogomips: 19204
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2 bts clflush
    clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64
    dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu
    fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs ida
    intel_pt invpcid lahf_lm lm mca mce md_clear mmx monitor movbe mpx msr
    mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm pdpe1gb pebs pge
    pln pni popcnt pse pse36 pti pts rdrand rdseed rdtscp rep_good sdbg sep
    smap smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2
    tpr_shadow tsc tsc_adjust tsc_deadline_timer vme vmx vnmi vpid x2apic
    xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
  Vulnerabilities:
  Type: gather_data_sampling status: Vulnerable: No microcode
  Type: indirect_target_selection status: Not affected
  Type: itlb_multihit status: KVM: Split huge pages
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS; IBPB: conditional; STIBP: conditional;
    RSB filling; PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds mitigation: Microcode
  Type: tsa status: Not affected
  Type: tsx_async_abort status: Not affected
  Type: vmscape mitigation: IBPB before exit to userspace
Graphics:
  Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: Lenovo driver: i915
    v: kernel arch: Gen-9 process: Intel 14n built: 2015-16 ports: active: eDP-1
    empty: DP-1, DP-2, HDMI-A-1, HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:1916
    class-ID: 0300
  Device-2: Lite-On Integrated Camera driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-10:4 chip-ID: 04ca:7058
    class-ID: 0e02
  Display: x11 server: X.org v: 1.21.1.18 with: Xwayland v: 24.1.8
    compositor: xfwm4 v: 4.20.0 driver: X: loaded: modesetting
    alternate: fbdev,vesa dri: iris gpu: i915 display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-size: <missing: xdpyinfo>
  Monitor-1: eDP-1 model: ChiMei InnoLux 0x14b1 built: 2015 res:
    mode: 1920x1080 hz: 60 scale: 100% (1) dpi: 158 gamma: 1.2 chroma: red:
    x: 0.573 y: 0.333 green: x: 0.322 y: 0.584 blue: x: 0.161 y: 0.145 white:
    x: 0.314 y: 0.329 size: 308x173mm (12.13x6.81") diag: 353mm (13.9")
    ratio: 16:9 modes: 1920x1080
  API: EGL v: 1.5 hw: drv: intel iris platforms: device: 0 drv: iris
    device: 1 drv: swrast gbm: drv: iris surfaceless: drv: iris x11: drv: iris
    inactive: wayland
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 25.2.3-arch1.2
    glx-v: 1.4 direct-render: yes renderer: Mesa Intel HD Graphics 520 (SKL GT2)
    device-ID: 8086:1916 memory: 15.13 GiB unified: yes
  API: Vulkan v: 1.4.321 layers: 2 device: 0 type: integrated-gpu name: Intel
    HD Graphics 520 (SKL GT2) driver: mesa intel v: 25.2.3-arch1.2
    device-ID: 8086:1916 surfaces: N/A
  Info: Tools: api: eglinfo, glxinfo, vulkaninfo de: xfce4-display-settings
    x11: xprop,xrandr
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel alternate: snd_soc_avs bus-ID: 00:1f.3
    chip-ID: 8086:9d70 class-ID: 0403
  API: ALSA v: k6.12.48-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 1.4.8 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Ethernet I219-V vendor: Lenovo driver: e1000e v: kernel
    port: N/A bus-ID: 00:1f.6 chip-ID: 8086:1570 class-ID: 0200
  IF: enp0s31f6 state: down mac: <filter>
  Device-2: Intel Wireless 8260 driver: iwlwifi v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 bus-ID: 04:00.0 chip-ID: 8086:24f3 class-ID: 0280
  IF: wlp4s0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: dynamic noprefixroute scope: global
  IP v6: <filter> type: noprefixroute scope: link
  Info: services: NetworkManager, systemd-timesyncd, wpa_supplicant
  WAN IP: <filter>
Bluetooth:
  Message: No bluetooth data found.
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 1.82 TiB used: 208.4 GiB (11.2%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Crucial model: CT2000MX500SSD1
    size: 1.82 TiB block-size: physical: 4096 B logical: 512 B speed: 6.0 Gb/s
    tech: SSD serial: <filter> fw-rev: 023 scheme: GPT
  Message: No optical or floppy data found.
Partition:
  ID-1: / raw-size: 1.82 TiB size: 1.82 TiB (100.00%) used: 208.4 GiB (11.2%)
    fs: btrfs dev: /dev/sda2 maj-min: 8:2 label: N/A
    uuid: 5d459365-f006-4056-b726-3b3897b780c1
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 632 KiB (0.2%) fs: vfat dev: /dev/sda1 maj-min: 8:1 label: N/A
    uuid: 1C40-BF0F
  ID-3: /home raw-size: 1.82 TiB size: 1.82 TiB (100.00%)
    used: 208.4 GiB (11.2%) fs: btrfs dev: /dev/sda2 maj-min: 8:2 label: N/A
    uuid: 5d459365-f006-4056-b726-3b3897b780c1
  ID-4: /swap raw-size: 1.82 TiB size: 1.82 TiB (100.00%)
    used: 208.4 GiB (11.2%) fs: btrfs dev: /dev/sda2 maj-min: 8:2 label: N/A
    uuid: 5d459365-f006-4056-b726-3b3897b780c1
  ID-5: /var/cache raw-size: 1.82 TiB size: 1.82 TiB (100.00%)
    used: 208.4 GiB (11.2%) fs: btrfs dev: /dev/sda2 maj-min: 8:2 label: N/A
    uuid: 5d459365-f006-4056-b726-3b3897b780c1
  ID-6: /var/log raw-size: 1.82 TiB size: 1.82 TiB (100.00%)
    used: 208.4 GiB (11.2%) fs: btrfs dev: /dev/sda2 maj-min: 8:2 label: N/A
    uuid: 5d459365-f006-4056-b726-3b3897b780c1
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: file size: 512 MiB used: 0 KiB (0.0%) priority: -2
    file: /swap/swapfile
Unmounted:
  Message: No unmounted partitions found.
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 12 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-9:3 info: Validity Sensors VFS 5011 fingerprint sensor
    type: <vendor specific> driver: N/A interfaces: 1 rev: 1.1
    speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 power: 100mA
    chip-ID: 138a:0017 class-ID: ff00 serial: <filter>
  Device-2: 1-10:4 info: Lite-On Integrated Camera type: video
    driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s)
    lanes: 1 mode: 2.0 power: 500mA chip-ID: 04ca:7058 class-ID: 0e02
  Hub-2: 2-0:1 info: super-speed hub ports: 6 rev: 3.0
    speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 35.0 C pch: 34.0 C mobo: N/A
  Fan Speeds (rpm): fan-1: 0
Repos:
  Packages: pm: pacman pkgs: 1368 libs: 389 tools: pamac,yay pm: flatpak
    pkgs: 0
  Active pacman repo servers in: /etc/pacman.d/mirrorlist
    1: https://mirror.23m.com/manjaro/stable/$repo/$arch
    2: https://mirror.netcologne.de/manjaro/stable/$repo/$arch
    3: https://mirror.alpix.eu/manjaro/stable/$repo/$arch
    4: https://ftp.gwdg.de/pub/linux/manjaro/stable/$repo/$arch
    5: https://ftp.tu-chemnitz.de/pub/linux/manjaro/stable/$repo/$arch
    6: https://ftp.rz.tu-bs.de/pub/mirror/manjaro.org/repos/stable/$repo/$arch
Processes:
  CPU top: 5 of 244
  1: cpu: 14.7% command: firefox pid: 1829 mem: 760.9 MiB (4.7%)
  2: cpu: 12.3% command: zsh pid: 4515 mem: 10.4 MiB (0.0%)
  3: cpu: 6.5% command: firefox pid: 2076 mem: 559.3 MiB (3.5%)
  4: cpu: 6.1% command: xfce4-taskmanager pid: 1406 mem: 52.7 MiB (0.3%)
  5: cpu: 4.5% command: firefox pid: 3373 mem: 306.8 MiB (1.9%)
  Memory top: 5 of 244
  1: mem: 760.9 MiB (4.7%) command: firefox pid: 1829 cpu: 14.7%
  2: mem: 559.3 MiB (3.5%) command: firefox pid: 2076 cpu: 6.5%
  3: mem: 318.9 MiB (2.0%) command: firefox pid: 2298 cpu: 1.8%
  4: mem: 306.8 MiB (1.9%) command: firefox pid: 3373 cpu: 4.5%
  5: mem: 303.4 MiB (1.9%) command: firefox pid: 2012 cpu: 3.0%
Info:
  Processes: 244 Power: uptime: 17m states: freeze,mem,disk suspend: deep
    avail: s2idle wakeups: 0 hibernate: platform avail: shutdown, reboot,
    suspend, test_resume image: 6.18 GiB services: upowerd,xfce4-power-manager
    Init: systemd v: 257 default: graphical tool: systemctl
  Compilers: gcc: 15.2.1 Shell: Zsh v: 5.9 running-in: xfce4-terminal
    inxi: 3.3.39


Mod edit:- Please avoid unnecessary images of text - use text instead. Images have been removed and replaced with text descriptions as appropriate.
Image 1. Standard Emergency mode prompt.
Image 3. Mount failure message:

[lenovoThinkpad` ~]# mount-a
mount: /swapSub: fsconfig() failed: No such file or directory.

Minor cosmetic edits. No charge.

To disable..

Just live boot, and edit your /etc/fstab. The standard manajro-chroot way works, but you just need to boot, then mount your root volume and edit the file. (sudo mount -o subvol=@ /dev/... /mnt)

Just comment out the two lines:

UUID=5d459365-f006-4056-b726-3b3897b780c1 /swapSub btrfs subvol=/@swapSub,defaults,noatime 0 0

/swapSub/swapfile none swap defaults 0 0

I do not use a swap file (for performance reasons). But it the cause might be that compression is enabled.

I have used sudo chattr +C on specific files/folders which may solve this. In this case just your swap file. But better yet, mount the volume with it disabled via the option nodatacow.

UUID=5d459365-f006-4056-b726-3b3897b780c1 /swapSub btrfs subvol=/@swapSub,defaults,noatime,nodatacow 0 0

1 Like

From the first picture do what it says & press control-D. From there you can log into maybe what is called a tty.

From the tty enter sudo nano /etc/fstab enter. Once opened you can add a # to the beginning of the offending swap file entry. Save & reboot. Once booted up you can then go back to the fstab file to fix it.

1 Like

That way works too. (I guess I assumed it didn’t.)

Many ways to edit a file.

Once your system is booting again, it might be prudent to evaluate your system resources, before committing to a swap file for hibernation.

In many cases a more performant result is achieved with a swap partition, or a combination of both using zswap.

When you are able, please provide your system information as described (below).

Regards.


Welcome to the Manjaro community

As a new or infrequent forum user, please take some time to familiarise yourself with Forum requirements, and the many ways to use the forum to your benefit.

To that end, links are provided (below) - Please use them.


Be prepared to provide outputs from various commands when asked. It’s equally important to provide as much actionable information as possible in your first post, rather than simply indicating there is a problem.

Waiting for others to blindly ask questions can be counter-productive – typically, nobody has a :crystal_ball: at their disposal – Instead, please help others to make informed suggestions, based on information you provide.


Update Announcements

The Update Announcements contain important information and a Known Issues and Solutions section that should generally be checked before posting a request for support.

System Information

While information from *-fetch type apps might be fine for someone wishing to buy your computer, for Support purposes it’s better to ask your system directly; :eyes:

Output of the inxi command (with appropriate parameters, and formatted according to forum guidelines) will generate information useful for those wishing to help:

inxi --filter --verbosity=8

or the short form (preferred):

inxi -zv8
Highly Recommended
Technical Resources
Required Reading

I will read your comments carefully after work and respond.

I will provide the inxi output, I forgot that. The idea if using swapfile is to avoid wear of the ssd.

When using a swap file on btrfs, the swap file must be set up to not use compression and to not use copy-on-write. The kernel needs to be able to access the raw drive blocks, and without those two attributes set, it cannot do that.

Swap files are either way only a mess anyway. Yes, their size can be more easily adjusted, but the proper way to create a swap device in UNIX is to use a dedicated swap partition without a filesystem on it.


I don’t see how the use of a swap file could possibly avoid SSD wear. :face_with_raised_eyebrow:

7 Likes

Every SSD has wear leveling built into its firmware. Therefore, in most cases, it’s inappropriate to try to improve it yourself.

The same applies to BTRFS: swapping is best done via partition. All other methods are more complicated and have one or another disadvantage.
:footprints:

5 Likes

Thanks to all of you. Just reverting the changes in fstab made the system bootable.

At first, I was following the manual in the manjaro wiki but at the third line of code I didn’t worked.

Anyway, I will focus on a swap partition. From a quick search, creating a swap partition for btrfs is like creating one for ext4, I can avoid the hassle with swiching off compression and cow.

I added the inxi output to the first post.

A swap partition doesn’t have a filesystem, so neither btrfs nor ext4 have any relevance.

Here’s a quick step-by-step guide:

  1. Create a new partition (you can use gparted), set the filesystem to linux-swap
  2. Get the UUID using lsblk -f
  3. Update the swap entry in /etc/fstab with the UUID
  4. Reload the config using sudo systemctl daemon-reload
  5. Test using sudo swapon -a

You may have to free up some space before you can create the partition.

4 Likes

If by “third line of code” you meant a command, which command didn’t work for you? Was it sudo btrfs property set /swapfile compression none?

What was the associated message?