I’m testing out NixOS and I’m having a strange issue. If I leave my PC for several hours (usually over night) and come back, my root partition is suddenly mounted in read-only mode. This renders my entire system immediately unusable. Most of my applications immediately crash, most terminal commands just fail with a generic “Input/Output error”, including mount
, so I’m unable to remount as read-write. I’m not even able to reboot the system, so I have to shut it down by holding the power button.
I’ve looked for errors using journalctl -b -1
but there’s nothing, possibly because nothing can be logged when the filesystem is readonly…
When I boot the system, the root mount is again read-write:
/dev/mapper/main-nixos on / type ext4 (rw,relatime)
/dev/mapper/main-nixos on /nix/store type ext4 (ro,relatime)
Have I done something stupid when installing NixOS? When I try to Google this issue, most results seem to imply that the root partition is supposed to be read-only, so I’m suspecting I may have installed NixOS wrong somehow.
Would appreciate any theories or suggestions.
Here’s my hardware-configuration.nix:
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" "amdgpu" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
fileSystems."/" =
{ device = "/dev/disk/by-uuid/c1ccb066-7fa3-408a-a442-d42d2b55ab39";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/83D5-5214";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
Here’s configuration.nix:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
let
unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
in
{
imports =
[
# Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
<home-manager/nixos>
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
hardware.bluetooth.enable = true;
networking.hostName = "cross"; # Define your hostname.
networking.extraHosts = ''
# REDACTED
'';
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
#networking.wireless.networks."Jedi Enclave 5G".psk = "3012197204";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
#networking.networkmanager.unmanaged = [ "wlp2s0" ];
# Firewall
networking.firewall = {
allowedTCPPorts = [
8384 2200 # Syncthing
4321 # Astro JS dev server port
];
allowedUDPPorts = [ 22000 21027 ]; # Syncthing
};
# Set your time zone.
time.timeZone = "Europe/Oslo";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# Configure console keymap
console.keyMap = "no";
users.users.tomas = {
isNormalUser = true;
description = "Tomas Sandven";
extraGroups = [ "networkmanager" "wheel" ];
shell = pkgs.zsh;
packages = with pkgs; [ ];
};
home-manager.users.tomas = { pkgs, ... }: {
gtk.cursorTheme.package = pkgs.gnome.adwaita-icon-theme;
gtk.cursorTheme.name = "Adwaita";
gtk.cursorTheme.size = 24;
home.stateVersion = "23.05";
home.pointerCursor.package = pkgs.gnome.adwaita-icon-theme;
home.pointerCursor.name = "Adwaita";
home.pointerCursor.size = 24;
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
nixpkgs.config.permittedInsecurePackages = [
"openssl-1.1.1u" # DELETE ASAP
"openssl-1.1.1v" # DELETE ASAP
];
security.rtkit.enable = true;
#
# System packages
#
# Use Neovim nightly
nixpkgs.overlays = [
(import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
}))
];
environment.systemPackages = with pkgs; [
bash
tmux
bat
curl
curlie
gcc
fd
ripgrep
file
pciutils # Provides "lspci"
git
glib
killall
httpie
inotify-tools
wget
jq
starship
neovim
rustup
zsh-vi-mode
xdg-utils
bluez
# GUI shit
bottles
pulseaudio # provides pactl
gtk3
gtk4
gsettings-desktop-schemas
gnome.dconf-editor
gnome.adwaita-icon-theme
gnome.nautilus
gthumb
evince
xorg.xrdb # Read $HOME/.Xresources
darkman
hyprpaper
iwgtk
kitty
j4-dmenu-desktop
insync # Client for Dropbox, Google Drive etc.
neovide
pavucontrol
playerctl
tofi
viber
telegram-desktop
discord
slack
slack-term
vivaldi
vivaldi-ffmpeg-codecs
obsidian
unstable.waybar
wl-clipboard
mako
slurp # Tool for selecting a screen region on wayland, nice for screenshots
grim # Grab screenshots from Wayland compositors
swappy # Super light weight image editor, nice for screenshots
qt6.qtwayland # Wayland support for Qt
libsForQt5.qt5.qtwayland # Wayland support for Qt
xorg.xprop # For the "xprop" command
google-chrome
];
fonts.fonts = with pkgs; [
(nerdfonts.override { fonts = [ "CascadiaCode" "FiraCode" "Iosevka" ]; })
];
#
# Programs
#
programs.hyprland = {
package = unstable.hyprland;
enable = true;
xwayland.enable = true;
xwayland.hidpi = true;
};
programs.zsh = {
enable = true;
promptInit = ''
# Starship
eval "$(starship init zsh)"
'';
interactiveShellInit = ''
# Custom shell stuff
if [[ -f "$HOME/syncthing/dotfiles/shell-setup.zsh" ]]; then
source "$HOME/syncthing/dotfiles/shell-setup.zsh"
fi
# FZF
export FZF_DEFAULT_OPTS="--height 50% --reverse --border"
export FZF_CTRL_R_OPTS="--height 10 --layout default"
export FZF_DEFAULT_COMMAND='
find . -type f,l \
! -path "*/.*/*" \
! -path "*/__pycache__/*" \
! -path "*/node_modules/*"'
# zsh-vi-mode
source "${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh"
zvm_after_init_commands+=('__zvm_apply_keybindings')
function __zvm_apply_keybindings() {
source "$(fzf-share)/key-bindings.zsh"
}
export ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BEAM
export ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
export ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
export ZVM_CURSOR_STYLE_ENABLED=true
'';
};
programs.fzf = {
keybindings = true;
fuzzyCompletion = true;
};
#
# Services
#
services.dbus.enable = true;
services.syncthing = {
enable = true;
user = "tomas";
dataDir = "/home/tomas/syncthing";
configDir = "/home/tomas/.config/syncthing";
overrideDevices = true;
devices = {
# REDACTED
};
};
sound.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ];
};
services.gnome.gnome-settings-daemon.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "no";
xkbVariant = "";
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}